Auto mem mngt in conversion result number types; more arithmetic on OpaqueCoordinate

This commit is contained in:
Thomas Krijnen
2026-06-22 10:38:25 +02:00
parent 312be203c9
commit 4f21bd1c69
8 changed files with 477 additions and 302 deletions
@@ -385,28 +385,28 @@ int ifcopenshell::geometry::OpenCascadeShape::num_faces() const
return IfcGeom::util::count(shape_, TopAbs_FACE);
}
OpaqueNumber* ifcopenshell::geometry::OpenCascadeShape::OpenCascadeShape::length()
OpaqueNumber ifcopenshell::geometry::OpenCascadeShape::OpenCascadeShape::length()
{
GProp_GProps prop;
BRepGProp::LinearProperties(shape_, prop);
double l = prop.Mass();
return new NumberNativeDouble(l);
return NumberNativeDouble(l);
}
OpaqueNumber* ifcopenshell::geometry::OpenCascadeShape::area()
OpaqueNumber ifcopenshell::geometry::OpenCascadeShape::area()
{
GProp_GProps prop;
BRepGProp::SurfaceProperties(shape_, prop);
double l = prop.Mass();
return new NumberNativeDouble(l);
return NumberNativeDouble(l);
}
OpaqueNumber* ifcopenshell::geometry::OpenCascadeShape::volume()
OpaqueNumber ifcopenshell::geometry::OpenCascadeShape::volume()
{
GProp_GProps prop;
BRepGProp::VolumeProperties(shape_, prop);
double l = prop.Mass();
return new NumberNativeDouble(l);
return NumberNativeDouble(l);
}
#include <Geom_Plane.hxx>
@@ -419,9 +419,9 @@ OpaqueCoordinate<3> ifcopenshell::geometry::OpenCascadeShape::position()
if (plane) {
auto loc = plane->Location();
return OpaqueCoordinate<3>(
new NumberNativeDouble(loc.X()),
new NumberNativeDouble(loc.Y()),
new NumberNativeDouble(loc.Z())
NumberNativeDouble(loc.X()),
NumberNativeDouble(loc.Y()),
NumberNativeDouble(loc.Z())
);
}
}
@@ -436,9 +436,9 @@ OpaqueCoordinate<3> ifcopenshell::geometry::OpenCascadeShape::axis()
if (plane) {
auto dir = plane->Axis().Direction();
return OpaqueCoordinate<3>(
new NumberNativeDouble(dir.X()),
new NumberNativeDouble(dir.Y()),
new NumberNativeDouble(dir.Z())
NumberNativeDouble(dir.X()),
NumberNativeDouble(dir.Y()),
NumberNativeDouble(dir.Z())
);
}
}
@@ -454,10 +454,10 @@ OpaqueCoordinate<4> ifcopenshell::geometry::OpenCascadeShape::plane_equation()
double a, b, c, d;
plane->Pln().Coefficients(a, b, c, d);
return OpaqueCoordinate<4>(
new NumberNativeDouble(a),
new NumberNativeDouble(b),
new NumberNativeDouble(c),
new NumberNativeDouble(d)
NumberNativeDouble(a),
NumberNativeDouble(b),
NumberNativeDouble(c),
NumberNativeDouble(d)
);
}
}