| 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 | | Description: |
| 39 | | Defines the NurbMaker class. Given a quadMesh, |
| 40 | | a bunch of parameters, it creates a group node with a bunch |
| 41 | | of SoIndexedNurbsSurface nodes. These nodes will create a nurbs |
| 42 | | surface if placed after an SoCoordinate3 node with the number of |
| 43 | | points specified by the QuadMesh node. |
| 44 | | |
| 45 | | Note that you only need to look at the SoCoordinate3 node if |
| 46 | | you need to figure out whether edges match for wraparound. |
| 47 | | Otherwise this is all strictly 'topological' |
| 48 | | |
| 49 | | Author(s) : Paul Isaacs |
| 50 | */ |
| 51 | |
| 52 | |
| 53 | |
| 54 | #include <Inventor/nodes/SoCoordinate3.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoCoordinate3.h`/ |
| 55 | #include <Inventor/nodes/SoGroup.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoGroup.h`/ |
| 56 | #include <Inventor/nodes/SoQuadMesh.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoQuadMesh.h`/ |
| 57 | #include <Inventor/nodes/SoIndexedNurbsSurface.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoIndexedNurbsSurface.h`/ |
| 58 | |
| 59 | #include "NurbMaker.h"cxx . . $ `<file>/apps/nodes/GeneralizedCylinder/NurbMaker.h`/ |
| 60 | |
| 61 | // These knot vectors are used to make CUBIC_TO_EDGE splines |
| 62 | // meet up with the mesh edge. |
| 63 | |
| 64 | static float cubic2FromLateEdgeKnotscxx . . $ cubic2FromLateEdgeKnots.[8] = { 0, 1, 2, 3, 4, 5, 6, 6 }; |
| 65 | static float cubic1FromLateEdgeKnotscxx . . $ cubic1FromLateEdgeKnots.[8] = { 0, 1, 2, 3, 4, 5, 5, 5 }; |
| 66 | static float cubic0FromLateEdgeKnotscxx . . $ cubic0FromLateEdgeKnots.[8] = { 0, 1, 2, 3, 4, 4, 4, 4 }; |
| 67 | |
| 68 | static float cubic2FromEarlyEdgeKnotscxx . . $ cubic2FromEarlyEdgeKnots.[8] = { 0, 0, 1, 2, 3, 4, 5, 6 }; |
| 69 | static float cubic1FromEarlyEdgeKnotscxx . . $ cubic1FromEarlyEdgeKnots.[8] = { 0, 0, 0, 1, 2, 3, 4, 5 }; |
| 70 | static float cubic0FromEarlyEdgeKnotscxx . . $ cubic0FromEarlyEdgeKnots.[8] = { 0, 0, 0, 0, 1, 2, 3, 4 }; |
| 71 | |
| 72 | // Creates group with new SoIndexedNurbsSurface nodes underneath. |
| 73 | SoGroupcxx . . $ SoGroup# * |
| 74 | NurbMakercxx . . $ NurbMaker#::createNurbsGroupcxx . . $ NurbMaker#createNurbsGroup(286444afd3e430e7).( SoQuadMeshcxx . . $ SoQuadMesh# *quadNode, SoCoordinate3cxx . . $ SoCoordinate3# *coordNode ) |
| 75 | { |
| 76 | SbBoolcxx . . $ SbBool# rowsMatch = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 77 | SbBoolcxx . . $ SbBool# colsMatch = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 78 | |
| 79 | int vPerCol = (int) quadNode->verticesPerColumncxx . . $ SoQuadMesh#verticesPerColumn..getValuecxx . . $ SoSFInt32#getValue(455f465bc33b4cdf).(); |
| 80 | int vPerRow = (int) quadNode->verticesPerRowcxx . . $ SoQuadMesh#verticesPerRow..getValuecxx . . $ SoSFInt32#getValue(455f465bc33b4cdf).(); |
| 81 | |
| 82 | SbVec2scxx . . $ SbVec2s# quadMeshDivscxx . . $ SbVec2s#SbVec2s(af780a7c10c7990f).( vPerRow, vPerCol ); |
| 83 | |
| 84 | // Only bother checking if we're wrapping. |
| 85 | if (coordNode != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`! && myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] == TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) { |
| 86 | rowsMatch = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 87 | // Test if first and last row are the same. |
| 88 | for (int topInd = 0, botInd = vPerRow * (vPerCol - 1); |
| 89 | topInd < vPerRow; topInd++, botInd++ ) { |
| 90 | if ( coordNode->pointcxx . . $ SoCoordinate3#point.[cxx . . $ SoMFVec3f#`operator[]`(e550528ef0703ba8).topInd] !=cxx . . $ `operator!=`(648f52454fd9f27). coordNode->pointcxx . . $ SoCoordinate3#point.[cxx . . $ SoMFVec3f#`operator[]`(e550528ef0703ba8).botInd] ) { |
| 91 | rowsMatch = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | if (coordNode != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`! && myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] == TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) { |
| 96 | SbBoolcxx . . $ SbBool# colsMatch = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 97 | // Test if first and last col are the same. |
| 98 | for (int leftInd = 0, rightInd = vPerRow - 1; |
| 99 | leftInd < vPerRow * (vPerCol - 1); |
| 100 | leftInd += vPerRow, rightInd += vPerRow) { |
| 101 | if ( coordNode->pointcxx . . $ SoCoordinate3#point.[cxx . . $ SoMFVec3f#`operator[]`(e550528ef0703ba8).leftInd] !=cxx . . $ `operator!=`(648f52454fd9f27). coordNode->pointcxx . . $ SoCoordinate3#point.[cxx . . $ SoMFVec3f#`operator[]`(e550528ef0703ba8).rightInd] ) { |
| 102 | colsMatch = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return ( createNurbsGroupcxx . . $ NurbMaker#createNurbsGroup(a643191e15929466).( quadMeshDivs, SbVec2scxx . . $ SbVec2s#SbVec2s(af780a7c10c7990f).(rowsMatch,colsMatch ))); |
| 108 | } |
| 109 | |
| 110 | // Creates group with new SoIndexedNurbsSurface nodes underneath. |
| 111 | SoGroupcxx . . $ SoGroup# * |
| 112 | NurbMakercxx . . $ NurbMaker#::createNurbsGroupcxx . . $ NurbMaker#createNurbsGroup(a643191e15929466).( SbVec2scxx . . $ SbVec2s# numQuadMeshDivisions, |
| 113 | SbVec2scxx . . $ SbVec2s# doEdgesMatch ) |
| 114 | { |
| 115 | establishMyKnotParamscxx . . $ NurbMaker#establishMyKnotParams(49f6e7a06ebc5aa8).(); |
| 116 | // The patch size is the number of control points on the side |
| 117 | // of each patch. It's determined by the number of knots and order |
| 118 | SbVec2scxx . . $ SbVec2s# patchSize = myNumKnotscxx . . $ NurbMaker#myNumKnots. -cxx . . $ operator-(6a4e858a6b02a044). myOrdercxx . . $ NurbMaker#myOrder.; |
| 119 | |
| 120 | // Make a group to put the new NURBS under |
| 121 | if (nurbsGroupcxx . . $ NurbMaker#nurbsGroup. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) |
| 122 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 123 | |
| 124 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup. = new SoGroupcxx . . $ SoGroup#; |
| 125 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 126 | |
| 127 | // What are the mesh dimensions? |
| 128 | int vPerRow = (int) numQuadMeshDivisions[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; |
| 129 | int vPerCol = (int) numQuadMeshDivisions[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; |
| 130 | |
| 131 | // Determine last row and last column that we can use for our |
| 132 | // upper left corner of our little patch. |
| 133 | // Initially, figure that the last patch's right/bottom edge |
| 134 | // need to line up with the mesh's right/bottom edge. |
| 135 | int lastRowToDo = vPerCol - patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; |
| 136 | int lastColToDo = vPerRow - patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; |
| 137 | |
| 138 | // If we don't wrap, all rows and columns are used. |
| 139 | // If we are wrapping and the first&last row/column are the same, |
| 140 | // then we will never use the last row/column. |
| 141 | int numUseableRows = vPerCol; |
| 142 | int numUseableCols = vPerRow; |
| 143 | |
| 144 | // If we're wrapping rows, the last patch left edge is the same as the |
| 145 | // mesh's right edge. |
| 146 | // But if the left and right edges of the mesh are identical, we don't |
| 147 | // need to repeat the set of patches that uses the mesh's right edge as |
| 148 | // their own (the patches' own) left edge. |
| 149 | if (myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] == TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) { |
| 150 | if (doEdgesMatch[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]) { |
| 151 | lastRowToDo = vPerCol - 2; |
| 152 | numUseableRows = vPerCol - 1; |
| 153 | } |
| 154 | else { |
| 155 | lastRowToDo = vPerCol - 1; |
| 156 | numUseableRows = vPerCol; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // If we're wrapping cols, the last patch top edge is the same as the |
| 161 | // mesh's bottom edge. |
| 162 | // But if the top and bottom edges of the mesh are identical, we don't |
| 163 | // need to repeat the set of patches that uses the mesh's bottom edge as |
| 164 | // their own (the patches' own) top edge. |
| 165 | if (myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] == TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) { |
| 166 | if (doEdgesMatch[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]) { |
| 167 | lastColToDo = vPerRow - 2; |
| 168 | numUseableCols = vPerRow - 1; |
| 169 | } |
| 170 | else { |
| 171 | lastColToDo = vPerRow - 1; |
| 172 | numUseableCols = vPerRow; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // In each patch, we will lay down the coordinate indices as either |
| 177 | // increasing from left to right , as in: |
| 178 | // 0 1 2 3 |
| 179 | // 4 5 6 7 |
| 180 | // 8 9 10 11 |
| 181 | // 12 13 14 15 |
| 182 | // |
| 183 | // or increasing from right to left, depending on 'flipNormals' |
| 184 | // 3 2 1 0 |
| 185 | // 7 6 5 4 |
| 186 | // 11 10 9 8 |
| 187 | // 15 14 13 12 |
| 188 | int numPatchInds = patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] * patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; |
| 189 | int *patchInds = new int [ numPatchInds ]; |
| 190 | if ( flipNormalscxx . . $ NurbMaker#flipNormals. == FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`! ) { |
| 191 | for (int i = 0, count=0; i < patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; i++ ){ |
| 192 | for(int j = 0; j < patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; j++ ) { |
| 193 | patchInds[count] = (i * patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]) + j; |
| 194 | count++; |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | else for (int i = 0, count=0; i < patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; i++ ){ |
| 199 | for(int j = patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]-1; j >=0; j--) { |
| 200 | patchInds[count] = (i * patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]) + j; |
| 201 | count++; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | // Now, create the patches. Each is a nurb with |
| 206 | // a patchSize[0]by patchSize[1] control point patch. |
| 207 | // The knots are as already established. |
| 208 | for ( int row = 0; row <= lastRowToDo; row+= myShiftcxx . . $ NurbMaker#myShift.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] ) { |
| 209 | for ( int col = 0; col <= lastColToDo; col+= myShiftcxx . . $ NurbMaker#myShift.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] ) { |
| 210 | |
| 211 | // Create the NURB and set the easy fields... |
| 212 | SoIndexedNurbsSurfacecxx . . $ SoIndexedNurbsSurface# *myNurb = new SoIndexedNurbsSurfacecxx . . $ SoIndexedNurbsSurface#; |
| 213 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup.->addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(myNurb); |
| 214 | myNurb->numUControlPointscxx . . $ SoIndexedNurbsSurface#numUControlPoints. =cxx . . $ SoSFInt32#`operator=`(7864480464b09eea). patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; |
| 215 | myNurb->numVControlPointscxx . . $ SoIndexedNurbsSurface#numVControlPoints. =cxx . . $ SoSFInt32#`operator=`(7864480464b09eea). patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; |
| 216 | if ( patchTypecxx . . $ NurbMaker#patchType. != CUBIC_TO_EDGEcxx . . $ NurbMaker#CUBIC_TO_EDGE.) { |
| 217 | myNurb->uKnotVectorcxx . . $ SoIndexedNurbsSurface#uKnotVector..setValuescxx . . $ SoMFFloat#setValues(269012fc1b4ba7ac).(0,myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0],myUKnotscxx . . $ NurbMaker#myUKnots.); |
| 218 | myNurb->vKnotVectorcxx . . $ SoIndexedNurbsSurface#vKnotVector..setValuescxx . . $ SoMFFloat#setValues(269012fc1b4ba7ac).(0,myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1],myVKnotscxx . . $ NurbMaker#myVKnots.); |
| 219 | } |
| 220 | else { |
| 221 | applyCubicToEdgeKnotVectorscxx . . $ NurbMaker#applyCubicToEdgeKnotVectors(d34b59135c281c0d).(row, col, myNurb, |
| 222 | lastRowToDo, lastColToDo); |
| 223 | } |
| 224 | |
| 225 | for (int pRow = 0,count = 0; pRow < patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; pRow++ ) { |
| 226 | |
| 227 | // Now we've got to set up the indices. Determine the row |
| 228 | // number in the quadmesh (0<=value<numUseableRows) |
| 229 | // to use as the row number in the patch( 0<=pRow<patchSize[1]) |
| 230 | int rowInQuadMesh = row + pRow; |
| 231 | |
| 232 | // Now check to see if we need to wraparound this row. |
| 233 | if (rowInQuadMesh >= numUseableRows) |
| 234 | rowInQuadMesh -= numUseableRows; |
| 235 | |
| 236 | for (int pCol = 0; pCol < patchSize[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; pCol++ ) { |
| 237 | |
| 238 | // Determine the col number in the mesh |
| 239 | // (0<=value<numUseableCols) to use as the col number |
| 240 | // in the patch( 0<=pRow<patchSize[0]) |
| 241 | int colInQuadMesh = col + pCol; |
| 242 | |
| 243 | // Now check to see if we need to wraparound this column. |
| 244 | if (colInQuadMesh >= numUseableCols) |
| 245 | colInQuadMesh -= numUseableCols; |
| 246 | |
| 247 | |
| 248 | myNurb->coordIndexcxx . . $ SoIndexedNurbsSurface#coordIndex..set1Valuecxx . . $ SoMFInt32#set1Value(3e454b8ccf442868).( patchInds[count], |
| 249 | rowInQuadMesh * vPerRow + colInQuadMesh); |
| 250 | |
| 251 | count++; |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | return nurbsGroupcxx . . $ NurbMaker#nurbsGroup.; |
| 258 | } |
| 259 | |
| 260 | NurbMakercxx . . $ NurbMaker#::NurbMakercxx . . $ NurbMaker#NurbMaker(49f6e7a06ebc5aa8).() |
| 261 | { |
| 262 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 263 | |
| 264 | patchTypecxx . . $ NurbMaker#patchType. = CUBIC_TO_EDGEcxx . . $ NurbMaker#CUBIC_TO_EDGE.; |
| 265 | |
| 266 | myNumKnotscxx . . $ NurbMaker#myNumKnots..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(0,0); |
| 267 | myUKnotscxx . . $ NurbMaker#myUKnots. = myVKnotscxx . . $ NurbMaker#myVKnots. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 268 | myOrdercxx . . $ NurbMaker#myOrder..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(4,4); |
| 269 | myShiftcxx . . $ NurbMaker#myShift..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(1,1); |
| 270 | myWrapcxx . . $ NurbMaker#myWrap..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(0,0); |
| 271 | |
| 272 | userNumKnotscxx . . $ NurbMaker#userNumKnots..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(0,0); |
| 273 | userUKnotscxx . . $ NurbMaker#userUKnots. = userVKnotscxx . . $ NurbMaker#userVKnots. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 274 | userOrdercxx . . $ NurbMaker#userOrder..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(4,4); |
| 275 | |
| 276 | flipNormalscxx . . $ NurbMaker#flipNormals. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 277 | } |
| 278 | |
| 279 | NurbMakercxx . . $ NurbMaker#::~cxx . . $ NurbMaker#`~NurbMaker`(49f6e7a06ebc5aa8).NurbMakercxx . . $ NurbMaker#() |
| 280 | { |
| 281 | if (nurbsGroupcxx . . $ NurbMaker#nurbsGroup.) { |
| 282 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 283 | nurbsGroupcxx . . $ NurbMaker#nurbsGroup. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | void |
| 288 | NurbMakercxx . . $ NurbMaker#::establishMyKnotParamscxx . . $ NurbMaker#establishMyKnotParams(49f6e7a06ebc5aa8).() |
| 289 | { |
| 290 | int i; |
| 291 | |
| 292 | // Take care of knot array allocation. |
| 293 | if ( patchTypecxx . . $ NurbMaker#patchType. == BEZIERcxx . . $ NurbMaker#BEZIER. || patchTypecxx . . $ NurbMaker#patchType. == CUBICcxx . . $ NurbMaker#CUBIC. |
| 294 | || patchTypecxx . . $ NurbMaker#patchType. == CUBIC_TO_EDGEcxx . . $ NurbMaker#CUBIC_TO_EDGE. ) { |
| 295 | if ( myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] != 8 ) { |
| 296 | if (myUKnotscxx . . $ NurbMaker#myUKnots. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) delete []myUKnotscxx . . $ NurbMaker#myUKnots.; |
| 297 | myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] = 8; |
| 298 | myUKnotscxx . . $ NurbMaker#myUKnots. = new float[8]; |
| 299 | } |
| 300 | if ( myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] != 8 ) { |
| 301 | if (myVKnotscxx . . $ NurbMaker#myVKnots. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) delete []myVKnotscxx . . $ NurbMaker#myVKnots.; |
| 302 | myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] = 8; |
| 303 | myVKnotscxx . . $ NurbMaker#myVKnots. = new float[8]; |
| 304 | } |
| 305 | } |
| 306 | else { |
| 307 | if (myUKnotscxx . . $ NurbMaker#myUKnots. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) delete []myUKnotscxx . . $ NurbMaker#myUKnots.; |
| 308 | if (myVKnotscxx . . $ NurbMaker#myVKnots. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) delete []myVKnotscxx . . $ NurbMaker#myVKnots.; |
| 309 | |
| 310 | myNumKnotscxx . . $ NurbMaker#myNumKnots. =cxx . . $ SbVec2s#`operator=`(1ecf307161264657). userNumKnotscxx . . $ NurbMaker#userNumKnots.; |
| 311 | |
| 312 | myUKnotscxx . . $ NurbMaker#myUKnots. = new float[myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]]; |
| 313 | myVKnotscxx . . $ NurbMaker#myVKnots. = new float[myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]]; |
| 314 | } |
| 315 | |
| 316 | // Take care of knot values and order values. |
| 317 | switch (patchTypecxx . . $ NurbMaker#patchType.) { |
| 318 | case BEZIERcxx . . $ NurbMaker#BEZIER.: |
| 319 | myOrdercxx . . $ NurbMaker#myOrder..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(4,4); |
| 320 | for (i = 0; i < 4; i++) |
| 321 | myUKnotscxx . . $ NurbMaker#myUKnots.[i] = myVKnotscxx . . $ NurbMaker#myVKnots.[i] = 0; |
| 322 | for (i = 4; i < 8; i++) |
| 323 | myUKnotscxx . . $ NurbMaker#myUKnots.[i] = myVKnotscxx . . $ NurbMaker#myVKnots.[i] = 1; |
| 324 | break; |
| 325 | case CUBICcxx . . $ NurbMaker#CUBIC.: |
| 326 | case CUBIC_TO_EDGEcxx . . $ NurbMaker#CUBIC_TO_EDGE.: |
| 327 | myOrdercxx . . $ NurbMaker#myOrder..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(4,4); |
| 328 | for (i = 0; i < 8; i++) |
| 329 | myUKnotscxx . . $ NurbMaker#myUKnots.[i] = myVKnotscxx . . $ NurbMaker#myVKnots.[i] = i; |
| 330 | break; |
| 331 | case USER_KNOTScxx . . $ NurbMaker#USER_KNOTS.: |
| 332 | myOrdercxx . . $ NurbMaker#myOrder. =cxx . . $ SbVec2s#`operator=`(1ecf307161264657). userOrdercxx . . $ NurbMaker#userOrder.; |
| 333 | for (i = 0; i < myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; i++) |
| 334 | myUKnotscxx . . $ NurbMaker#myUKnots.[i] = userUKnotscxx . . $ NurbMaker#userUKnots.[i]; |
| 335 | for (i = 0; i < myNumKnotscxx . . $ NurbMaker#myNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; i++) { |
| 336 | myVKnotscxx . . $ NurbMaker#myVKnots.[i] = userVKnotscxx . . $ NurbMaker#userVKnots.[i]; |
| 337 | } |
| 338 | break; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | void |
| 343 | NurbMakercxx . . $ NurbMaker#::setUserKnotscxx . . $ NurbMaker#setUserKnots(bfc9a9961d719c39).( SbVec2scxx . . $ SbVec2s# newNumKnots, |
| 344 | float *newUKnots, float *newVKnots) |
| 345 | { |
| 346 | userNumKnotscxx . . $ NurbMaker#userNumKnots. =cxx . . $ SbVec2s#`operator=`(1ecf307161264657). newNumKnots; |
| 347 | if (userUKnotscxx . . $ NurbMaker#userUKnots. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) |
| 348 | delete [] userUKnotscxx . . $ NurbMaker#userUKnots.; |
| 349 | if (userVKnotscxx . . $ NurbMaker#userVKnots. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) |
| 350 | delete [] userVKnotscxx . . $ NurbMaker#userVKnots.; |
| 351 | userUKnotscxx . . $ NurbMaker#userUKnots. = new float [userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]]; |
| 352 | userVKnotscxx . . $ NurbMaker#userVKnots. = new float [userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]]; |
| 353 | for (int i = 0; i < userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; i++ ) |
| 354 | userUKnotscxx . . $ NurbMaker#userUKnots.[i] = newUKnots[i]; |
| 355 | for (int j = 0; j < userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; j++ ) |
| 356 | userVKnotscxx . . $ NurbMaker#userVKnots.[j] = newVKnots[j]; |
| 357 | } |
| 358 | |
| 359 | void |
| 360 | NurbMakercxx . . $ NurbMaker#::getUserKnotscxx . . $ NurbMaker#getUserKnots(ae75fe42882ca2c7).( SbVec2scxx . . $ SbVec2s# &numKnots, |
| 361 | float * UKnots, float * VKnots) |
| 362 | { |
| 363 | numKnots =cxx . . $ SbVec2s#`operator=`(1ecf307161264657). userNumKnotscxx . . $ NurbMaker#userNumKnots.; |
| 364 | if (UKnots == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) |
| 365 | delete [] UKnots; |
| 366 | if (VKnots == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) |
| 367 | delete [] VKnots; |
| 368 | UKnots = new float [userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]]; |
| 369 | VKnots = new float [userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]]; |
| 370 | for (int i = 0; i < userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]; i++ ) |
| 371 | UKnots[i] = userUKnotscxx . . $ NurbMaker#userUKnots.[i]; |
| 372 | for (int j = 0; j < userNumKnotscxx . . $ NurbMaker#userNumKnots.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]; j++ ) |
| 373 | VKnots[j] = userVKnotscxx . . $ NurbMaker#userVKnots.[j]; |
| 374 | } |
| 375 | |
| 376 | void |
| 377 | NurbMakercxx . . $ NurbMaker#::setPatchTypecxx . . $ NurbMaker#setPatchType(1d49f8a54f528d5d).(PatchTypecxx . . $ NurbMaker#PatchType# newPatchType) |
| 378 | { |
| 379 | patchTypecxx . . $ NurbMaker#patchType. = newPatchType; |
| 380 | if (patchTypecxx . . $ NurbMaker#patchType. == BEZIERcxx . . $ NurbMaker#BEZIER.) { |
| 381 | myShiftcxx . . $ NurbMaker#myShift..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(3,3); |
| 382 | } |
| 383 | else if (patchTypecxx . . $ NurbMaker#patchType. == CUBICcxx . . $ NurbMaker#CUBIC. || patchTypecxx . . $ NurbMaker#patchType. == CUBIC_TO_EDGEcxx . . $ NurbMaker#CUBIC_TO_EDGE.) { |
| 384 | myShiftcxx . . $ NurbMaker#myShift..setValuecxx . . $ SbVec2s#setValue(1b1c29394cccbfa1).(1,1); |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | void |
| 389 | NurbMakercxx . . $ NurbMaker#::applyCubicToEdgeKnotVectorscxx . . $ NurbMaker#applyCubicToEdgeKnotVectors(d34b59135c281c0d).(int row, int col, |
| 390 | SoIndexedNurbsSurfacecxx . . $ SoIndexedNurbsSurface# *myNurb, int lastRowToDo, int lastColToDo) |
| 391 | { |
| 392 | float *uKs, *vKs; |
| 393 | |
| 394 | if ( myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] ) uKs = myUKnotscxx . . $ NurbMaker#myUKnots.; |
| 395 | else if (col == 0 ) uKs = cubic0FromEarlyEdgeKnotscxx . . $ cubic0FromEarlyEdgeKnots.; |
| 396 | else if (col == lastColToDo) uKs = cubic0FromLateEdgeKnotscxx . . $ cubic0FromLateEdgeKnots.; |
| 397 | else if (col == 1 ) uKs = cubic1FromEarlyEdgeKnotscxx . . $ cubic1FromEarlyEdgeKnots.; |
| 398 | else if (col == lastColToDo-1) uKs = cubic1FromLateEdgeKnotscxx . . $ cubic1FromLateEdgeKnots.; |
| 399 | else if (col == 2 ) uKs = cubic2FromEarlyEdgeKnotscxx . . $ cubic2FromEarlyEdgeKnots.; |
| 400 | else if (col == lastColToDo-2) uKs = cubic2FromLateEdgeKnotscxx . . $ cubic2FromLateEdgeKnots.; |
| 401 | else uKs = myUKnotscxx . . $ NurbMaker#myUKnots.; |
| 402 | |
| 403 | if ( myWrapcxx . . $ NurbMaker#myWrap.[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0] ) vKs = myVKnotscxx . . $ NurbMaker#myVKnots.; |
| 404 | else if (row == 0 ) vKs = cubic0FromEarlyEdgeKnotscxx . . $ cubic0FromEarlyEdgeKnots.; |
| 405 | else if (row == lastRowToDo) vKs = cubic0FromLateEdgeKnotscxx . . $ cubic0FromLateEdgeKnots.; |
| 406 | else if (row == 1 ) vKs = cubic1FromEarlyEdgeKnotscxx . . $ cubic1FromEarlyEdgeKnots.; |
| 407 | else if (row == lastRowToDo-1) vKs = cubic1FromLateEdgeKnotscxx . . $ cubic1FromLateEdgeKnots.; |
| 408 | else if (row == 2 ) vKs = cubic2FromEarlyEdgeKnotscxx . . $ cubic2FromEarlyEdgeKnots.; |
| 409 | else if (row == lastRowToDo-2) vKs = cubic2FromLateEdgeKnotscxx . . $ cubic2FromLateEdgeKnots.; |
| 410 | else vKs = myVKnotscxx . . $ NurbMaker#myVKnots.; |
| 411 | |
| 412 | myNurb->uKnotVectorcxx . . $ SoIndexedNurbsSurface#uKnotVector..setValuescxx . . $ SoMFFloat#setValues(269012fc1b4ba7ac).(0,8,uKs); |
| 413 | myNurb->vKnotVectorcxx . . $ SoIndexedNurbsSurface#vKnotVector..setValuescxx . . $ SoMFFloat#setValues(269012fc1b4ba7ac).(0,8,vKs); |
| 414 | |
| 415 | }; |