to_string() option, no shared_ptr in OpaqueCoord, add ConvResShape::vertices(), newell instead of simple cross product, create_epeck(double/str)

This commit is contained in:
Thomas Krijnen
2023-12-13 16:43:33 +01:00
parent 14e924cd8c
commit 6ed91d3ea4
8 changed files with 219 additions and 94 deletions
@@ -132,10 +132,18 @@ namespace ifcopenshell { namespace geometry {
NumberEpeck(const CGAL::Epeck::FT& v)
: value_(v) {}
virtual ~NumberEpeck() { }
virtual double to_double() const {
return CGAL::to_double(value_);
}
virtual std::string to_string() const {
std::stringstream ss;
ss << value_.exact();
return ss.str();
}
const CGAL::Epeck::FT& value() const {
return value_;
}
@@ -161,6 +169,9 @@ namespace ifcopenshell { namespace geometry {
virtual OpaqueNumber* operator-() const {
return unary_op<negate_<CGAL::Epeck::FT>>();
}
virtual OpaqueNumber* clone() const {
return new NumberEpeck(value_);
}
};
#endif
@@ -217,9 +228,9 @@ namespace ifcopenshell { namespace geometry {
// @todo this must be something with a virtual dtor so that we can delete it.
virtual std::pair<OpaqueCoordinate<3>, OpaqueCoordinate<3>> bounding_box() const;
virtual std::shared_ptr<OpaqueNumber> length();
virtual std::shared_ptr<OpaqueNumber> area();
virtual std::shared_ptr<OpaqueNumber> volume();
virtual OpaqueNumber* length();
virtual OpaqueNumber* area();
virtual OpaqueNumber* volume();
virtual OpaqueCoordinate<3> position();
virtual OpaqueCoordinate<3> axis();
@@ -229,6 +240,8 @@ namespace ifcopenshell { namespace geometry {
virtual ConversionResultShape* halfspaces();
virtual ConversionResultShape* solid();
virtual ConversionResultShape* box();
virtual std::vector<ConversionResultShape*> vertices();
virtual std::vector<ConversionResultShape*> edges();
virtual std::vector<ConversionResultShape*> facets();
@@ -274,9 +287,9 @@ namespace ifcopenshell { namespace geometry {
virtual std::pair<OpaqueCoordinate<3>, OpaqueCoordinate<3>> bounding_box() const;
virtual void set_box(void* b);
virtual std::shared_ptr<OpaqueNumber> length();
virtual std::shared_ptr<OpaqueNumber> area();
virtual std::shared_ptr<OpaqueNumber> volume();
virtual OpaqueNumber* length();
virtual OpaqueNumber* area();
virtual OpaqueNumber* volume();
virtual OpaqueCoordinate<3> position();
virtual OpaqueCoordinate<3> axis();
@@ -286,6 +299,8 @@ namespace ifcopenshell { namespace geometry {
virtual ConversionResultShape* halfspaces();
virtual ConversionResultShape* solid();
virtual ConversionResultShape* box();
virtual std::vector<ConversionResultShape*> vertices();
virtual std::vector<ConversionResultShape*> edges();
virtual std::vector<ConversionResultShape*> facets();