Struct base::math::AxialVector [] [src]

pub struct AxialVector {
    pub q: AxialType,
    pub r: AxialType,
}

A 2-dimensional vector in axial coordinates. See here for more information.

Fields

q: AxialType r: AxialType

Methods

impl AxialVector
[src]

AxialVector defines a vector specifically for Axial cordinate system.

fn new(q: AxialType, r: AxialType) -> Self

fn to_real(&self) -> Vector2f

Returns the position of the hexagons center in the standard coordinate system using world::{HEX_INNER_RADIUS, HEX_OUTER_RADIUS}.

fn s(&self) -> AxialType

Returns the s component of corresponding cube coordinates. In cube coordinates 'q + r + s = 0', so saving s is redundant and can be calculated on the fly when needed.

fn unit_q() -> AxialVector

unit_q creates an default AxialVector with q:1 r:0.

fn unit_r() -> AxialVector

unit_r creates an default AxialVector with q:0 r:1.

Trait Implementations

impl Hash for AxialVector
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Eq for AxialVector
[src]

impl PartialEq for AxialVector
[src]

fn eq(&self, __arg_0: &AxialVector) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &AxialVector) -> bool

This method tests for !=.

impl Copy for AxialVector
[src]

impl Clone for AxialVector
[src]

fn clone(&self) -> AxialVector

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for AxialVector
[src]

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

Formats the value using the given formatter.

impl Neg for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the - operator

fn neg(self) -> Self::Output

The method for the unary - operator

impl Add<AxialVector> for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the + operator

fn add(self, arg2: AxialVector) -> AxialVector

The method for the + operator

impl AddAssign<AxialVector> for AxialVector
[src]

fn add_assign(&mut self, arg2: AxialVector)

The method for the += operator

impl Sub<AxialVector> for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the - operator

fn sub(self, arg2: AxialVector) -> AxialVector

The method for the - operator

impl SubAssign<AxialVector> for AxialVector
[src]

fn sub_assign(&mut self, arg2: AxialVector)

The method for the -= operator

impl Mul<AxialType> for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the * operator

fn mul(self, arg2: AxialType) -> AxialVector

The method for the * operator

impl MulAssign<AxialType> for AxialVector
[src]

fn mul_assign(&mut self, arg2: AxialType)

The method for the *= operator

impl Div<AxialType> for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the / operator

fn div(self, arg2: AxialType) -> AxialVector

The method for the / operator

impl DivAssign<AxialType> for AxialVector
[src]

fn div_assign(&mut self, arg2: AxialType)

The method for the /= operator

impl Rem<AxialType> for AxialVector
[src]

type Output = AxialVector

The resulting type after applying the % operator

fn rem(self, arg2: AxialType) -> AxialVector

The method for the % operator

impl RemAssign<AxialType> for AxialVector
[src]

fn rem_assign(&mut self, arg2: AxialType)

The method for the %= operator

impl MetricSpace for AxialVector
[src]

type Metric = DefaultFloat

The metric to be returned by the distance function.

fn distance2(self, other: AxialVector) -> DefaultFloat

Returns the squared distance. Read more

fn distance(self, other: Self) -> Self::Metric

The distance between two values.

impl VectorSpace for AxialVector
[src]

type Scalar = AxialType

The associated scalar.

impl Zero for AxialVector
[src]

fn zero() -> AxialVector

Returns the additive identity element of Self, 0. Read more

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.

impl Array for AxialVector
[src]

type Element = AxialType

fn from_value(value: Self::Element) -> Self

Construct a vector from a single value, replicating it. Read more

fn sum(self) -> Self::Element

The sum of the elements of the array.

fn product(self) -> Self::Element

The product of the elements of the array.

fn min(self) -> Self::Element

The minimum element of the array.

fn max(self) -> Self::Element

The maximum element of the array.

fn as_ptr(&self) -> *const Self::Element

Get the pointer to the first element of the array.

fn as_mut_ptr(&mut self) -> *mut Self::Element

Get a mutable pointer to the first element of the array.

fn swap_elements(&mut self, i: usize, j: usize)

Swap the elements at indices i and j in-place.

impl Index<usize> for AxialVector
[src]

type Output = AxialType

The returned type after indexing

fn index(&self, index: usize) -> &Self::Output

The method for the indexing (Foo[Bar]) operation

impl IndexMut<usize> for AxialVector
[src]

fn index_mut(&mut self, index: usize) -> &mut AxialType

The method for the indexing (Foo[Bar]) operation