Struct Triangulation

Source
pub struct Triangulation<'a, T, V>
where T: BaseFloat, V: Into<Vector2<T>>,
{ /* private fields */ }

Implementations§

Source§

impl<'a, T, V> Triangulation<'a, T, V>
where T: BaseFloat, V: Into<Vector2<T>> + Copy,

Source

pub fn new(points: &'a [V]) -> Self

Returns a new Triangulations object that holds the configuration and a reference to the points

use triangular::Triangulation;

let points = vec![(0.6, 1.1),
                  (0.2, 1.5),
                  (0.8, 1.6)];

let triangles = Triangulation::new(&points);
Source

pub fn with_bounds(self, c1: V, c2: V) -> Self

Return all Triangles calculated within the specified bounds

use triangular::Triangulation;

// build a set of points
let points = vec![(0.6, 1.1),
                  (0.2, 1.5),
                  (0.8, 1.6)];

let triangles = Triangulation::new(&points)
                    .with_bounds((0.0, 0.0), (2.0, 2.0))
                    .build();
assert_eq!(&*triangles, &[2, 1, 0]);
Source

pub fn with_max_len(self, max_len: T) -> Self

Return all Triangles Calculated with edges < max_len

use triangular::Triangulation;

// build a set of points
let points = vec![(0.6, 1.1),
                  (0.2, 1.5),
                  (0.8, 1.6)];

let triangles = Triangulation::new(&points)
                    .with_max_len(0.1)
                    .build();
assert_eq!(&*triangles, &[]);
Source

pub fn build(self) -> Box<[usize]>

Builds the triangulations and returns all indices of the generated triangles

use triangular::Triangulation;

// build a set of points
let points = vec![(0.6, 1.1),
                  (0.2, 1.5),
                  (0.8, 1.6)];

let triangles = Triangulation::new(&points)
                    .build();

Auto Trait Implementations§

§

impl<'a, T, V> Freeze for Triangulation<'a, T, V>
where T: Freeze, V: Freeze,

§

impl<'a, T, V> RefUnwindSafe for Triangulation<'a, T, V>

§

impl<'a, T, V> Send for Triangulation<'a, T, V>
where T: Send, V: Sync + Send,

§

impl<'a, T, V> Sync for Triangulation<'a, T, V>
where T: Sync, V: Sync,

§

impl<'a, T, V> Unpin for Triangulation<'a, T, V>
where T: Unpin, V: Unpin,

§

impl<'a, T, V> UnwindSafe for Triangulation<'a, T, V>

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