| 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * Further, this software is distributed without any warranty that it is |
| 16 | * free of the rightful claim of any third person regarding infringement |
| 17 | * or the like. Any license provided herein, whether implied or |
| 18 | * otherwise, applies only to this software file. Patent licenses, if |
| 19 | * any, provided herein do not apply to combinations of this program with |
| 20 | * other software, or any other product whatsoever. |
| 21 | * |
| 22 | * You should have received a copy of the GNU Lesser General Public |
| 23 | * License along with this library; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 27 | * Mountain View, CA 94043, or: |
| 28 | * |
| 29 | * http://www.sgi.com |
| 30 | * |
| 31 | * For further information regarding this notice, see: |
| 32 | * |
| 33 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | * bin.c++ - $Revision: 1.1.1.1 $ |
| 39 | * Derrick Burns - 1991 |
| 40 | */ |
| 41 | |
| 42 | #include "glimports.h"cxx . . $ `<file>/lib/database/src/so/nodes/nurbs/head/glimports.h`/ |
| 43 | #include "mystdio.h"cxx . . $ `<file>/lib/database/src/so/nodes/nurbs/head/mystdio.h`/ |
| 44 | #include "myassert.h"cxx . . $ `<file>/lib/database/src/so/nodes/nurbs/head/myassert.h`/ |
| 45 | #include "bin.h"cxx . . $ `<file>/lib/database/src/so/nodes/nurbs/head/bin.h`/ |
| 46 | |
| 47 | /*---------------------------------------------------------------------------- |
| 48 | * Constructor and destructor |
| 49 | *---------------------------------------------------------------------------- |
| 50 | */ |
| 51 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!() |
| 52 | { |
| 53 | headcxx . . $ _SoNurbsBin#head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | } |
| 55 | |
| 56 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::~cxx . . $ _SoNurbsBin#`~_SoNurbsBin`(49f6e7a06ebc5aa8).Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!() |
| 57 | { |
| 58 | assertcxx . . $ `/usr/include/assert.h:50:10`!( head == NULL); |
| 59 | } |
| 60 | |
| 61 | /*---------------------------------------------------------------------------- |
| 62 | * remove_this_arc - remove given Arc_ptr from bin |
| 63 | *---------------------------------------------------------------------------- |
| 64 | */ |
| 65 | |
| 66 | void |
| 67 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::remove_this_arccxx . . $ _SoNurbsBin#remove_this_arc(9128f98445bd5a46).( Arc_ptrcxx . . $ Arc_ptr# arc ) |
| 68 | { |
| 69 | Arc_ptrcxx . . $ Arc_ptr# *j; |
| 70 | for( j = &(headcxx . . $ _SoNurbsBin#head.); (*j != 0) && (*j != arc); j = &((*j)->linkcxx . . $ _SoNurbsArc#link.) ); |
| 71 | |
| 72 | if( *j != 0 ) { |
| 73 | if( *j == currentcxx . . $ _SoNurbsBin#current. ) |
| 74 | currentcxx . . $ _SoNurbsBin#current. = (*j)->linkcxx . . $ _SoNurbsArc#link.; |
| 75 | *j = (*j)->linkcxx . . $ _SoNurbsArc#link.; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /*---------------------------------------------------------------------------- |
| 80 | * numarcs - count number of arcs in bin |
| 81 | *---------------------------------------------------------------------------- |
| 82 | */ |
| 83 | |
| 84 | int |
| 85 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::numarcscxx . . $ _SoNurbsBin#numarcs(b126dc7c1de90089).() |
| 86 | { |
| 87 | long count = 0; |
| 88 | for( Arc_ptrcxx . . $ Arc_ptr# jarc = firstarccxx . . $ _SoNurbsBin#firstarc(964848ef0dc04f27).(); jarc; jarc = nextarccxx . . $ _SoNurbsBin#nextarc(964848ef0dc04f27).() ) |
| 89 | count++; |
| 90 | return count; |
| 91 | } |
| 92 | |
| 93 | /*---------------------------------------------------------------------------- |
| 94 | * adopt - place an orphaned arcs into their new parents bin |
| 95 | *---------------------------------------------------------------------------- |
| 96 | */ |
| 97 | |
| 98 | void |
| 99 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::adoptcxx . . $ _SoNurbsBin#adopt(49f6e7a06ebc5aa8).() |
| 100 | { |
| 101 | markallcxx . . $ _SoNurbsBin#markall(49f6e7a06ebc5aa8).(); |
| 102 | |
| 103 | Arc_ptrcxx . . $ Arc_ptr# orphan; |
| 104 | while( orphan = removearccxx . . $ _SoNurbsBin#removearc(964848ef0dc04f27).() ) { |
| 105 | for( Arc_ptrcxx . . $ Arc_ptr# parent = orphan->nextcxx . . $ _SoNurbsArc#next.; parent != orphan; parent = parent->nextcxx . . $ _SoNurbsArc#next. ) { |
| 106 | if (! parent->ismarkedcxx . . $ _SoNurbsArc#ismarked(da6335ded91d79c2).() ) { |
| 107 | orphan->linkcxx . . $ _SoNurbsArc#link. = parent->linkcxx . . $ _SoNurbsArc#link.; |
| 108 | parent->linkcxx . . $ _SoNurbsArc#link. = orphan; |
| 109 | orphan->clearmarkcxx . . $ _SoNurbsArc#clearmark(49f6e7a06ebc5aa8).(); |
| 110 | break; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | |
| 117 | /*---------------------------------------------------------------------------- |
| 118 | * show - print out descriptions of the arcs in the bin |
| 119 | *---------------------------------------------------------------------------- |
| 120 | */ |
| 121 | |
| 122 | void |
| 123 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::showcxx . . $ _SoNurbsBin#show(fda57c8427c60377).( char *name ) |
| 124 | { |
| 125 | #ifndef NDEBUGcxx . . $ `<built-in>:440:9`! |
| 126 | dprintf( "%s\n", name ); |
| 127 | for( Arc_ptr jarc = firstarc(); jarc; jarc = nextarc() ) |
| 128 | jarc->show( ); |
| 129 | #endif |
| 130 | } |
| 131 | |
| 132 | |
| 133 | |
| 134 | /*---------------------------------------------------------------------------- |
| 135 | * markall - mark all arcs with an identifying tag |
| 136 | *---------------------------------------------------------------------------- |
| 137 | */ |
| 138 | |
| 139 | void |
| 140 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::markallcxx . . $ _SoNurbsBin#markall(49f6e7a06ebc5aa8).() |
| 141 | { |
| 142 | for( Arc_ptrcxx . . $ Arc_ptr# jarc=firstarccxx . . $ _SoNurbsBin#firstarc(964848ef0dc04f27).(); jarc; jarc=nextarccxx . . $ _SoNurbsBin#nextarc(964848ef0dc04f27).() ) |
| 143 | jarc->setmarkcxx . . $ _SoNurbsArc#setmark(49f6e7a06ebc5aa8).(); |
| 144 | } |
| 145 | |
| 146 | /*---------------------------------------------------------------------------- |
| 147 | * listBezier - print out all arcs that are untessellated border arcs |
| 148 | *---------------------------------------------------------------------------- |
| 149 | */ |
| 150 | |
| 151 | void |
| 152 | Bincxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:46:9`!::listBeziercxx . . $ _SoNurbsBin#listBezier(49f6e7a06ebc5aa8).( void ) |
| 153 | { |
| 154 | for( Arc_ptrcxx . . $ Arc_ptr# jarc=firstarccxx . . $ _SoNurbsBin#firstarc(964848ef0dc04f27).(); jarc; jarc=nextarccxx . . $ _SoNurbsBin#nextarc(964848ef0dc04f27).() ) { |
| 155 | if( jarc->isbeziercxx . . $ _SoNurbsArc#isbezier(da6335ded91d79c2).( ) ) { |
| 156 | assertcxx . . $ `/usr/include/assert.h:50:10`!( jarc->pwlArc->npts == 2 ); |
| 157 | TrimVertexcxx . . $ `lib/database/src/so/nodes/nurbs/_defines.h:96:9`! *pts = jarc->pwlArccxx . . $ _SoNurbsArc#pwlArc.->ptscxx . . $ _SoNurbsPwlArc#pts.; |
| 158 | REALcxx . . $ REAL# s1 = pts[0].paramcxx . . $ _SoNurbsTrimVertex#param.[0]; |
| 159 | REALcxx . . $ REAL# t1 = pts[0].paramcxx . . $ _SoNurbsTrimVertex#param.[1]; |
| 160 | REALcxx . . $ REAL# s2 = pts[1].paramcxx . . $ _SoNurbsTrimVertex#param.[0]; |
| 161 | REALcxx . . $ REAL# t2 = pts[1].paramcxx . . $ _SoNurbsTrimVertex#param.[1]; |
| 162 | #ifndef NDEBUGcxx . . $ `<built-in>:440:9`! |
| 163 | dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 ); |
| 164 | #endif |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 |