pub struct ConicalSurface { /* private fields */ }Expand description
An infinite conical surface.
Parameterized as P(u, v) = apex + v*(cos(half_angle)*(cos(u)*x_axis + sin(u)*y_axis) + sin(half_angle)*axis)
where u ∈ [0, 2π) and v ∈ [0, +∞).
Implementations§
Source§impl ConicalSurface
impl ConicalSurface
Sourcepub fn new(apex: Point3, axis: Vec3, half_angle: f64) -> Result<Self, MathError>
pub fn new(apex: Point3, axis: Vec3, half_angle: f64) -> Result<Self, MathError>
Creates a new conical surface.
half_angle is the angle from the radial plane to the cone’s surface
generator (radians). Small angles produce wide/flat cones; angles near
π/2 produce narrow/spike cones. In the evaluate formula
P(u,v) = apex + v*(cos(a)*radial + sin(a)*axis), a is this angle.
§Errors
Returns an error if half-angle is not in (0, π/2) or axis is zero.
Sourcepub const fn half_angle(&self) -> f64
pub const fn half_angle(&self) -> f64
Returns the half-angle in radians.
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(
apex: Point3,
axis: Vec3,
half_angle: f64,
ref_dir: Vec3,
) -> Result<Self, MathError>
pub fn with_ref_dir( apex: Point3, axis: Vec3, half_angle: f64, ref_dir: Vec3, ) -> Result<Self, MathError>
Creates a conical 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 half-angle is not in (0, π/2) or axis is zero.
Sourcepub fn translated(&self, offset: Vec3) -> Self
pub fn translated(&self, offset: Vec3) -> Self
Returns a copy of this cone with its apex translated by offset.
Sourcepub fn radius_at(&self, v: f64) -> f64
pub fn radius_at(&self, v: f64) -> f64
Returns the radius at a given distance v along the axis from the apex.
Sourcepub fn project_point(&self, point: Point3) -> (f64, f64)
pub fn project_point(&self, point: Point3) -> (f64, f64)
Project a 3D point onto the cone surface, returning (u, v) parameters.
u is the angular parameter [0, 2π), v is the distance from the
apex along the cone surface generator line.
Trait Implementations§
Source§impl Clone for ConicalSurface
impl Clone for ConicalSurface
Source§fn clone(&self) -> ConicalSurface
fn clone(&self) -> ConicalSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more