Struct Physics

Source
pub struct Physics<T> {
Show 20 fields pub pos1: Vec<(T, T)>, pub pos2: Vec<([T; 2], [T; 2])>, pub pos3: Vec<([T; 3], [T; 3])>, pub pos4: Vec<([T; 4], [T; 4])>, pub eq_bones1: Vec<(usize, usize, T, T)>, pub eq_bones2: Vec<(usize, usize, T, T)>, pub eq_bones3: Vec<(usize, usize, T, T)>, pub eq_bones4: Vec<(usize, usize, T, T)>, pub less_bones1: Vec<(usize, usize, T, T)>, pub less_bones2: Vec<(usize, usize, T, T)>, pub less_bones3: Vec<(usize, usize, T, T)>, pub less_bones4: Vec<(usize, usize, T, T)>, pub more_bones1: Vec<(usize, usize, T, T)>, pub more_bones2: Vec<(usize, usize, T, T)>, pub more_bones3: Vec<(usize, usize, T, T)>, pub more_bones4: Vec<(usize, usize, T, T)>, pub map1: Vec<Point1<T>>, pub map2: Vec<Point2<T>>, pub map3: Vec<Point3<T>>, pub map4: Vec<Point4<T>>,
}
Expand description

Stores intermediate data for physics simulation.

Fields§

§pos1: Vec<(T, T)>

Scalars connected to bones.

§pos2: Vec<([T; 2], [T; 2])>

2D points connected to bones.

§pos3: Vec<([T; 3], [T; 3])>

3D points connected to bones.

§pos4: Vec<([T; 4], [T; 4])>

4D points connected to bones.

§eq_bones1: Vec<(usize, usize, T, T)>

Scalar bones that keep constant distance.

§eq_bones2: Vec<(usize, usize, T, T)>

2D bones that keep constant distance.

§eq_bones3: Vec<(usize, usize, T, T)>

3D bones that keep constant distance.

§eq_bones4: Vec<(usize, usize, T, T)>

4D bones that keep constant distance.

§less_bones1: Vec<(usize, usize, T, T)>

Bones that keep a maximum distance.

§less_bones2: Vec<(usize, usize, T, T)>

2D bones that keep maximum distance.

§less_bones3: Vec<(usize, usize, T, T)>

3D bones that keep maximum distance.

§less_bones4: Vec<(usize, usize, T, T)>

4D bones that keep maximum distance.

§more_bones1: Vec<(usize, usize, T, T)>

Scalar bones that keep minimum distance.

§more_bones2: Vec<(usize, usize, T, T)>

2D bones that keep minimum distance.

§more_bones3: Vec<(usize, usize, T, T)>

3D bones that keep minimum distance.

§more_bones4: Vec<(usize, usize, T, T)>

4D bones that keep minimum distance.

§map1: Vec<Point1<T>>

Position map back to document for scalars. Sorted to enable binary search.

§map2: Vec<Point2<T>>

Position map back to document for 2D points. Sorted to enable binary search.

§map3: Vec<Point3<T>>

Position map back to document for 3D points. Sorted to enable binary search.

§map4: Vec<Point4<T>>

Position map back to document for 4D points. Sorted to enable binary search.

Implementations§

Source§

impl<T> Physics<T>

Source

pub fn new( doc: &Reactor<T>, selection: &Selection<T>, env: &mut Environment<T>, ) -> Physics<T>
where T: Float, f64: Cast<T>,

Creates new physics from document.

Source

pub fn simulate(&mut self) -> T
where T: Float, f64: Cast<T>,

Simulates points. Returns a positive number representing the error squared from a satisfied solution.

Source

pub fn commit(&mut self, doc: &mut Reactor<T>)
where T: Copy,

Commit changes to document. Writes data to document and updates previous position.

Auto Trait Implementations§

§

impl<T> Freeze for Physics<T>

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Physics<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> 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.