mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 19:49:58 +00:00
Merge pull request #1 from aothms/cgal
Merging back Thomas' latest changes
This commit is contained in:
+15
-7
@@ -220,15 +220,23 @@ ENDIF()
|
|||||||
FIND_LIBRARY(libCGAL NAMES CGAL PATHS ${CGAL_LIBRARY_DIR} NO_DEFAULT_PATH)
|
FIND_LIBRARY(libCGAL NAMES CGAL PATHS ${CGAL_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
IF(libCGAL)
|
IF(libCGAL)
|
||||||
MESSAGE(STATUS "CGAL library files found")
|
MESSAGE(STATUS "CGAL library files found")
|
||||||
|
foreach(lib ${CGAL_LIBRARY_NAMES})
|
||||||
|
string(REPLACE libCGAL "${lib}" lib_path "${libCGAL}")
|
||||||
|
list(APPEND CGAL_LIBRARIES "${lib_path}")
|
||||||
|
endforeach()
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Unable to find CGAL library files, aborting")
|
FILE(GLOB CGAL_LIBRARIES ${CGAL_LIBRARY_DIR}/CGAL*.lib)
|
||||||
|
LIST(LENGTH CGAL_LIBRARY_NAMES num_cgal_library_names)
|
||||||
|
LIST(LENGTH CGAL_LIBRARIES num_cgal_libraries)
|
||||||
|
LINK_DIRECTORIES("${CGAL_LIBRARY_DIR}")
|
||||||
|
if(NOT "${num_cgal_library_names}" STREQUAL "${num_cgal_library_names}")
|
||||||
|
MESSAGE(FATAL_ERROR "Unable to find CGAL library files, aborting")
|
||||||
|
endif()
|
||||||
|
MESSAGE(STATUS "CGAL library files found")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
foreach(lib ${CGAL_LIBRARY_NAMES})
|
# TODO: Remove hardcoded version numbers for windows
|
||||||
string(REPLACE libCGAL "${lib}" lib_path "${libCGAL}")
|
FIND_LIBRARY(libGMP NAMES gmp "libgmp-10" PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
list(APPEND CGAL_LIBRARIES "${lib_path}")
|
FIND_LIBRARY(libMPFR NAMES mpfr "libmpfr-4" PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
endforeach()
|
|
||||||
FIND_LIBRARY(libGMP NAMES gmp PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
||||||
FIND_LIBRARY(libMPFR NAMES mpfr PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
||||||
IF(NOT libGMP)
|
IF(NOT libGMP)
|
||||||
MESSAGE(FATAL_ERROR "Unable to find GMP library files, aborting")
|
MESSAGE(FATAL_ERROR "Unable to find GMP library files, aborting")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ SHAPE(IfcSphere);
|
|||||||
SHAPE(IfcRectangularPyramid);
|
SHAPE(IfcRectangularPyramid);
|
||||||
SHAPE(IfcRightCircularCylinder);
|
SHAPE(IfcRightCircularCylinder);
|
||||||
SHAPE(IfcRightCircularCone);
|
SHAPE(IfcRightCircularCone);
|
||||||
|
#ifdef USE_IFC4
|
||||||
SHAPE(IfcTriangulatedFaceSet);
|
SHAPE(IfcTriangulatedFaceSet);
|
||||||
|
#endif
|
||||||
SHAPE(IfcHalfSpaceSolid);
|
SHAPE(IfcHalfSpaceSolid);
|
||||||
|
|
||||||
FACE(IfcArbitraryClosedProfileDef);
|
FACE(IfcArbitraryClosedProfileDef);
|
||||||
|
|||||||
@@ -191,6 +191,10 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid *l, cgal
|
|||||||
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
|
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
|
||||||
} CGAL_postcondition(polyhedron.is_valid() && polyhedron.is_closed());
|
} CGAL_postcondition(polyhedron.is_valid() && polyhedron.is_closed());
|
||||||
// std::cout << "After: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl;
|
// std::cout << "After: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl;
|
||||||
|
|
||||||
|
for (auto &vertex : vertices(polyhedron)) {
|
||||||
|
vertex->point() = vertex->point().transform(trsf);
|
||||||
|
}
|
||||||
|
|
||||||
shape = CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
|
shape = CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
|
||||||
|
|
||||||
@@ -241,6 +245,10 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid *l, cgal
|
|||||||
fresult << hole_polyhedron << std::endl;
|
fresult << hole_polyhedron << std::endl;
|
||||||
fresult.close();
|
fresult.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto &vertex : vertices(hole_polyhedron)) {
|
||||||
|
vertex->point() = vertex->point().transform(trsf);
|
||||||
|
}
|
||||||
|
|
||||||
if (!CGAL::Polygon_mesh_processing::is_outward_oriented(hole_polyhedron)) {
|
if (!CGAL::Polygon_mesh_processing::is_outward_oriented(hole_polyhedron)) {
|
||||||
CGAL::Polygon_mesh_processing::reverse_face_orientations(hole_polyhedron);
|
CGAL::Polygon_mesh_processing::reverse_face_orientations(hole_polyhedron);
|
||||||
@@ -876,6 +884,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcRightCircularCone* l, cgal
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_IFC4
|
||||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcTriangulatedFaceSet* l, cgal_shape_t& shape) {
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcTriangulatedFaceSet* l, cgal_shape_t& shape) {
|
||||||
IfcSchema::IfcCartesianPointList3D* point_list = l->Coordinates();
|
IfcSchema::IfcCartesianPointList3D* point_list = l->Coordinates();
|
||||||
const std::vector< std::vector<double> > coordinates = point_list->CoordList();
|
const std::vector< std::vector<double> > coordinates = point_list->CoordList();
|
||||||
@@ -937,6 +946,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcTriangulatedFaceSet* l, cg
|
|||||||
shape = CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
|
shape = CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcHalfSpaceSolid* l, cgal_shape_t& shape) {
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcHalfSpaceSolid* l, cgal_shape_t& shape) {
|
||||||
IfcSchema::IfcSurface* surface = l->BaseSurface();
|
IfcSchema::IfcSurface* surface = l->BaseSurface();
|
||||||
|
|||||||
@@ -11,7 +11,10 @@
|
|||||||
void IfcGeom::OpenCascadeShape::Triangulate(const IfcGeom::IteratorSettings& settings, const IfcGeom::ConversionResultPlacement* place, IfcGeom::Representation::Triangulation<double>* t, int surface_style_id) const {
|
void IfcGeom::OpenCascadeShape::Triangulate(const IfcGeom::IteratorSettings& settings, const IfcGeom::ConversionResultPlacement* place, IfcGeom::Representation::Triangulation<double>* t, int surface_style_id) const {
|
||||||
|
|
||||||
const TopoDS_Shape& s = shape_;
|
const TopoDS_Shape& s = shape_;
|
||||||
const gp_GTrsf& trsf = dynamic_cast<const OpenCascadePlacement*>(place)->trsf();
|
gp_GTrsf trsf;
|
||||||
|
if (place) {
|
||||||
|
trsf = dynamic_cast<const OpenCascadePlacement*>(place)->trsf();
|
||||||
|
}
|
||||||
|
|
||||||
// Triangulate the shape
|
// Triangulate the shape
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user