OrientedPoint

Struct OrientedPoint 

Source
pub struct OrientedPoint<V, R> {
    pub position: V,
    pub orientation: R,
}
Expand description

The position and orientation of an extended body.

Use OrientedPoint as a Body or Site property type.

§Example

use hoomd_microstate::property::OrientedPoint;
use hoomd_vector::{Angle, Cartesian};

let point = OrientedPoint {
    position: Cartesian::from([1.0, -3.0]),
    orientation: Angle::from(1.2),
};

Fields§

§position: V

The location of the extended body in space.

§orientation: R

Rotate from the body’s reference frame into another frame.

Trait Implementations§

Source§

impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<2>, Angle>, X, Periodic<Hypercuboid<2>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<2>, Angle>, X, Periodic<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<3>, Versor>, X, Periodic<Hypercuboid<3>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<3>, Versor>, X, Periodic<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<V: Clone, R: Clone> Clone for OrientedPoint<V, R>

Source§

fn clone(&self) -> OrientedPoint<V, R>

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<V: Debug, R: Debug> Debug for OrientedPoint<V, R>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<V: Default, R: Default> Default for OrientedPoint<V, R>

Source§

fn default() -> OrientedPoint<V, R>

Returns the “default value” for a type. Read more
Source§

impl<'de, V, R> Deserialize<'de> for OrientedPoint<V, R>
where V: Deserialize<'de>, R: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<V, R> Orientation for OrientedPoint<V, R>

Source§

type Rotation = R

Type that can express the orientation of a body or site.
Source§

fn orientation(&self) -> &R

The orientation of this body or site.
Source§

fn orientation_mut(&mut self) -> &mut R

The orientation of this body or site (mutable).
Source§

impl<V: PartialEq, R: PartialEq> PartialEq for OrientedPoint<V, R>

Source§

fn eq(&self, other: &OrientedPoint<V, R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P, R> Position for OrientedPoint<P, R>

Source§

type Position = P

Every position is located in this vector space.
Source§

fn position(&self) -> &P

The position of this body or site [length].
Source§

fn position_mut(&mut self) -> &mut P

The mutable position of this body or site [length].
Source§

impl<V, R> Serialize for OrientedPoint<V, R>
where V: Serialize, R: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<V, R> Transform<OrientedPoint<V, R>> for OrientedPoint<V, R>
where V: Vector, R: Rotate<V> + Rotation,

Treat OrientedPoint sites as constituents of oriented rigid bodies.

Source§

fn transform( &self, site_properties: &OrientedPoint<V, R>, ) -> OrientedPoint<V, R>

Move Point properties from the local body frame to the system frame.

\vec{r} = \vec{r}_\mathrm{body} + R_\mathrm{body}(\vec{r}_\mathrm{site})
R = R_\mathrm{body}(R_\mathrm{site})
use approxim::assert_relative_eq;
use hoomd_microstate::{Transform, property::OrientedPoint};
use hoomd_vector::{Angle, Cartesian};
use std::f64::consts::PI;

let body_properties = OrientedPoint {
    position: Cartesian::from([1.0, -2.0]),
    orientation: Angle::from(PI / 2.0),
};
let site_properties = OrientedPoint {
    position: Cartesian::from([-1.0, 0.0]),
    orientation: Angle::from(PI / 4.0),
};

let system_site = body_properties.transform(&site_properties);
assert_relative_eq!(system_site.position, [1.0, -3.0].into());
assert_relative_eq!(system_site.orientation.theta, 3.0 * PI / 4.0);
Source§

impl<V, R> Transform<Point<V>> for OrientedPoint<V, R>
where V: Vector, R: Rotate<V>,

Treat Point sites as constituents of oriented rigid bodies.

Source§

fn transform(&self, site_properties: &Point<V>) -> Point<V>

Move Point properties from the local body frame to the system frame.

\vec{r} = \vec{r}_\mathrm{body} + R_\mathrm{body}(\vec{r}_\mathrm{site})
use approxim::assert_relative_eq;
use hoomd_microstate::{
    Transform,
    property::{OrientedPoint, Point},
};
use hoomd_vector::{Angle, Cartesian};
use std::f64::consts::PI;

let body_properties = OrientedPoint {
    position: Cartesian::from([1.0, -2.0]),
    orientation: Angle::from(PI / 2.0),
};
let site_properties = Point::new(Cartesian::from([-1.0, 0.0]));

let system_site = body_properties.transform(&site_properties);
assert_relative_eq!(system_site.position, [1.0, -3.0].into());
Source§

impl<V: Copy, R: Copy> Copy for OrientedPoint<V, R>

Source§

impl<V, R> StructuralPartialEq for OrientedPoint<V, R>

Auto Trait Implementations§

§

impl<V, R> Freeze for OrientedPoint<V, R>
where V: Freeze, R: Freeze,

§

impl<V, R> RefUnwindSafe for OrientedPoint<V, R>

§

impl<V, R> Send for OrientedPoint<V, R>
where V: Send, R: Send,

§

impl<V, R> Sync for OrientedPoint<V, R>
where V: Sync, R: Sync,

§

impl<V, R> Unpin for OrientedPoint<V, R>
where V: Unpin, R: Unpin,

§

impl<V, R> UnwindSafe for OrientedPoint<V, R>
where V: UnwindSafe, R: 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,