Skip to content

Class PositionVector

ClassList > PositionVector

Represents a 3D position vector. More...

  • #include <spatial.h>

Inherits the following classes: FixedVector3D

Public Types

Type Name
typedef FixedVector3D< PositionVector > Vec

Public Types inherited from FixedVector3D

See FixedVector3D

Type Name
typedef Vector3D< fixed, Derived > Vec

Public Types inherited from Vector3D

See Vector3D

Type Name
typedef Either< Derived, Vector3D< NumericType > > ClassType
typedef Numeric NumericType

Public Attributes inherited from Vector3D

See Vector3D

Type Name
NumericType X_coord = 0
The X-coordinate of the vector.
NumericType Y_coord = 0
The Y-coordinate of the vector.
NumericType Z_coord = 0
The Z-coordinate of the vector.

Public Static Attributes inherited from Vector3D

See Vector3D

Type Name
constexpr Vector3D< Numeric > Backward = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(0, -1, 0)
constexpr Vector3D< Numeric > Down = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(0, 0, -1)
constexpr Vector3D< Numeric > Forward = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(0, 1, 0)
constexpr Vector3D< Numeric > Left = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(-1, 0, 0)
constexpr Vector3D< Numeric > Right = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(1, 0, 0)
constexpr Vector3D< Numeric > Up = [**Vector3D**](classVector3D.md)&lt;Numeric&gt;(0, 0, 1)
constexpr NumericType rad2DegFactor = NumericType(57.2957795131)

Public Functions

Type Name
fixed Distance ()
Calculates the 2D magnitude (distance) of the vector, caching the result.
fixed Pitch ()
Calculates the pitch of the vector, caching the result.
PositionVector () = default
PositionVector (const PositionVector & other) = default
constexpr PositionVector (fixed x, fixed y, fixed z)
PositionVector (PositionVector p, DistanceVector d)
Constructs a PositionVector by adding aDistanceVector to aPositionVector .
PositionVector (PositionVector p, VelocityVector v, ChronoDuration auto interval)
Constructs a PositionVector by applying aVelocityVector over a time interval to aPositionVector .
fixed Yaw ()
Calculates the yaw of the vector, caching the result.

Public Functions inherited from FixedVector3D

See FixedVector3D

Type Name
fixed angleTo (const VectorCompatible< fixed > auto & other) const
Derived cross (const VectorCompatible< fixed > auto & other) const
fixed dot (const VectorCompatible< fixed > auto & other) const
fixed magnitude () const
fixed magnitudeXY () const
fixed magnitudeXZ () const
fixed magnitudeYZ () const
Derived normalize () const
NumericType pitch () const
NumericType yaw () const

Public Functions inherited from Vector3D

See Vector3D

Type Name
constexpr ClassType FromPolarDegrees (NumericType Pitch, NumericType Yaw, NumericType Radius)
constexpr Vector3D ()
constexpr Vector3D (NumericType initial_X_coord, NumericType initial_Y_coord, NumericType initial_Z_coord)
NumericType angleTo (const VectorCompatible< NumericType > auto & other) const
Computes the angle to another vector.
ClassType cross (const VectorCompatible< NumericType > auto & other) const
Computes the cross product of two vectors.
NumericType dot (const VectorCompatible< NumericType > auto & other) const
Computes the dot product of two vectors.
NumericType magnitude () const
Computes the magnitude (length) of the vector.
NumericType magnitudeXY () const
Computes the magnitude in the XY plane.
NumericType magnitudeXZ () const
Computes the magnitude in the XZ plane.
NumericType magnitudeYZ () const
Computes the magnitude in the YZ plane.
ClassType normalize () const
Computes the normalized vector (unit vector).
operator bool () const
Checks if the vector is non-zero.
constexpr ClassType operator* (const NumericType & scalar) const
Multiplies the vector by a scalar.
ClassType operator+ (const VectorCompatible< NumericType > auto & other) const
Adds two vectors.
ClassType operator- (const VectorCompatible< NumericType > auto & other) const
Subtracts one vector from another.
ClassType operator/ (NumericType scalar) const
Divides the vector by a scalar.
NumericType pitch () const
Computes the pitch angle of the vector.
NumericType yaw () const
Computes the yaw angle of the vector.

Public Static Functions inherited from FixedVector3D

See FixedVector3D

Type Name
fixed integer_sqrt (uint64_t n)

Detailed Description

This class defines a specific point in 3D space and provides methods to calculate pitch, yaw, and distance.

Public Types Documentation

typedef Vec

using PositionVector::Vec =  FixedVector3D<PositionVector>;

Public Functions Documentation

function Distance

Calculates the 2D magnitude (distance) of the vector, caching the result.

inline fixed PositionVector::Distance () 

Returns:

The distance in the XY plane.


function Pitch

Calculates the pitch of the vector, caching the result.

inline fixed PositionVector::Pitch () 

Returns:

The pitch in radians.


function PositionVector [1/5]

PositionVector::PositionVector () = default

function PositionVector [2/5]

PositionVector::PositionVector (
    const PositionVector & other
) = default

function PositionVector [3/5]

constexpr PositionVector::PositionVector (
    fixed x,
    fixed y,
    fixed z
) 

function PositionVector [4/5]

Constructs a PositionVector by adding aDistanceVector to aPositionVector .

inline PositionVector::PositionVector (
    PositionVector p,
    DistanceVector d
) 

Parameters:

  • p The initial position vector.
  • d The distance vector to add.

function PositionVector [5/5]

Constructs a PositionVector by applying aVelocityVector over a time interval to aPositionVector .

inline PositionVector::PositionVector (
    PositionVector p,
    VelocityVector v,
    ChronoDuration auto interval
) 

Parameters:

  • p The initial position vector.
  • v The velocity vector.
  • interval The time interval.

function Yaw

Calculates the yaw of the vector, caching the result.

inline fixed PositionVector::Yaw () 

Returns:

The yaw in radians.



The documentation for this class was generated from the following file spatial.h