Struct oxygengine_physics_2d::prelude::algebra::Force2
source · #[repr(C)]pub struct Force2<N>where
N: RealField + Copy,{
pub linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
pub angular: N,
}
Expand description
A force with a linear and angular (torque) component.
Fields§
§linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
The linear force.
angular: N
The torque.
Implementations§
source§impl<N> Force2<N>where
N: RealField + Copy,
impl<N> Force2<N>where N: RealField + Copy,
sourcepub fn new(
linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
angular: N
) -> Force2<N>
pub fn new( linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, angular: N ) -> Force2<N>
Creates a force from its linear and angular components.
sourcepub fn from_slice(data: &[N]) -> Force2<N>
pub fn from_slice(data: &[N]) -> Force2<N>
Create a force from a slice where the entries 0 and 1 are for the linear part and 2 for the angular part.
sourcepub fn from_vector<S>(
data: &Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, S>
) -> Force2<N>where
S: Storage<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>>,
pub fn from_vector<S>( data: &Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, S> ) -> Force2<N>where S: Storage<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>>,
Create a force from a vector where the entries 0 and 1 are for the linear part and 2 for the angular part.
sourcepub fn from_vectors(
linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
angular: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
) -> Force2<N>
pub fn from_vectors( linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, angular: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>> ) -> Force2<N>
Creates a force from its linear and angular components, both in vector form.
sourcepub fn torque_from_vector(
torque: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
) -> Force2<N>
pub fn torque_from_vector( torque: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>> ) -> Force2<N>
Create a pure torque.
sourcepub fn linear(
linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
) -> Force2<N>
pub fn linear( linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> Force2<N>
Create a pure linear force.
sourcepub fn linear_at_point(
linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
point: &OPoint<N, Const<2>>
) -> Force2<N>
pub fn linear_at_point( linear: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>> ) -> Force2<N>
Creates the resultant of a linear force applied at the given point (relative to the center of mass).
sourcepub fn torque_at_point(torque: N, point: &OPoint<N, Const<2>>) -> Force2<N>
pub fn torque_at_point(torque: N, point: &OPoint<N, Const<2>>) -> Force2<N>
Creates the resultant of a torque applied at the given point (relative to the center of mass).
sourcepub fn torque_from_vector_at_point(
torque: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>,
point: &OPoint<N, Const<2>>
) -> Force2<N>
pub fn torque_from_vector_at_point( torque: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>, point: &OPoint<N, Const<2>> ) -> Force2<N>
Creates the resultant of a torque applied at the given point (relative to the center of mass).
sourcepub fn angular_vector(
&self
) -> Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
pub fn angular_vector( &self ) -> Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
The angular part of the force.
sourcepub fn transform_by(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> Force2<N>
pub fn transform_by(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> Force2<N>
Apply the given transformation to this force.
sourcepub fn as_slice(&self) -> &[N]
pub fn as_slice(&self) -> &[N]
This force seen as a slice.
The two first entries contain the linear part and the third entry contais the angular part.
sourcepub fn as_vector(
&self
) -> &Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, ArrayStorage<N, 3, 1>>
pub fn as_vector( &self ) -> &Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, ArrayStorage<N, 3, 1>>
This force seen as a vector.
The two first entries contain the linear part and the third entry contais the angular part.
sourcepub fn as_vector_mut(
&mut self
) -> &mut Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, ArrayStorage<N, 3, 1>>
pub fn as_vector_mut( &mut self ) -> &mut Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<1>, ArrayStorage<N, 3, 1>>
This force seen as a mutable vector.
The two first entries contain the linear part and the third entry contais the angular part.
Trait Implementations§
source§impl<N> AddAssign<Force2<N>> for Force2<N>where
N: RealField + Copy,
impl<N> AddAssign<Force2<N>> for Force2<N>where N: RealField + Copy,
source§fn add_assign(&mut self, rhs: Force2<N>)
fn add_assign(&mut self, rhs: Force2<N>)
+=
operation. Read moresource§impl<N> SubAssign<Force2<N>> for Force2<N>where
N: RealField + Copy,
impl<N> SubAssign<Force2<N>> for Force2<N>where N: RealField + Copy,
source§fn sub_assign(&mut self, rhs: Force2<N>)
fn sub_assign(&mut self, rhs: Force2<N>)
-=
operation. Read moreimpl<N> Copy for Force2<N>where N: Copy + RealField,
Auto Trait Implementations§
impl<N> RefUnwindSafe for Force2<N>where N: RefUnwindSafe,
impl<N> Send for Force2<N>
impl<N> Sync for Force2<N>
impl<N> Unpin for Force2<N>where N: Unpin,
impl<N> UnwindSafe for Force2<N>where N: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.