-
Notifications
You must be signed in to change notification settings - Fork 70
Shape inspection #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Shape inspection #228
Changes from all commits
4232ce4
bf6051d
50833e6
cca8490
b3151cc
eed0a58
f77d40a
fedea44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,17 @@ | ||||||||
| #include <BRepAdaptor_Curve.hxx> | ||||||||
| #include <bindings_common.hxx> | ||||||||
| #include <gp_Circ.hxx> | ||||||||
| #include <gp_Pnt.hxx> | ||||||||
| #include <gp_Vec.hxx> | ||||||||
|
|
||||||||
| inline std::unique_ptr<gp_Pnt> BRepAdaptor_Curve_value(const BRepAdaptor_Curve &curve, const Standard_Real U) { | ||||||||
| return std::unique_ptr<gp_Pnt>(new gp_Pnt(curve.Value(U))); | ||||||||
| } | ||||||||
|
|
||||||||
| inline void BRepAdaptor_Curve_D1(const BRepAdaptor_Curve &curve, const Standard_Real U, gp_Pnt &P, gp_Vec &V1) { | ||||||||
| curve.D1(U, P, V1); | ||||||||
| } | ||||||||
|
Comment on lines
+11
to
+13
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one can fortunately be auto-bound
Suggested change
In #[cxx_name = "D1"]
pub fn d1(self: &BRepAdaptor_Curve, u: f64, point: Pin<&mut gp_Pnt>, vec: Pin<&mut gp_Vec>);And then in curve.d1(param, point.pin_mut(), vec.pin_mut());In general I try to avoid as much C++ code as possible in the wrappers. For things like wrapping code in |
||||||||
|
|
||||||||
| inline std::unique_ptr<gp_Circ> BRepAdaptor_Curve_Circle(const BRepAdaptor_Curve &curve) { | ||||||||
| return std::unique_ptr<gp_Circ>(new gp_Circ(curve.Circle())); | ||||||||
| } | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,17 @@ | ||
| #include <Geom_BSplineCurve.hxx> | ||
| #include <Geom_BezierCurve.hxx> | ||
| #include <Geom_BezierSurface.hxx> | ||
| #include <Geom_Circle.hxx> | ||
| #include <Geom_ConicalSurface.hxx> | ||
| #include <Geom_CylindricalSurface.hxx> | ||
| #include <Geom_Plane.hxx> | ||
| #include <Geom_SphericalSurface.hxx> | ||
| #include <Geom_Surface.hxx> | ||
| #include <Geom_ToroidalSurface.hxx> | ||
| #include <Geom_TrimmedCurve.hxx> | ||
| #include <bindings_common.hxx> | ||
| #include <gp_Ax3.hxx> | ||
| #include <gp_Circ.hxx> | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_CylindricalSurface> Geom_CylindricalSurface_new(const gp_Ax3 &axis, double radius) { | ||
| return std::unique_ptr<Handle_Geom_CylindricalSurface>( | ||
|
|
@@ -43,3 +49,76 @@ inline std::unique_ptr<gp_Pnt> HandleGeomCurve_Value(const Handle_Geom_Curve &cu | |
| } | ||
|
|
||
| inline const Handle_Standard_Type &DynamicType(const Handle_Geom_Surface &surface) { return surface->DynamicType(); } | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_Circle> new_HandleGeomCircle_from_HandleGeomCurve(const Handle_Geom_Curve &curve) { | ||
| Handle_Geom_Circle circle_handle = opencascade::handle<Geom_Circle>::DownCast(curve); | ||
| return std::unique_ptr<Handle_Geom_Circle>(new opencascade::handle<Geom_Circle>(circle_handle)); | ||
| } | ||
|
|
||
| inline std::unique_ptr<gp_Circ> HandleGeomCircle_Circ(const Handle_Geom_Circle &circle) { | ||
| return std::unique_ptr<gp_Circ>(new gp_Circ(circle->Circ())); | ||
| } | ||
|
|
||
| // CylindricalSurface downcast + accessors | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_CylindricalSurface> | ||
| new_HandleGeomCylindricalSurface_from_HandleGeomSurface(const Handle_Geom_Surface &surface) { | ||
| Handle_Geom_CylindricalSurface handle = opencascade::handle<Geom_CylindricalSurface>::DownCast(surface); | ||
| return std::unique_ptr<Handle_Geom_CylindricalSurface>(new opencascade::handle<Geom_CylindricalSurface>(handle)); | ||
| } | ||
|
|
||
| inline double HandleGeomCylindricalSurface_Radius(const Handle_Geom_CylindricalSurface &cyl) { return cyl->Radius(); } | ||
|
|
||
| inline const gp_Ax3 &HandleGeomCylindricalSurface_Position(const Handle_Geom_CylindricalSurface &cyl) { | ||
| return cyl->Position(); | ||
| } | ||
|
|
||
| // SphericalSurface downcast + accessors | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_SphericalSurface> | ||
| new_HandleGeomSphericalSurface_from_HandleGeomSurface(const Handle_Geom_Surface &surface) { | ||
| Handle_Geom_SphericalSurface handle = opencascade::handle<Geom_SphericalSurface>::DownCast(surface); | ||
| return std::unique_ptr<Handle_Geom_SphericalSurface>(new opencascade::handle<Geom_SphericalSurface>(handle)); | ||
| } | ||
|
|
||
| inline double HandleGeomSphericalSurface_Radius(const Handle_Geom_SphericalSurface &sphere) { return sphere->Radius(); } | ||
|
|
||
| inline const gp_Ax3 &HandleGeomSphericalSurface_Position(const Handle_Geom_SphericalSurface &sphere) { | ||
| return sphere->Position(); | ||
| } | ||
|
Comment on lines
+84
to
+88
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can these be auto-bound? |
||
|
|
||
| // ConicalSurface downcast + accessors | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_ConicalSurface> | ||
| new_HandleGeomConicalSurface_from_HandleGeomSurface(const Handle_Geom_Surface &surface) { | ||
| Handle_Geom_ConicalSurface handle = opencascade::handle<Geom_ConicalSurface>::DownCast(surface); | ||
| return std::unique_ptr<Handle_Geom_ConicalSurface>(new opencascade::handle<Geom_ConicalSurface>(handle)); | ||
| } | ||
|
|
||
| inline double HandleGeomConicalSurface_RefRadius(const Handle_Geom_ConicalSurface &cone) { return cone->RefRadius(); } | ||
|
|
||
| inline double HandleGeomConicalSurface_SemiAngle(const Handle_Geom_ConicalSurface &cone) { return cone->SemiAngle(); } | ||
|
|
||
| inline const gp_Ax3 &HandleGeomConicalSurface_Position(const Handle_Geom_ConicalSurface &cone) { | ||
| return cone->Position(); | ||
| } | ||
|
Comment on lines
+98
to
+104
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, let's try to auto-bind these. |
||
|
|
||
| // ToroidalSurface downcast + accessors | ||
|
|
||
| inline std::unique_ptr<Handle_Geom_ToroidalSurface> | ||
| new_HandleGeomToroidalSurface_from_HandleGeomSurface(const Handle_Geom_Surface &surface) { | ||
| Handle_Geom_ToroidalSurface handle = opencascade::handle<Geom_ToroidalSurface>::DownCast(surface); | ||
| return std::unique_ptr<Handle_Geom_ToroidalSurface>(new opencascade::handle<Geom_ToroidalSurface>(handle)); | ||
| } | ||
|
|
||
| inline double HandleGeomToroidalSurface_MajorRadius(const Handle_Geom_ToroidalSurface &torus) { | ||
| return torus->MajorRadius(); | ||
| } | ||
|
|
||
| inline double HandleGeomToroidalSurface_MinorRadius(const Handle_Geom_ToroidalSurface &torus) { | ||
| return torus->MinorRadius(); | ||
| } | ||
|
|
||
| inline const gp_Ax3 &HandleGeomToroidalSurface_Position(const Handle_Geom_ToroidalSurface &torus) { | ||
| return torus->Position(); | ||
| } | ||
|
Comment on lines
+114
to
+124
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ mod inner { | |
| include!("opencascade-sys/include/b_rep_adaptor.hxx"); | ||
|
|
||
| type gp_Pnt = crate::gp::gp_Pnt; | ||
| type gp_Vec = crate::gp::gp_Vec; | ||
| type gp_Circ = crate::gp::gp_Circ; | ||
| type GeomAbs_CurveType = crate::geom_abs::GeomAbs_CurveType; | ||
| type TopoDS_Edge = crate::topo_ds::TopoDS_Edge; | ||
|
|
||
|
|
@@ -15,6 +17,13 @@ mod inner { | |
| pub fn FirstParameter(self: &BRepAdaptor_Curve) -> f64; | ||
| pub fn LastParameter(self: &BRepAdaptor_Curve) -> f64; | ||
| pub fn BRepAdaptor_Curve_value(curve: &BRepAdaptor_Curve, u: f64) -> UniquePtr<gp_Pnt>; | ||
| pub fn BRepAdaptor_Curve_D1( | ||
| curve: &BRepAdaptor_Curve, | ||
| u: f64, | ||
| point: Pin<&mut gp_Pnt>, | ||
| vec: Pin<&mut gp_Vec>, | ||
| ); | ||
|
Comment on lines
+20
to
+25
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted in another comment, this can become: #[cxx_name = "D1"]
pub fn d1(self: &BRepAdaptor_Curve, u: f64, point: Pin<&mut gp_Pnt>, vec: Pin<&mut gp_Vec>); |
||
| pub fn BRepAdaptor_Curve_Circle(curve: &BRepAdaptor_Curve) -> UniquePtr<gp_Circ>; | ||
| pub fn GetType(self: &BRepAdaptor_Curve) -> GeomAbs_CurveType; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ mod inner { | |
|
|
||
| type gp_Ax3 = crate::gp::gp_Ax3; | ||
| type gp_Pnt = crate::gp::gp_Pnt; | ||
| type gp_Circ = crate::gp::gp_Circ; | ||
| type TColgp_Array2OfPnt = crate::t_col_gp::TColgp_Array2OfPnt; | ||
| type TColgp_HArray1OfPnt = crate::t_col_gp::TColgp_HArray1OfPnt; | ||
| type Handle_Standard_Type = crate::standard::Handle_Standard_Type; | ||
|
|
@@ -35,6 +36,18 @@ mod inner { | |
| type Handle_Geom_Plane; | ||
| pub fn IsNull(self: &Handle_Geom_Plane) -> bool; | ||
|
|
||
| type Handle_Geom_SphericalSurface; | ||
| pub fn IsNull(self: &Handle_Geom_SphericalSurface) -> bool; | ||
|
|
||
| type Handle_Geom_ConicalSurface; | ||
| pub fn IsNull(self: &Handle_Geom_ConicalSurface) -> bool; | ||
|
|
||
| type Handle_Geom_ToroidalSurface; | ||
| pub fn IsNull(self: &Handle_Geom_ToroidalSurface) -> bool; | ||
|
|
||
| type Handle_Geom_Circle; | ||
| pub fn IsNull(self: &Handle_Geom_Circle) -> bool; | ||
|
|
||
| type Handle_Geom_CylindricalSurface; | ||
| pub fn IsNull(self: &Handle_Geom_CylindricalSurface) -> bool; | ||
| // End Handles | ||
|
|
@@ -74,6 +87,41 @@ mod inner { | |
| geom_surface_handle: &Handle_Geom_Surface, | ||
| ) -> UniquePtr<Handle_Geom_Plane>; | ||
|
|
||
| pub fn new_HandleGeomCylindricalSurface_from_HandleGeomSurface( | ||
| geom_surface_handle: &Handle_Geom_Surface, | ||
| ) -> UniquePtr<Handle_Geom_CylindricalSurface>; | ||
| pub fn HandleGeomCylindricalSurface_Radius(cyl: &Handle_Geom_CylindricalSurface) -> f64; | ||
| pub fn HandleGeomCylindricalSurface_Position( | ||
| cyl: &Handle_Geom_CylindricalSurface, | ||
| ) -> &gp_Ax3; | ||
|
Comment on lines
+90
to
+96
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry the code for |
||
|
|
||
| pub fn new_HandleGeomSphericalSurface_from_HandleGeomSurface( | ||
| geom_surface_handle: &Handle_Geom_Surface, | ||
| ) -> UniquePtr<Handle_Geom_SphericalSurface>; | ||
| pub fn HandleGeomSphericalSurface_Radius(sphere: &Handle_Geom_SphericalSurface) -> f64; | ||
| pub fn HandleGeomSphericalSurface_Position( | ||
| sphere: &Handle_Geom_SphericalSurface, | ||
| ) -> &gp_Ax3; | ||
|
|
||
| pub fn new_HandleGeomConicalSurface_from_HandleGeomSurface( | ||
| geom_surface_handle: &Handle_Geom_Surface, | ||
| ) -> UniquePtr<Handle_Geom_ConicalSurface>; | ||
| pub fn HandleGeomConicalSurface_RefRadius(cone: &Handle_Geom_ConicalSurface) -> f64; | ||
| pub fn HandleGeomConicalSurface_SemiAngle(cone: &Handle_Geom_ConicalSurface) -> f64; | ||
| pub fn HandleGeomConicalSurface_Position(cone: &Handle_Geom_ConicalSurface) -> &gp_Ax3; | ||
|
|
||
| pub fn new_HandleGeomToroidalSurface_from_HandleGeomSurface( | ||
| geom_surface_handle: &Handle_Geom_Surface, | ||
| ) -> UniquePtr<Handle_Geom_ToroidalSurface>; | ||
| pub fn HandleGeomToroidalSurface_MajorRadius(torus: &Handle_Geom_ToroidalSurface) -> f64; | ||
| pub fn HandleGeomToroidalSurface_MinorRadius(torus: &Handle_Geom_ToroidalSurface) -> f64; | ||
| pub fn HandleGeomToroidalSurface_Position(torus: &Handle_Geom_ToroidalSurface) -> &gp_Ax3; | ||
|
|
||
| pub fn new_HandleGeomCircle_from_HandleGeomCurve( | ||
| curve: &Handle_Geom_Curve, | ||
| ) -> UniquePtr<Handle_Geom_Circle>; | ||
| pub fn HandleGeomCircle_Circ(circle: &Handle_Geom_Circle) -> UniquePtr<gp_Circ>; | ||
|
|
||
| #[cxx_name = "construct_unique"] | ||
| pub fn new_HandleGeomCurve_from_HandleGeom_BSplineCurve( | ||
| bspline_curve_handle: &Handle_Geom_BSplineCurve, | ||
|
|
@@ -90,7 +138,11 @@ mod inner { | |
| ) -> UniquePtr<Handle_Geom_Curve>; | ||
| } | ||
|
|
||
| impl UniquePtr<Handle_Geom_Circle> {} | ||
| impl UniquePtr<Handle_Geom_CylindricalSurface> {} | ||
| impl UniquePtr<Handle_Geom_SphericalSurface> {} | ||
| impl UniquePtr<Handle_Geom_ConicalSurface> {} | ||
| impl UniquePtr<Handle_Geom_ToroidalSurface> {} | ||
| impl UniquePtr<Handle_Geom_BezierSurface> {} | ||
| impl UniquePtr<Handle_Geom_BezierCurve> {} | ||
| impl UniquePtr<Handle_Geom_Plane> {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,12 @@ pub use surface::*; | |||||||||||||||||||||||||||||||||||
| pub use vertex::*; | ||||||||||||||||||||||||||||||||||||
| pub use wire::*; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #[derive(Debug, Copy, Clone, PartialEq)] | ||||||||||||||||||||||||||||||||||||
| pub enum PositionMode { | ||||||||||||||||||||||||||||||||||||
| Parameter, | ||||||||||||||||||||||||||||||||||||
| Length, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #[derive(Debug, Copy, Clone, PartialEq)] | ||||||||||||||||||||||||||||||||||||
| pub enum ShapeType { | ||||||||||||||||||||||||||||||||||||
| /// Abstract topological data structure describes a basic entity. | ||||||||||||||||||||||||||||||||||||
|
|
@@ -267,3 +273,36 @@ impl From<JoinType> for ffi::geom_abs::GeomAbs_JoinType { | |||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #[derive(Debug, Copy, Clone, PartialEq)] | ||||||||||||||||||||||||||||||||||||
| pub enum SurfaceType { | ||||||||||||||||||||||||||||||||||||
| Plane, | ||||||||||||||||||||||||||||||||||||
| Cylinder, | ||||||||||||||||||||||||||||||||||||
| Cone, | ||||||||||||||||||||||||||||||||||||
| Sphere, | ||||||||||||||||||||||||||||||||||||
| Torus, | ||||||||||||||||||||||||||||||||||||
| BezierSurface, | ||||||||||||||||||||||||||||||||||||
| BSplineSurface, | ||||||||||||||||||||||||||||||||||||
| SurfaceOfRevolution, | ||||||||||||||||||||||||||||||||||||
| SurfaceOfExtrusion, | ||||||||||||||||||||||||||||||||||||
| OffsetSurface, | ||||||||||||||||||||||||||||||||||||
| OtherSurface, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| impl std::fmt::Display for SurfaceType { | ||||||||||||||||||||||||||||||||||||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||||||||||||||||||||||||||||||||
| match self { | ||||||||||||||||||||||||||||||||||||
| SurfaceType::Plane => write!(f, "Plane"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::Cylinder => write!(f, "Cylinder"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::Cone => write!(f, "Cone"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::Sphere => write!(f, "Sphere"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::Torus => write!(f, "Torus"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::BezierSurface => write!(f, "BezierSurface"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::BSplineSurface => write!(f, "BSplineSurface"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::SurfaceOfRevolution => write!(f, "SurfaceOfRevolution"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::SurfaceOfExtrusion => write!(f, "SurfaceOfExtrusion"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::OffsetSurface => write!(f, "OffsetSurface"), | ||||||||||||||||||||||||||||||||||||
| SurfaceType::OtherSurface => write!(f, "OtherSurface"), | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+292
to
+308
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We can drop this entire |
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| use super::make_vec; | ||
| use crate::primitives::{make_axis_2, make_point}; | ||
| use crate::primitives::{make_axis_2, make_point, PositionMode}; | ||
| use cxx::UniquePtr; | ||
| use glam::{dvec3, DVec3}; | ||
| use opencascade_sys as ffi; | ||
|
|
@@ -174,6 +174,55 @@ impl Edge { | |
|
|
||
| EdgeType::from(curve.GetType()) | ||
| } | ||
|
|
||
| pub fn length(&self) -> f64 { | ||
| let mut props = ffi::g_prop::GProps_new(); | ||
| ffi::b_rep_g_prop::BRepGProp::LinearProperties( | ||
| ffi::topo_ds::cast_edge_to_shape(&self.inner), | ||
| props.pin_mut(), | ||
| false, | ||
| false, | ||
| ); | ||
| props.Mass() | ||
| } | ||
|
|
||
| pub fn tangent_at(&self, position: f64, mode: PositionMode) -> DVec3 { | ||
| let curve = ffi::b_rep_adaptor::BRepAdaptor_Curve_new(&self.inner); | ||
| let param = match mode { | ||
| PositionMode::Parameter => position, | ||
| PositionMode::Length => { | ||
| let first = curve.FirstParameter(); | ||
| let last = curve.LastParameter(); | ||
| first + position * (last - first) | ||
| }, | ||
| }; | ||
|
Comment on lines
+191
to
+198
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really want |
||
|
|
||
| let mut point = ffi::gp::new_point(0.0, 0.0, 0.0); | ||
| let mut vec = ffi::gp::new_vec(0.0, 0.0, 0.0); | ||
| ffi::b_rep_adaptor::BRepAdaptor_Curve_D1(&curve, param, point.pin_mut(), vec.pin_mut()); | ||
|
|
||
| dvec3(vec.X(), vec.Y(), vec.Z()).normalize() | ||
| } | ||
|
|
||
| pub fn arc_center(&self) -> Option<DVec3> { | ||
| let curve = ffi::b_rep_adaptor::BRepAdaptor_Curve_new(&self.inner); | ||
| if curve.GetType() != ffi::geom_abs::GeomAbs_CurveType::GeomAbs_Circle { | ||
| return None; | ||
| } | ||
| let circ = ffi::b_rep_adaptor::BRepAdaptor_Curve_Circle(&curve); | ||
| let pos = circ.Position(); | ||
| let loc = pos.Location(); | ||
| Some(dvec3(loc.X(), loc.Y(), loc.Z())) | ||
| } | ||
|
|
||
| pub fn radius(&self) -> Option<f64> { | ||
| let curve = ffi::b_rep_adaptor::BRepAdaptor_Curve_new(&self.inner); | ||
| if curve.GetType() != ffi::geom_abs::GeomAbs_CurveType::GeomAbs_Circle { | ||
| return None; | ||
| } | ||
| let circ = ffi::b_rep_adaptor::BRepAdaptor_Curve_Circle(&curve); | ||
| Some(circ.Radius()) | ||
| } | ||
| } | ||
|
|
||
| pub struct ApproximationSegmentIterator { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly clumsier in this case (because you have to cast a Wire to a Shape), but you can bind to static class functions like this:
Just noting that as an option though, this code is fine as-is.