Skip to main content

Profile

Struct Profile 

Source
pub struct Profile<S: Scalar> {
    pub curves: Vec<NurbCurve2D<S>>,
    pub curve_names: Vec<String>,
    pub joint_names: Vec<String>,
}
Expand description

A chain of profile curves, with a stable name for every curve and every joint between them — what extrude and revolve build the names of the faces, edges and vertices they sweep out of it from (see geop_core_part’s crate docs). For a sketch these are its element ids; for a shape built in code, positions in the chain (Profile::closed).

joint_names[i] names the joint where curves[i] starts. A closed loop has one joint per curve; an open chain one more, its end.

Fields§

§curves: Vec<NurbCurve2D<S>>§curve_names: Vec<String>§joint_names: Vec<String>

Implementations§

Source§

impl<S: Scalar> Profile<S>

Source

pub fn closed(curves: Vec<NurbCurve2D<S>>) -> Self

A closed loop whose curves are called c0, c1, ... and whose joints p0, p1, ..., p0 where c0 starts.

Source

pub fn open(curves: Vec<NurbCurve2D<S>>) -> Self

An open chain, named like Profile::closed plus its end joint.

Source

pub fn with_prefix(self, prefix: &str) -> Self

The same chain with prefix put in front of every name — to keep several Profile::closed loops of one extrude apart.

Source

pub fn is_closed(&self) -> bool

Source

pub fn check_names(&self) -> GeopResult<()>

Checks that there is one name per curve and one per joint.

Source

pub fn reversed(&self) -> Self

The same chain traversed the other way; every name stays with its curve or joint.

Source

pub fn map_curves(&self, f: impl Fn(&NurbCurve2D<S>) -> NurbCurve2D<S>) -> Self

The same chain with f applied to every curve, keeping the names.

Trait Implementations§

Source§

impl<S: Clone + Scalar> Clone for Profile<S>

Source§

fn clone(&self) -> Profile<S>

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<S: Debug + Scalar> Debug for Profile<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Profile<S>

§

impl<S> RefUnwindSafe for Profile<S>
where S: RefUnwindSafe,

§

impl<S> Send for Profile<S>

§

impl<S> Sync for Profile<S>

§

impl<S> Unpin for Profile<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Profile<S>

§

impl<S> UnwindSafe for Profile<S>
where S: 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.