Skip to main content

CylindricalSurface

Struct CylindricalSurface 

Source
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

Source

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.

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 origin(&self) -> Point3

Returns the origin.

Source

pub const fn axis(&self) -> Vec3

Returns the axis direction.

Source

pub const fn radius(&self) -> f64

Returns the radius.

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( 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.

Source

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

Returns a copy of this cylinder with its origin translated by offset.

Source

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.

Source

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

Source§

fn clone(&self) -> CylindricalSurface

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 CylindricalSurface

Source§

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

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

impl<'de> Deserialize<'de> for CylindricalSurface

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 CylindricalSurface

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 CylindricalSurface

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.