Type Alias oxygengine_physics_2d::prelude::math::Force
source · pub type Force<N> = Force2<N>;
Expand description
The force type combining a linear force and a torque.
Aliased Type§
struct Force<N> {
pub linear: Matrix<N, Const<2>, Const<1>, ArrayStorage<N, 2, 1>>,
pub angular: N,
}
Fields§
§linear: Matrix<N, Const<2>, 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 more