Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoSplitGeometryAction.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Jerome Hummel (Nov 2001)
22**=======================================================================*/
23
24#ifndef _SO_SPLIT_GEOMETRY_ACTION_H
25#define _SO_SPLIT_GEOMETRY_ACTION_H
26
30
32
40typedef void SoSplitGeometryActionCB(const SoSplitGeometryAction* action, SoNode* objectToSplit, const int objectId,
41 int divAlongX,int divAlongY,int divAlongZ, void* userData);
42
43
80{
82
83 public :
84
93 SoSplitGeometryAction(int divAlongX,int divAlongY);
94
104 SoSplitGeometryAction(int divAlongX,int divAlongY, int divAlongZ);
105
114 void setNumDivisions(int numX, int numY);
115
124 void setNumDivisions(int numX, int numY, int numZ);
125
129 void getNumDivisions(int &numX, int &numY);
130
134 void getNumDivisions(int &numX, int &numY, int &numZ);
135
136
137 //destructor
138#ifndef HIDDEN_FROM_DOC
139 virtual ~SoSplitGeometryAction();
140#endif // HIDDEN_FROM_DOC
141
148
153
154
159 int getNumObjFound(void);
160
174
179
189
200
211
216
229
240
245
246 virtual void apply(SoNode *node);
247 virtual void apply(SoPath *path) { SoAction::apply(path); }; // no warning
248 virtual void apply(const SoPathList &path_list,
249 SbBool obeys_rules = FALSE) {
250 SoAction::apply(path_list, obeys_rules); }; // no warning
251
252 private:
253 static void initClass();
254 static void exitClass();
255
256 private:
257 virtual void beginTraversal(SoNode *node);
258 void increaseCurrentNumOfDiv(void);
259 void resetCurrentNumOfDiv(void);
260 int getCurrentNumOfDiv(void);
261 SbBool isDivisionValueGood(SoIndexedShape*,float,int,float,int&);
262 static void sortAxesAndDivValues(SoSplitGeometryAction*, int &, int&, int&, int&, int&, int&);
263 void commonConstructor(void);
264 int getNumberOfDivisions(void);
265
266
267 private:
268 //private constructor to not use it!
270
271 static void splitStrip(SoAction*, SoNode*);
272 static void splitFace(SoAction*, SoNode*);
273 static void callDoAction(SoAction*, SoNode*);
274 static void nullAction(SoAction*, SoNode*);
275 static void beginSwitchTraversal(SoAction*, SoNode*);
276
277 void splitStrip1Dimension(SoNode* node,int div, int axe,float &lastRed,float &lastGreen, float &lastBlue);
278 void splitFace1Dimension(SoNode* node,int div, int axe,float &lastRed,float &lastGreen, float &lastBlue);
279
280 void replaceNode(SoNode* substitute);
281
282 SbBool areEqual(float, float);
283
284 //number of subdivision
285 int numDivX;
286 int numDivY;
287 int numDivZ;
288
289 //this node contains the result of the action.
290 SoNode* result;
291
292 //This boolean tells us if the user wants to add some materials for the different parts.
293 SbBool enableMaterial;
294
295 //current number of subdivision in the set the action is splitting.
296 int currentNumOfDiv;
297
298 //number of objects found during the traversal of the action.
299 int numObjFound;
300
301 //the user wants to keep the initial geometry or not.
302 SbBool keepMyGeometry;
303
304 //boolean for veretxOrdering
305 SbBool keepVertexOrdering;
306
307 //pre callback for user
308 static SoSplitGeometryActionCB *userCB;
309 static void *userData;
310
311 //boolean for a smart division
312 SbBool smartDivision;
313
314 //for the switch node
315 int whoHasToBeTraversed;
316
317 //split in 3d or not depending on the constructor used.
318 SbBool splitIn3D;
319
320 //to compare 2 floating values.
321 float epsilon;
322
323 //turn error on/off :
324 SbBool errorOn;
325};
326
327#endif
328
329
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)
void SoSplitGeometryActionCB(const SoSplitGeometryAction *action, SoNode *objectToSplit, const int objectId, int divAlongX, int divAlongY, int divAlongZ, void *userData)
User pre-split callback.
#define SO_ACTION_HEADER(className)
Definition SoSubAction.h:69
Abstract base class for all actions.
Definition SoAction.h:132
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
Abstract base class for all indexed vertex-based shapes.
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Maintains a list of pointers to paths.
Definition SoPathList.h:81
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Split large geom...
void setMaintainVertexOrdering(SbBool enable)
If the initial geometry is composed of SoIndexedTriangleStripSet and uses an SoShapeHints with a know...
int getNumObjFound(void)
Returns how many objects the action has split.
void setMaximumDivisionWarning(SbBool enable)
There is a maximum number of division to divide an object because this object is composed by some pri...
void setNumDivisions(int numX, int numY)
Specifies the number of divisions for splitting an object in 2D.
void getNumDivisions(int &numX, int &numY)
Returns the current division values to split an object in 2D.
SbBool isSmartSplitting(void)
Returns TRUE if smart splitting is enabled.
int isTraverseAllSoSwitchChildren(void)
Returns TRUE if traverse all SoSwitch children is enabled.
SbBool isMaintainVertexOrdering(void)
Returns TRUE if the option to maintain initial vertex ordering is on.
SoSplitGeometryAction(int divAlongX, int divAlongY)
SbBool isDistinguishSplitParts(void)
Returns TRUE if distinguish split parts is enabled.
SbBool isKeepOriginalGeometry(void)
Returns TRUE if keep original geometry is enabled.
void setKeepOriginalGeometry(SbBool enable)
By default, the action modifies the scene graph by replacing the original node it has split with a ne...
static void setSplitGeometryActionPreCB(SoSplitGeometryActionCB *, void *)
These add a callback function to call when a node of the given type is encountered during traversal.
void setDistinguishSplitParts(SbBool enable)
Calling this method before applying the action allows you to see how the action has split the objects...
void setTraverseAllSoSwitchChildren(SbBool enable)
By default the action will only traverse the active child of SoSwitch nodes.
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
virtual void apply(const SoPathList &path_list, SbBool obeys_rules=FALSE)
Initiates an action on the graph defined by a list of paths.
void setSmartSplitting(SbBool enable)
If this option is set before the action is applied, objects will be split by dividing the greatest bo...
virtual void apply(SoPath *path)
Initiates an action on the graph defined by a path.
SoSplitGeometryAction(int divAlongX, int divAlongY, int divAlongZ)
void setNumDivisions(int numX, int numY, int numZ)
Specifies the number of divisions for splitting an object in 3D.
void getNumDivisions(int &numX, int &numY, int &numZ)
Returns the current division values to split an object in 3D.
int SbBool
Boolean type.
Definition SbBase.h:87