Skip to main content

ConicalSurface

Struct ConicalSurface 

Source
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

Source

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.

Source

pub fn evaluate(&self, u: f64, v: f64) -> Point3

Evaluates the surface at parameters (u, v).

Source

pub fn normal(&self, u: f64, _v: f64) -> Vec3

Returns the surface normal at parameters (u, v).

Source

pub const fn apex(&self) -> Point3

Returns the apex point.

Source

pub const fn axis(&self) -> Vec3

Returns the axis direction.

Source

pub const fn half_angle(&self) -> f64

Returns the half-angle in radians.

Source

pub const fn x_axis(&self) -> Vec3

Returns the local X axis (first radial direction in the parametric frame).

Source

pub const fn y_axis(&self) -> Vec3

Returns the local Y axis (second radial direction in the parametric frame).

Source

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.

Source

pub fn translated(&self, offset: Vec3) -> Self

Returns a copy of this cone with its apex translated by offset.

Source

pub fn radius_at(&self, v: f64) -> f64

Returns the radius at a given distance v along the axis from the apex.

Source

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.

Source

pub fn to_nurbs( &self, v_min: f64, v_max: f64, ) -> Result<NurbsSurface, MathError>

Convert to an approximate NURBS surface over the given v-range.

§Errors

Returns an error if NurbsSurface construction fails.

Trait Implementations§

Source§

impl Clone for ConicalSurface

Source§

fn clone(&self) -> ConicalSurface

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConicalSurface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ConicalSurface

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl ParametricSurface for ConicalSurface

Source§

fn evaluate(&self, u: f64, v: f64) -> Point3

Evaluate the surface at parameters (u, v).
Source§

fn normal(&self, u: f64, v: f64) -> Vec3

Surface normal at parameters (u, v). Read more
Source§

fn project_point(&self, point: Point3) -> (f64, f64)

Project a 3D point onto the surface, returning (u, v) parameters.
Source§

fn partial_u(&self, u: f64, v: f64) -> Vec3

Partial derivative ∂S/∂u at (u, v).
Source§

fn partial_v(&self, u: f64, _v: f64) -> Vec3

Partial derivative ∂S/∂v at (u, v).
Source§

impl Serialize for ConicalSurface

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.