pub struct CylindricalSurface { /* private fields */ }Expand description
An infinite cylindrical surface.
Parameterized as P(u, v) = origin + radius*(cos(u)*x_axis + sin(u)*y_axis) + v*axis
where u ∈ [0, 2π) and v ∈ (-∞, +∞).
Implementations§
Source§impl CylindricalSurface
impl CylindricalSurface
Sourcepub fn new(origin: Point3, axis: Vec3, radius: f64) -> Result<Self, MathError>
pub fn new(origin: Point3, axis: Vec3, radius: f64) -> Result<Self, MathError>
Creates a new cylindrical surface.
§Errors
Returns an error if radius is not positive or axis is zero.
Sourcepub const fn x_axis(&self) -> Vec3
pub const fn x_axis(&self) -> Vec3
Returns the local X axis (first radial direction in the parametric frame).
Sourcepub const fn y_axis(&self) -> Vec3
pub const fn y_axis(&self) -> Vec3
Returns the local Y axis (second radial direction in the parametric frame).
Sourcepub fn with_ref_dir(
origin: Point3,
axis: Vec3,
radius: f64,
ref_dir: Vec3,
) -> Result<Self, MathError>
pub fn with_ref_dir( origin: Point3, axis: Vec3, radius: f64, ref_dir: Vec3, ) -> Result<Self, MathError>
Creates a cylindrical surface with a specified reference direction.
ref_dir defines the x-axis of the parametric frame (projected
perpendicular to axis). This preserves the parametric orientation
from STEP AXIS2_PLACEMENT_3D or BREP round-trips.
§Errors
Returns an error if radius is not positive or axis is zero.
Sourcepub fn translated(&self, offset: Vec3) -> Self
pub fn translated(&self, offset: Vec3) -> Self
Returns a copy of this cylinder with its origin translated by offset.
Sourcepub fn project_point(&self, point: Point3) -> (f64, f64)
pub fn project_point(&self, point: Point3) -> (f64, f64)
Project a 3D point onto the cylinder surface, returning (u, v) parameters.
u is the angular parameter [0, 2π), v is the axial parameter.
Sourcepub fn to_nurbs(
&self,
v_min: f64,
v_max: f64,
) -> Result<NurbsSurface, MathError>
pub fn to_nurbs( &self, v_min: f64, v_max: f64, ) -> Result<NurbsSurface, MathError>
Convert to an exact rational NURBS surface over the given v-range.
Uses degree (2, 1) with 9 control points per ring (standard rational representation of a full circle). The result is geometrically exact.
§Errors
Returns an error if NurbsSurface construction fails.
Trait Implementations§
Source§impl Clone for CylindricalSurface
impl Clone for CylindricalSurface
Source§fn clone(&self) -> CylindricalSurface
fn clone(&self) -> CylindricalSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more