Skip to main content

Edge

Struct Edge 

Source
pub struct Edge { /* private fields */ }
Expand description

An edge topology shape.

Implementations§

Source§

impl Edge

Source

pub fn id(&self) -> u64

Source

pub fn helix( radius: f64, pitch: f64, height: f64, axis: DVec3, x_ref: DVec3, ) -> Result<Edge, Error>

Source

pub fn polygon<'a>( points: impl IntoIterator<Item = &'a DVec3>, ) -> Result<Vec<Edge>, Error>

Source

pub fn circle(radius: f64, axis: DVec3) -> Result<Edge, Error>

Source

pub fn line(a: DVec3, b: DVec3) -> Result<Edge, Error>

Source

pub fn arc_3pts(start: DVec3, mid: DVec3, end: DVec3) -> Result<Edge, Error>

Source

pub fn bspline<'a>( points: impl IntoIterator<Item = &'a DVec3>, end: BSplineEnd, ) -> Result<Edge, Error>

Source

pub fn iter_elem(&self) -> impl Iterator<Item = &Edge> + '_

Source

pub fn map_elem(self, f: impl FnMut(Edge) -> Edge) -> Edge

Source

pub fn start_point(&self) -> DVec3

Source

pub fn end_point(&self) -> DVec3

Source

pub fn start_tangent(&self) -> DVec3

Source

pub fn end_tangent(&self) -> DVec3

Source

pub fn is_closed(&self) -> bool

Source

pub fn approximation_segments(&self, tolerance: f64) -> Vec<DVec3>

Source

pub fn project(&self, p: DVec3) -> (DVec3, DVec3)

Source

pub fn translate(self, translation: DVec3) -> Edge

Source

pub fn rotate( self, axis_origin: DVec3, axis_direction: DVec3, angle: f64, ) -> Edge

Source

pub fn rotate_x(self, angle: f64) -> Edge

Source

pub fn rotate_y(self, angle: f64) -> Edge

Source

pub fn rotate_z(self, angle: f64) -> Edge

Source

pub fn scale(self, center: DVec3, factor: f64) -> Edge

Source

pub fn mirror(self, plane_origin: DVec3, plane_normal: DVec3) -> Edge

Source

pub fn align_x(self, new_x: DVec3, y_hint: DVec3) -> Edge

Source

pub fn align_y(self, new_y: DVec3, z_hint: DVec3) -> Edge

Source

pub fn align_z(self, new_z: DVec3, x_hint: DVec3) -> Edge

Trait Implementations§

Source§

impl Clone for Edge

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Wire for Edge

Source§

type Elem = Edge

Source§

fn iter_elem(&self) -> impl Iterator<Item = &Edge> + '_

Borrow each element. For Edge itself this yields std::iter::once(self); for Vec<T> / [T; N] it yields self.iter().
Source§

fn map_elem(self, _: impl FnMut(Edge) -> Edge) -> Self

Replace every element by mapping through f. Length is preserved. For Edge this is f(self); for collections it consumes self and rebuilds in the same shape.
Source§

fn start_point(&self) -> DVec3

Source§

fn end_point(&self) -> DVec3

Source§

fn start_tangent(&self) -> DVec3

Source§

fn end_tangent(&self) -> DVec3

Source§

fn is_closed(&self) -> bool

Empty wire: false. Single-edge wire: defer to that edge’s geometry (a circle is closed). Multi-edge wire: first edge’s start ≈ last edge’s end. 1e-6 はモデル単位 (mm) を想定したハードコード — 引数化は API が 増えるため後回し。極小/極大スケールのモデルで誤判定したら直す。
Source§

fn approximation_segments(&self, tolerance: f64) -> Vec<DVec3>

Source§

fn project(&self, p: DVec3) -> (DVec3, DVec3)

Project p onto the wire and return (closest_point, unit_tangent). The tangent follows the curve’s native parameter direction. Read more
Source§

fn translate(self, translation: DVec3) -> Self

Source§

fn rotate(self, axis_origin: DVec3, axis_direction: DVec3, angle: f64) -> Self

Source§

fn rotate_x(self, angle: f64) -> Self

Source§

fn rotate_y(self, angle: f64) -> Self

Source§

fn rotate_z(self, angle: f64) -> Self

Source§

fn scale(self, center: DVec3, factor: f64) -> Self

Source§

fn mirror(self, plane_origin: DVec3, plane_normal: DVec3) -> Self

Source§

fn align_x(self, new_x: DVec3, y_hint: DVec3) -> Self

Source§

fn align_y(self, new_y: DVec3, z_hint: DVec3) -> Self

Source§

fn align_z(self, new_z: DVec3, x_hint: DVec3) -> Self

Auto Trait Implementations§

§

impl Freeze for Edge

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl !Sync for Edge

§

impl Unpin for Edge

§

impl UnsafeUnpin for Edge

§

impl UnwindSafe for Edge

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