Main Page   Class List   Class Members  

  • Main Page
  • User's Guide
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

sdk/extensions/authoring/source/NvBlastExtAuthoringBooleanTool.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 #ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
00030 #define NVBLASTEXTAUTHORINGBOOLEANTOOL_H
00031 
00032 #include "NvBlastExtAuthoringTypes.h"
00033 #include "NvBlastExtAuthoringInternalCommon.h"
00034 #include <vector>
00035 #include "NvBlastTypes.h"
00036 
00037 
00038 namespace Nv
00039 {
00040 namespace Blast
00041 {
00042 
00043 class Mesh;
00044 
00048 struct BooleanConf
00049 {
00050     int32_t ca, cb, ci;
00051     BooleanConf(int32_t a, int32_t b, int32_t c) : ca(a), cb(b), ci(c)
00052     {
00053     }
00054 };
00055 
00056 
00057 namespace BooleanConfigurations
00058 {
00062 inline BooleanConf BOOLEAN_INTERSECION()
00063 {
00064     return BooleanConf(0, 0, 1);
00065 }
00066 
00070 inline BooleanConf BOOLEAN_UNION()
00071 {
00072     return BooleanConf(1, 1, -1);
00073 }
00077 inline BooleanConf BOOLEAN_DIFFERENCE()
00078 {
00079     return BooleanConf(1, 0, -1);
00080 }
00081 }
00082 
00086 struct EdgeFacetIntersectionData
00087 {
00088     int32_t edId;
00089     int32_t intersectionType;
00090     Vertex  intersectionPoint;
00091     EdgeFacetIntersectionData(int32_t edId, int32_t intersType, Vertex& inters) : edId(edId), intersectionType(intersType), intersectionPoint(inters)
00092     {   }
00093     EdgeFacetIntersectionData(int32_t edId) : edId(edId)
00094     {   }
00095     bool operator<(const EdgeFacetIntersectionData& b) const
00096     {
00097         return edId < b.edId;
00098     }
00099 };
00100 
00101 
00102 class SpatialAccelerator;
00103 
00108 class BooleanEvaluator
00109 {
00110 
00111 public:
00112     BooleanEvaluator();
00113     ~BooleanEvaluator();
00114 
00123     void    performBoolean(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
00124 
00131     void    performBoolean(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
00132 
00142     void    performFastCutting(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
00143 
00151     void    performFastCutting(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
00152 
00159     int32_t isPointContainedInMesh(const Mesh* mesh, const NvcVec3& point);
00167     int32_t isPointContainedInMesh(const Mesh* mesh, SpatialAccelerator* spAccel, const NvcVec3& point);
00168 
00169 
00174     Mesh*   createNewMesh();
00175 
00179     void    reset();
00180 
00181 private:
00182 
00183     void    buildFaceFaceIntersections(BooleanConf);
00184     void    buildFastFaceFaceIntersection(BooleanConf);
00185     void    collectRetainedPartsFromA(BooleanConf mode);
00186     void    collectRetainedPartsFromB(BooleanConf mode);
00187 
00188     int32_t addIfNotExist(Vertex& p);
00189     void    addEdgeIfValid(EdgeWithParent& ed);
00190 private:
00191 
00192     int32_t vertexMeshStatus03(const NvcVec3& p, const Mesh* mesh);
00193     int32_t vertexMeshStatus30(const NvcVec3& p, const Mesh* mesh);
00194 
00195     const Mesh*                                             mMeshA;
00196     const Mesh*                                             mMeshB;
00197 
00198     SpatialAccelerator*                                     mAcceleratorA;
00199     SpatialAccelerator*                                     mAcceleratorB;
00200 
00201     std::vector<EdgeWithParent>                             mEdgeAggregate;
00202     std::vector<Vertex>                                     mVerticesAggregate;
00203 
00204     std::vector<std::vector<EdgeFacetIntersectionData> >    mEdgeFacetIntersectionData12;
00205     std::vector<std::vector<EdgeFacetIntersectionData> >    mEdgeFacetIntersectionData21;
00206 };
00207 
00208 } // namespace Blast
00209 } // namespace Nv
00210 
00211 
00212 #endif // ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com