Skip to content

Commit

Permalink
improve CSG processing
Browse files Browse the repository at this point in the history
  • Loading branch information
ifcquery committed Nov 11, 2023
1 parent b2a5466 commit 2247452
Show file tree
Hide file tree
Showing 35 changed files with 2,041 additions and 1,142 deletions.
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ ELSE(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(NOT WIN32)

find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

set(IFCPP_CONFIG_DIR "share/IFCPP/cmake")
ADD_SUBDIRECTORY (IfcPlusPlus)

Expand Down
8 changes: 0 additions & 8 deletions IfcPlusPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ endif()

add_library(IfcPlusPlus STATIC ${IFCPP_SOURCE_FILES})

if(OpenMP_CXX_FOUND)
ADD_DEFINITIONS(-DENABLE_OPENMP)
TARGET_LINK_LIBRARIES(IfcPlusPlus
optimized OpenMP::OpenMP_CXX
${VC_LIBS})
endif()


TARGET_INCLUDE_DIRECTORIES(IfcPlusPlus
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
Expand Down
8 changes: 1 addition & 7 deletions IfcPlusPlus/IfcPlusPlus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PreprocessorDefinitions>UNICODE;WIN32;_WINDOWS;NDEBUG;_MBCS;IFCQUERY_AS_DYNAMIC_LIBRARY;IFCQUERY_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
<DebugInformationFormat />
</ClCompile>
<Link>
Expand Down Expand Up @@ -258,13 +257,11 @@
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>true</FloatingPointExceptions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>
</OpenMPSupport>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalOptions>
</AdditionalOptions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DebugInformationFormat>None</DebugInformationFormat>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
Expand Down Expand Up @@ -307,7 +304,6 @@
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>true</FloatingPointExceptions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand All @@ -330,7 +326,6 @@
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>true</FloatingPointExceptions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down Expand Up @@ -426,7 +421,6 @@
<ClInclude Include="src\ifcpp\model\BuildingModel.h" />
<ClInclude Include="src\ifcpp\model\BuildingObject.h" />
<ClInclude Include="src\ifcpp\model\GlobalDefines.h" />
<ClInclude Include="src\ifcpp\model\OpenMPIncludes.h" />
<ClInclude Include="src\ifcpp\model\StatusCallback.h" />
<ClInclude Include="src\ifcpp\model\UnitConverter.h" />
<ClInclude Include="src\ifcpp\model\UnknownEntityException.h" />
Expand Down
3 changes: 0 additions & 3 deletions IfcPlusPlus/IfcPlusPlus.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
<ClInclude Include="src\ifcpp\model\BuildingObject.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="src\ifcpp\model\OpenMPIncludes.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="src\ifcpp\model\BasicTypes.h">
<Filter>Headerdateien</Filter>
</ClInclude>
Expand Down
10 changes: 10 additions & 0 deletions IfcPlusPlus/src/external/Carve/src/include/carve/mesh_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@ carve::geom::vector<ndim> Face<ndim>::computeNormal(double CARVE_EPSILON) {
continue;
}

if (!edgePtr->v1())
{
continue;
}

if (!edgePtr->v2())
{
continue;
}

double length2 = edgePtr->length2();
if (length2 > longestEdgeLength)
{
Expand Down
14 changes: 12 additions & 2 deletions IfcPlusPlus/src/external/Carve/src/include/carve/mesh_simplify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,18 @@ namespace carve {
edge_t* e = removed;
do {
edge_t* n = e->next;
coplanar_face_edges.erase(std::min(e, e->rev));
delete e->rev;
edge_t* erasePtr = std::min(e, e->rev);
auto itFind = coplanar_face_edges.find(erasePtr);
if (itFind != coplanar_face_edges.end())
{
coplanar_face_edges.erase(itFind);
//coplanar_face_edges.erase(erasePtr);
}

if (e->rev != nullptr)
{
delete e->rev;
}
delete e;
e = n;
} while( e != removed );
Expand Down
13 changes: 12 additions & 1 deletion IfcPlusPlus/src/external/Carve/src/lib/intersect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,18 @@ void carve::csg::CSG::_generateEdgeEdgeIntersections(meshset_t::edge_t* ea, mesh
carve::geom::aabb<3> ea_aabb, eb_aabb;
ea_aabb.fit(v1->v, v2->v);
eb_aabb.fit(v3->v, v4->v);
if( ea_aabb.maxAxisSeparation(eb_aabb) > m_epsilon ) {
double extentLength2 = eb_aabb.extent.length2();
double eps2 = m_epsilon * m_epsilon*0.9;
if (extentLength2 < eps2)
{
return;
}
if (ea_aabb.extent.length2() < eps2)
{
return;
}
if( ea_aabb.maxAxisSeparation(eb_aabb) > m_epsilon )
{
return;
}

Expand Down
Loading

0 comments on commit 2247452

Please sign in to comment.