Skip to content

Commit 2247452

Browse files
committedNov 11, 2023
improve CSG processing
1 parent b2a5466 commit 2247452

35 files changed

+2041
-1142
lines changed
 

‎CMakeLists.txt

-7
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ ELSE(NOT WIN32)
3838
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
3939
ENDIF(NOT WIN32)
4040

41-
find_package(OpenMP)
42-
if (OPENMP_FOUND)
43-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
44-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
45-
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
46-
endif()
47-
4841
set(IFCPP_CONFIG_DIR "share/IFCPP/cmake")
4942
ADD_SUBDIRECTORY (IfcPlusPlus)
5043

‎IfcPlusPlus/CMakeLists.txt

-8
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ endif()
7777

7878
add_library(IfcPlusPlus STATIC ${IFCPP_SOURCE_FILES})
7979

80-
if(OpenMP_CXX_FOUND)
81-
ADD_DEFINITIONS(-DENABLE_OPENMP)
82-
TARGET_LINK_LIBRARIES(IfcPlusPlus
83-
optimized OpenMP::OpenMP_CXX
84-
${VC_LIBS})
85-
endif()
86-
87-
8880
TARGET_INCLUDE_DIRECTORIES(IfcPlusPlus
8981
PRIVATE
9082
${CMAKE_CURRENT_SOURCE_DIR}/src

‎IfcPlusPlus/IfcPlusPlus.vcxproj

+1-7
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@
211211
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
212212
<PreprocessorDefinitions>UNICODE;WIN32;_WINDOWS;NDEBUG;_MBCS;IFCQUERY_AS_DYNAMIC_LIBRARY;IFCQUERY_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
213213
<RuntimeTypeInfo>true</RuntimeTypeInfo>
214-
<OpenMPSupport>true</OpenMPSupport>
215214
<DebugInformationFormat />
216215
</ClCompile>
217216
<Link>
@@ -258,13 +257,11 @@
258257
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
259258
<FloatingPointExceptions>true</FloatingPointExceptions>
260259
<RuntimeTypeInfo>true</RuntimeTypeInfo>
261-
<OpenMPSupport>
262-
</OpenMPSupport>
263260
<WholeProgramOptimization>true</WholeProgramOptimization>
264261
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
265262
<AdditionalOptions>
266263
</AdditionalOptions>
267-
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
264+
<DebugInformationFormat>None</DebugInformationFormat>
268265
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
269266
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
270267
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
@@ -307,7 +304,6 @@
307304
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
308305
<FloatingPointExceptions>true</FloatingPointExceptions>
309306
<RuntimeTypeInfo>true</RuntimeTypeInfo>
310-
<OpenMPSupport>true</OpenMPSupport>
311307
</ClCompile>
312308
<Link>
313309
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -330,7 +326,6 @@
330326
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
331327
<FloatingPointExceptions>true</FloatingPointExceptions>
332328
<RuntimeTypeInfo>true</RuntimeTypeInfo>
333-
<OpenMPSupport>true</OpenMPSupport>
334329
</ClCompile>
335330
<Link>
336331
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -426,7 +421,6 @@
426421
<ClInclude Include="src\ifcpp\model\BuildingModel.h" />
427422
<ClInclude Include="src\ifcpp\model\BuildingObject.h" />
428423
<ClInclude Include="src\ifcpp\model\GlobalDefines.h" />
429-
<ClInclude Include="src\ifcpp\model\OpenMPIncludes.h" />
430424
<ClInclude Include="src\ifcpp\model\StatusCallback.h" />
431425
<ClInclude Include="src\ifcpp\model\UnitConverter.h" />
432426
<ClInclude Include="src\ifcpp\model\UnknownEntityException.h" />

‎IfcPlusPlus/IfcPlusPlus.vcxproj.filters

-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@
126126
<ClInclude Include="src\ifcpp\model\BuildingObject.h">
127127
<Filter>Headerdateien</Filter>
128128
</ClInclude>
129-
<ClInclude Include="src\ifcpp\model\OpenMPIncludes.h">
130-
<Filter>Headerdateien</Filter>
131-
</ClInclude>
132129
<ClInclude Include="src\ifcpp\model\BasicTypes.h">
133130
<Filter>Headerdateien</Filter>
134131
</ClInclude>

‎IfcPlusPlus/src/external/Carve/src/include/carve/mesh_impl.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ carve::geom::vector<ndim> Face<ndim>::computeNormal(double CARVE_EPSILON) {
341341
continue;
342342
}
343343

344+
if (!edgePtr->v1())
345+
{
346+
continue;
347+
}
348+
349+
if (!edgePtr->v2())
350+
{
351+
continue;
352+
}
353+
344354
double length2 = edgePtr->length2();
345355
if (length2 > longestEdgeLength)
346356
{

‎IfcPlusPlus/src/external/Carve/src/include/carve/mesh_simplify.hpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,18 @@ namespace carve {
911911
edge_t* e = removed;
912912
do {
913913
edge_t* n = e->next;
914-
coplanar_face_edges.erase(std::min(e, e->rev));
915-
delete e->rev;
914+
edge_t* erasePtr = std::min(e, e->rev);
915+
auto itFind = coplanar_face_edges.find(erasePtr);
916+
if (itFind != coplanar_face_edges.end())
917+
{
918+
coplanar_face_edges.erase(itFind);
919+
//coplanar_face_edges.erase(erasePtr);
920+
}
921+
922+
if (e->rev != nullptr)
923+
{
924+
delete e->rev;
925+
}
916926
delete e;
917927
e = n;
918928
} while( e != removed );

‎IfcPlusPlus/src/external/Carve/src/lib/intersect.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,18 @@ void carve::csg::CSG::_generateEdgeEdgeIntersections(meshset_t::edge_t* ea, mesh
721721
carve::geom::aabb<3> ea_aabb, eb_aabb;
722722
ea_aabb.fit(v1->v, v2->v);
723723
eb_aabb.fit(v3->v, v4->v);
724-
if( ea_aabb.maxAxisSeparation(eb_aabb) > m_epsilon ) {
724+
double extentLength2 = eb_aabb.extent.length2();
725+
double eps2 = m_epsilon * m_epsilon*0.9;
726+
if (extentLength2 < eps2)
727+
{
728+
return;
729+
}
730+
if (ea_aabb.extent.length2() < eps2)
731+
{
732+
return;
733+
}
734+
if( ea_aabb.maxAxisSeparation(eb_aabb) > m_epsilon )
735+
{
725736
return;
726737
}
727738

0 commit comments

Comments
 (0)