Skip to main content

Arc

Struct Arc 

Source
pub struct Arc<T> {
    pub s: V<T>,
    pub e: V<T>,
    pub half: T,
}
Expand description

A circular arc from s to e, turning counter-clockwise by 2 * half (clockwise if negative).

Fields§

§s: V<T>§e: V<T>§half: T

Implementations§

Source§

impl<T: Scalar> Arc<T>

Source

pub fn chord(&self) -> V<T>

Source

pub fn chord_length(&self) -> GeopResult<T>

Source

pub fn chord_mid(&self) -> V<T>

Source

pub fn left(&self) -> GeopResult<V<T>>

Unit normal to the chord, pointing to its left: the side the center is on for a counter-clockwise minor arc.

Source

pub fn curvature(&self) -> GeopResult<T>

Source

pub fn radius(&self) -> GeopResult<T>

|radius|. Infinite for a straight arc.

Source

pub fn center(&self) -> GeopResult<V<T>>

Center: chord_mid + left * (L / 2) cot(half). Infinitely far for a straight arc, so only for constraints that are meaningless there anyway (concentricity, tangency to a circle).

Source

pub fn arc_mid(&self) -> GeopResult<V<T>>

The point halfway along the arc: chord_mid - left * (L / 2) tan(half / 2).

Source

pub fn circle_residual(&self, p: V<T>) -> GeopResult<T>

Signed distance-like residual of p against the arc’s full circle, finite and smooth for every half including a straight arc.

With q = p - chord_mid, the circle is |q|^2 - 2 d (left . q) - L^2/4 = 0 for d the center’s offset along left. Multiplying by the curvature k (and using k d = cos(half)) gives G = k |q|^2 - 2 cos(half) (left . q) - k L^2 / 4, which is a line’s equation at k = 0. Near the circle G ≈ ±2 dist, so G / 2 is a distance.

Source

pub fn tangent_start(&self) -> GeopResult<V<T>>

Unit tangent at s, in the direction of travel.

Source

pub fn tangent_end(&self) -> GeopResult<V<T>>

Unit tangent at e, in the direction of travel.

Source

pub fn length(&self) -> GeopResult<T>

Arc length L * half / sin(half).

Trait Implementations§

Source§

impl<T: Clone> Clone for Arc<T>

Source§

fn clone(&self) -> Arc<T>

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<T: Copy> Copy for Arc<T>

Source§

impl<T: Debug> Debug for Arc<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Arc<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Arc<T>
where T: RefUnwindSafe,

§

impl<T> Send for Arc<T>
where T: Send,

§

impl<T> Sync for Arc<T>
where T: Sync,

§

impl<T> Unpin for Arc<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Arc<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Arc<T>
where T: UnwindSafe,

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.