Main Page Class List Class Members

NvBlastExtAuthoringBooleanTool.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27
28
29 #ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
30 #define NVBLASTEXTAUTHORINGBOOLEANTOOL_H
31
32 #include "NvBlastExtAuthoringTypes.h"
33 #include "NvBlastExtAuthoringInternalCommon.h"
34 #include <vector>
35 #include "NvBlastTypes.h"
36
37
38 namespace Nv
39 {
40 namespace Blast
41 {
42
43 class Mesh;
44
48 struct BooleanConf
49 {
50 int32_t ca, cb, ci;
51 BooleanConf(int32_t a, int32_t b, int32_t c) : ca(a), cb(b), ci(c)
52 {
53 }
54 };
55
56
57 namespace BooleanConfigurations
58 {
62 inline BooleanConf BOOLEAN_INTERSECION()
63 {
64 return BooleanConf(0, 0, 1);
65 }
66
70 inline BooleanConf BOOLEAN_UNION()
71 {
72 return BooleanConf(1, 1, -1);
73 }
77 inline BooleanConf BOOLEAN_DIFFERENCE()
78 {
79 return BooleanConf(1, 0, -1);
80 }
81 }
82
86 struct EdgeFacetIntersectionData
87 {
88 int32_t edId;
89 int32_t intersectionType;
90 Vertex intersectionPoint;
91 EdgeFacetIntersectionData(int32_t edId, int32_t intersType, Vertex& inters) : edId(edId), intersectionType(intersType), intersectionPoint(inters)
92 { }
93 EdgeFacetIntersectionData(int32_t edId) : edId(edId)
94 { }
95 bool operator<(const EdgeFacetIntersectionData& b) const
96 {
97 return edId < b.edId;
98 }
99 };
100
101
102 class SpatialAccelerator;
103
108 class BooleanEvaluator
109 {
110
111 public:
112 BooleanEvaluator();
113 ~BooleanEvaluator();
114
123 void performBoolean(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
124
131 void performBoolean(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
132
142 void performFastCutting(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
143
151 void performFastCutting(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
152
159 int32_t isPointContainedInMesh(const Mesh* mesh, const NvcVec3& point);
167 int32_t isPointContainedInMesh(const Mesh* mesh, SpatialAccelerator* spAccel, const NvcVec3& point);
168
169
174 Mesh* createNewMesh();
175
179 void reset();
180
181 private:
182
183 void buildFaceFaceIntersections(BooleanConf);
184 void buildFastFaceFaceIntersection(BooleanConf);
185 void collectRetainedPartsFromA(BooleanConf mode);
186 void collectRetainedPartsFromB(BooleanConf mode);
187
188 int32_t addIfNotExist(Vertex& p);
189 void addEdgeIfValid(EdgeWithParent& ed);
190 private:
191
192 int32_t vertexMeshStatus03(const NvcVec3& p, const Mesh* mesh);
193 int32_t vertexMeshStatus30(const NvcVec3& p, const Mesh* mesh);
194
195 const Mesh* mMeshA;
196 const Mesh* mMeshB;
197
198 SpatialAccelerator* mAcceleratorA;
199 SpatialAccelerator* mAcceleratorB;
200
201 std::vector<EdgeWithParent> mEdgeAggregate;
202 std::vector<Vertex> mVerticesAggregate;
203
204 std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData12;
205 std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData21;
206 };
207
208 } // namespace Blast
209 } // namespace Nv
210
211
212 #endif // ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
Nv::Blast::EdgeFacetIntersectionData::intersectionPoint
Vertex intersectionPoint
Definition: NvBlastExtAuthoringBooleanTool.h:90
Nv::Blast::BooleanEvaluator
Definition: NvBlastExtAuthoringBooleanTool.h:108
NvBlastTypes.h
Nv::Blast::EdgeWithParent
Definition: NvBlastExtAuthoringInternalCommon.h:48
NvBlastExtAuthoringTypes.h
Nv::Blast::EdgeFacetIntersectionData::EdgeFacetIntersectionData
EdgeFacetIntersectionData(int32_t edId)
Definition: NvBlastExtAuthoringBooleanTool.h:93
Nv::Blast::SpatialAccelerator
Definition: NvBlastExtAuthoringAccelerator.h:47
Nv::Blast::BooleanConf::ca
int32_t ca
Definition: NvBlastExtAuthoringBooleanTool.h:50
Nv::Blast::Mesh
Definition: NvBlastExtAuthoringMesh.h:42
Nv::Blast::EdgeFacetIntersectionData::EdgeFacetIntersectionData
EdgeFacetIntersectionData(int32_t edId, int32_t intersType, Vertex &inters)
Definition: NvBlastExtAuthoringBooleanTool.h:91
Nv::Blast::BooleanConf::ci
int32_t ci
Definition: NvBlastExtAuthoringBooleanTool.h:50
Nv::Blast::EdgeFacetIntersectionData::edId
int32_t edId
Definition: NvBlastExtAuthoringBooleanTool.h:88
Nv::Blast::BooleanConfigurations::BOOLEAN_INTERSECION
BooleanConf BOOLEAN_INTERSECION()
Definition: NvBlastExtAuthoringBooleanTool.h:62
Nv::Blast::BooleanConfigurations::BOOLEAN_UNION
BooleanConf BOOLEAN_UNION()
Definition: NvBlastExtAuthoringBooleanTool.h:70
NvBlastExtAuthoringInternalCommon.h
Nv::Blast::BooleanConf
Definition: NvBlastExtAuthoringBooleanTool.h:48
Nv::Blast::EdgeFacetIntersectionData::operator<
bool operator<(const EdgeFacetIntersectionData &b) const
Definition: NvBlastExtAuthoringBooleanTool.h:95
Nv::Blast::BooleanConfigurations::BOOLEAN_DIFFERENCE
BooleanConf BOOLEAN_DIFFERENCE()
Definition: NvBlastExtAuthoringBooleanTool.h:77
Nv::Blast::EdgeFacetIntersectionData
Definition: NvBlastExtAuthoringBooleanTool.h:86
Nv::Blast::BooleanConf::BooleanConf
BooleanConf(int32_t a, int32_t b, int32_t c)
Definition: NvBlastExtAuthoringBooleanTool.h:51
Nv::Blast::Vertex
Definition: NvBlastExtAuthoringTypes.h:67
Nv::Blast::BooleanConf::cb
int32_t cb
Definition: NvBlastExtAuthoringBooleanTool.h:50
Nv
Definition: NvBlastArray.h:37
NvcVec3
Definition: NvCTypes.h:49
Nv::Blast::EdgeFacetIntersectionData::intersectionType
int32_t intersectionType
Definition: NvBlastExtAuthoringBooleanTool.h:89