Struct arcdps::evtc::position::Position

source ·
pub struct Position {
    pub x: f32,
    pub y: f32,
    pub z: f32,
}
Expand description

Positional information.

This can be from an Event with StateChange::Position, StateChange::Velocity or StateChange::Facing. It can also occur in StateChange::Effect and StateChange::EffectOld events as effect location or orientation.

Ingame coordinates are interpreted as 1 unit = 1 inch. The z-axis represents vertical height and points down, meaning lower values are a higher location ingame.

Mumble coordinates are given in meters. The y-axis represents vertical height and points up.

Fields§

§x: f32§y: f32§z: f32

Implementations§

source§

impl Position

source

pub const INCH_TO_METER: f32 = 0.0253999997f32

Conversion from inch to meter.

source

pub const fn new(x: f32, y: f32, z: f32) -> Position

Creates new positional information.

source

pub fn from_mumble(coords: [f32; 3]) -> Position

Creates a position from Mumble coordinates.

source

pub fn to_array(self) -> [f32; 3]

Converts the position to an array.

source

pub fn to_tuple(self) -> (f32, f32, f32)

Converts the position to a tuple.

source

pub fn to_mumble(&self) -> [f32; 3]

Converts the position to Mumble coordinates.

source

pub fn len(&self) -> f32

Returns the length of the position interpreted as vector.

source

pub fn mat_mul(&self, matrix: [[f32; 3]; 3]) -> Position

Interprets the position as vector and multiplies it with the given matrix.

source

pub fn as_rotation_matrix(&self) -> [[f32; 3]; 3]

Interprets the position as rotation angles and converts it to a rotation matrix.

x, y and z are interpreted as angles around each axis in radians.

source

pub fn rotate(&self, vector: Position) -> Position

Interprets the position as rotation angles and rotates the given vector.

Trait Implementations§

source§

impl Add for &Position

§

type Output = Position

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Position) -> <&Position as Add>::Output

Performs the + operation. Read more
source§

impl AddAssign for Position

source§

fn add_assign(&mut self, rhs: Position)

Performs the += operation. Read more
source§

impl Clone for Position

source§

fn clone(&self) -> Position

Returns a copy 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 Debug for Position

source§

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

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

impl<'de> Deserialize<'de> for Position

source§

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

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

impl Div<f32> for &Position

§

type Output = Position

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> <&Position as Div<f32>>::Output

Performs the / operation. Read more
source§

impl DivAssign<f32> for Position

source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
source§

impl Extract for Position

source§

unsafe fn extract(event: &Event) -> Position

Extracts Self from the combat event. Read more
source§

impl From<[f32; 3]> for Position

source§

fn from(value: [f32; 3]) -> Position

Converts to this type from the input type.
source§

impl From<(f32, f32, f32)> for Position

source§

fn from(value: (f32, f32, f32)) -> Position

Converts to this type from the input type.
source§

impl From<EffectOrientation> for Position

source§

fn from(orientation: EffectOrientation) -> Position

Converts to this type from the input type.
source§

impl Mul<f32> for &Position

§

type Output = Position

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> <&Position as Mul<f32>>::Output

Performs the * operation. Read more
source§

impl MulAssign<f32> for Position

source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
source§

impl PartialEq for Position

source§

fn eq(&self, other: &Position) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Position

source§

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

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

impl Sub for &Position

§

type Output = Position

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Position) -> <&Position as Sub>::Output

Performs the - operation. Read more
source§

impl SubAssign for Position

source§

fn sub_assign(&mut self, rhs: Position)

Performs the -= operation. Read more
source§

impl StructuralPartialEq for Position

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

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

§

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

§

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.
source§

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