mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Directions as CGAL Vector_3, more robust points
This commit is contained in:
@@ -30,9 +30,22 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid*, cgal_s
|
||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcCartesianPoint* l, cgal_point_t& point) {
|
||||
std::vector<double> xyz = l->Coordinates();
|
||||
if (xyz.size() == 3) {
|
||||
point = new Kernel::Point_3(xyz[0], xyz[1], xyz[2]);
|
||||
point = new Kernel::Point_3(xyz.size() ? (xyz[0]*getValue(GV_LENGTH_UNIT)) : 0.0f,
|
||||
xyz.size() > 1 ? (xyz[1]*getValue(GV_LENGTH_UNIT)) : 0.0f,
|
||||
xyz.size() > 2 ? (xyz[2]*getValue(GV_LENGTH_UNIT)) : 0.0f);
|
||||
return true;
|
||||
} else {
|
||||
throw std::runtime_error("Point without 3 coordinates");
|
||||
}
|
||||
}
|
||||
|
||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcDirection* l, cgal_direction_t& dir) {
|
||||
// IN_CACHE(IfcDirection,l,cgal_direction_t,dir)
|
||||
std::vector<double> xyz = l->DirectionRatios();
|
||||
dir = new Kernel::Vector_3(xyz.size() ? xyz[0] : 0.0f,
|
||||
xyz.size() > 1 ? xyz[1] : 0.0f,
|
||||
xyz.size() > 2 ? xyz[2] : 0.0f);
|
||||
// CACHE(IfcDirection,l,dir)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,3 +43,4 @@ FACE(IfcFace);
|
||||
WIRE(IfcPolyLoop);
|
||||
|
||||
CLASS(IfcCartesianPoint,cgal_point_t);
|
||||
CLASS(IfcDirection,cgal_direction_t);
|
||||
|
||||
@@ -46,6 +46,7 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
|
||||
typedef Kernel::Aff_transformation_3 *cgal_placement_t;
|
||||
typedef Kernel::Point_3 *cgal_point_t;
|
||||
typedef Kernel::Vector_3 *cgal_direction_t;
|
||||
typedef std::vector<Kernel::Point_3> *cgal_curve_t;
|
||||
typedef std::vector<Kernel::Point_3> *cgal_wire_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user