mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 16:22:53 +00:00
Major update: taxonomy shared pointers, collection type safety, work towards hashing
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::item* mapping::map_impl(const IfcSchema::IfcEllipse* inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse* inst) {
|
||||
double x = inst->SemiAxis1() * length_unit_;
|
||||
double y = inst->SemiAxis2() * length_unit_;
|
||||
const double tol = conv_settings_.getValue(ConversionSettings::GV_PRECISION);
|
||||
@@ -30,19 +30,21 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcEllipse* inst) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto el = new taxonomy::ellipse;
|
||||
el->matrix = as<taxonomy::matrix4>(map(inst->Position()));
|
||||
auto el = taxonomy::make<taxonomy::ellipse>();
|
||||
el->matrix = taxonomy::cast<taxonomy::matrix4>(map(inst->Position()));
|
||||
|
||||
// Open Cascade does not allow ellipses of which the minor radius
|
||||
// is greater than the major radius. Hence, in this case, the
|
||||
// ellipse is rotated. Note that special care is taken
|
||||
// when creating a trimmed curve off of an ellipse like this.
|
||||
if (y > x) {
|
||||
el->matrix.components() <<
|
||||
-el->matrix.ccomponents().col(1),
|
||||
el->matrix.ccomponents().col(0),
|
||||
el->matrix.ccomponents().col(2),
|
||||
el->matrix.ccomponents().col(3);
|
||||
// @todo is a copy necesary here or can this be done in place?
|
||||
auto m4_copy = *el->matrix;
|
||||
el->matrix->components() <<
|
||||
-m4_copy.components().col(1),
|
||||
m4_copy.components().col(0),
|
||||
m4_copy.components().col(2),
|
||||
m4_copy.components().col(3);
|
||||
std::swap(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user