MeVisLab Toolbox Reference
WEMSetOp.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
17 
18 ML_START_NAMESPACE
19 
21 
22 const unsigned int WEMSETOP_OUTPUT_FIRST = 0;
23 const unsigned int WEMSETOP_OUTPUT_SECOND = 1;
24 const unsigned int WEMSETOP_OUTPUT_BOTH = 2;
25 
27 
28 const unsigned int WEMSETOP_BOOLEAN_UNION = 0;
29 const unsigned int WEMSETOP_BOOLEAN_INTERSECTION = 1;
30 const unsigned int WEMSETOP_BOOLEAN_DIFFERENCE = 2;
31 
33 
34 const unsigned int WEMSETOP_OUTER_FLAG = 1;
35 const unsigned int WEMSETOP_INTERSECTING_FLAG = 5;
36 
38 
40 namespace WEMSetOp
41 {
43  enum Axis
44  {
45  xAxis = 0,
47  zAxis
48  };
49 
52  WEMTrianglePatch* inPatch2,
53  WEMTrianglePatch* outPatch,
54  unsigned int outputMode,
55  TriangulationModes triangulationMode,
56  WEMVector<WEMCut>* cuts=nullptr);
57 
60  WEMTrianglePatch* inPatch2,
61  WEMTrianglePatch* outPatch,
62  unsigned int outputMode,
63  TriangulationModes triangulationMode,
64  WEMVector<WEMCut>* cuts=nullptr);
65 
68  WEMTrianglePatch* inPatch2,
69  WEMTrianglePatch* outPatch,
70  unsigned int outputMode,
71  TriangulationModes triangulationMode,
72  WEMVector<WEMCut>* cuts=nullptr);
73 
74  // Not exporting the methods below to simulate their former private state
75 
77  void _boolOp(WEMTrianglePatch* inPatch1,
78  WEMTrianglePatch* inPatch2,
79  WEMTrianglePatch* outPatch,
80  unsigned int boolOpMode,
81  unsigned int outputMode,
82  TriangulationModes triangulationMode,
83  WEMVector<WEMCut>* cuts);
84 
89 
92  WEMVector<WEMFaceCut> **faceCutTable,
93  WEMTrianglePatch* rayPatch,
94  WEMVector<WEMFace> *outerFaces=nullptr,
95  WEMVector<WEMFace> *innerFaces=nullptr);
96 
98  Axis _getMinimalOverlapAxisOfBoundingBoxes(const Vector3& min1, const Vector3& min2, const Vector3& max1, const Vector3& max2);
99 
102 
105  WEMTrianglePatch* inPatch2,
106  WEMTrianglePatch* outPatch,
107  unsigned int boolOpMode,
108  unsigned int outputMode);
109 
111  bool _areWEMBoundingBoxesIntersecting(WEMPatch* wemPatch1, WEMPatch* wemPatch2);
112 
114  void _removeNonValidCuts(WEMVector<WEMFace>* intersectedFaces, WEMVector<WEMFaceCut>** faceCuts);
122 };
123 
125 
126 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
A class to administrate an axis coordinate system drawable in OpenGL.
Definition: Axis.h:22
Defines the mesh component: node.
Definition: WEMNode.h:33
Base class for triangle and quad patches.
Definition: WEMPatch.h:48
This represents a WEMPatch consisting of triangles only.
Dynamic templated vector.
Definition: WEMVector.h:28
void _performTrivialBoolOp(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int boolOpMode, unsigned int outputMode)
If the bounding boxes of the input WEMs do not intersect, perform a trivial Boolean operation.
WEMVector< WEMFaceCut > ** _setupFaceCuts(WEMTrianglePatch *inPatch, WEMVector< WEMFace > *intersectedFaces, WEMVector< WEMPartialFaceCut > **partialFaceCuts)
Sets up the face cut vector.
void _removeNonValidCuts(WEMVector< WEMFace > *intersectedFaces, WEMVector< WEMFaceCut > **faceCuts)
Removes all non-valid face cuts from the common face cuts vector.
void _boolOp(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int boolOpMode, unsigned int outputMode, TriangulationModes triangulationMode, WEMVector< WEMCut > *cuts)
Performs a boolean operation (union, intersection, difference) on given patches.
Axis _getMinimalOverlapAxisOfBoundingBoxes(const Vector3 &min1, const Vector3 &min2, const Vector3 &max1, const Vector3 &max2)
Returns the minimal overlap axis of the given bounding boxes.
void _classifyIntersectionAndOutsideFaces(WEMTrianglePatch *inPatch1, WEMVector< WEMFace > *intersectedFaces)
Checks all faces; if a face if fully outside, it is just marked, else it is also added to the given i...
void _resetOuterAndIntersectingFlags(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2)
Resets the status flags of nodes and faces.
void _updateClassification(WEMTrianglePatch *triPatch, WEMVector< WEMFaceCut > **faceCutTable, WEMTrianglePatch *rayPatch, WEMVector< WEMFace > *outerFaces=nullptr, WEMVector< WEMFace > *innerFaces=nullptr)
Updates classification of nodes and faces based on face cuts.
bool _areWEMBoundingBoxesIntersecting(WEMPatch *wemPatch1, WEMPatch *wemPatch2)
Returns whether the bounding boxes of the given WEMs are intersecting.
MLWEM_EXPORT void difference(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int outputMode, TriangulationModes triangulationMode, WEMVector< WEMCut > *cuts=nullptr)
Returns the difference of the given patches.
void _addFacesToOutputPatch(WEMVector< WEMFace > *faces, WEMNode **nodeTable, WEMTrianglePatch *outPatch)
Adds the given faces to the output patch.
MLWEM_EXPORT void intersect(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int outputMode, TriangulationModes triangulationMode, WEMVector< WEMCut > *cuts=nullptr)
Returns the intersection of the given patches.
bool _intersectBoundingBoxes(WEMTrianglePatch *triPatch1, WEMTrianglePatch *triPatch2)
Intersects bounding boxes of given patches.
MLWEM_EXPORT void unify(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int outputMode, TriangulationModes triangulationMode, WEMVector< WEMCut > *cuts=nullptr)
Returns the union of the given patches.
const unsigned int WEMSETOP_BOOLEAN_DIFFERENCE
Set operation: difference.
Definition: WEMSetOp.h:30
const unsigned int WEMSETOP_OUTPUT_SECOND
Output mode: second patch only.
Definition: WEMSetOp.h:23
const unsigned int WEMSETOP_OUTPUT_BOTH
Output mode: both patches.
Definition: WEMSetOp.h:24
const unsigned int WEMSETOP_INTERSECTING_FLAG
Definition: WEMSetOp.h:35
TriangulationModes
Enumeration of the triangulation modes. Note that these are 'mirrored' in the SoWEM part.
const unsigned int WEMSETOP_OUTER_FLAG
Definition: WEMSetOp.h:34
const unsigned int WEMSETOP_BOOLEAN_UNION
Set operation: union.
Definition: WEMSetOp.h:28
const unsigned int WEMSETOP_BOOLEAN_INTERSECTION
Set operation: intersection.
Definition: WEMSetOp.h:29
const unsigned int WEMSETOP_OUTPUT_FIRST
Output mode: first patch only.
Definition: WEMSetOp.h:22