levelz-cpp 0.2.0
Loading...
Searching...
No Matches
LevelZ::Coordinate3D Struct Reference

#include <coordinate.hpp>

Inheritance diagram for LevelZ::Coordinate3D:
LevelZ::Coordinate

Public Member Functions

 Coordinate3D ()
 
 Coordinate3D (int x, int y, int z)
 
 Coordinate3D (double x, double y, double z)
 
 Coordinate3D (std::vector< int > xyz)
 
 Coordinate3D (std::array< int, 3 > xyz)
 
 Coordinate3D (std::vector< double > xyz)
 
 Coordinate3D (std::array< double, 3 > xyz)
 
double getMagnitude () const
 
bool operator== (const Coordinate3D &other) const
 
bool operator!= (const Coordinate3D &other) const
 
Coordinate3D operator+ (const Coordinate3D &other) const
 
Coordinate3D operator- (const Coordinate3D &other) const
 
Coordinate3D operator* (int scalar) const
 
Coordinate3D operator/ (int scalar) const
 
std::string to_string () const
 
std::ostream & operator<< (std::ostream &strm)
 
- Public Member Functions inherited from LevelZ::Coordinate

Static Public Member Functions

static Coordinate3D from_string (const std::string &str)
 

Public Attributes

double x
 
double y
 
double z
 

Detailed Description

Represents a 3D coordinate.

Constructor & Destructor Documentation

◆ Coordinate3D() [1/7]

LevelZ::Coordinate3D::Coordinate3D ( )
inline

Initializes a new instance of the Coordinate3D class at [0, 0, 0].

◆ Coordinate3D() [2/7]

LevelZ::Coordinate3D::Coordinate3D ( int x,
int y,
int z )
inline

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xThe X coordinate.
yThe Y coordinate.
zThe Z coordinate.

◆ Coordinate3D() [3/7]

LevelZ::Coordinate3D::Coordinate3D ( double x,
double y,
double z )
inline

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xThe X coordinate.
yThe Y coordinate.
zThe Z coordinate.

◆ Coordinate3D() [4/7]

LevelZ::Coordinate3D::Coordinate3D ( std::vector< int > xyz)
inlineexplicit

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xyzThe X, Y, and Z coordinates in a vector.

◆ Coordinate3D() [5/7]

LevelZ::Coordinate3D::Coordinate3D ( std::array< int, 3 > xyz)
inlineexplicit

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xyzThe X, Y, and Z coordinates in an array.

◆ Coordinate3D() [6/7]

LevelZ::Coordinate3D::Coordinate3D ( std::vector< double > xyz)
inlineexplicit

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xyzThe X, Y, and Z coordinates in a vector.

◆ Coordinate3D() [7/7]

LevelZ::Coordinate3D::Coordinate3D ( std::array< double, 3 > xyz)
inlineexplicit

Initializes a new instance of the Coordinate3D class at the specified coordinates.

Parameters
xyzThe X, Y, and Z coordinates in an array.

Member Function Documentation

◆ from_string()

static Coordinate3D LevelZ::Coordinate3D::from_string ( const std::string & str)
inlinestatic

Converts a string to a 3D coordinate.

Parameters
strThe string to convert.
Returns
Coordinate3D The 3D coordinate.

◆ getMagnitude()

double LevelZ::Coordinate3D::getMagnitude ( ) const
inlinevirtual

Gets the magnitude of the coordinate.

Returns
Coordinate Magnitude

Implements LevelZ::Coordinate.

◆ operator!=()

bool LevelZ::Coordinate3D::operator!= ( const Coordinate3D & other) const
inline

Compares two coordinates for inequality.

Parameters
otherThe other coordinate to compare to.
Returns
True if the coordinates are not equal, false otherwise.

◆ operator*()

Coordinate3D LevelZ::Coordinate3D::operator* ( int scalar) const
inline

Multiplies the coordinate by a scalar.

Parameters
scalarThe scalar to multiply by.
Returns
The product of the coordinate and the scalar.

◆ operator+()

Coordinate3D LevelZ::Coordinate3D::operator+ ( const Coordinate3D & other) const
inline

Adds two coordinates together.

Parameters
otherThe other coordinate to add.
Returns
The sum of the two coordinates.

◆ operator-()

Coordinate3D LevelZ::Coordinate3D::operator- ( const Coordinate3D & other) const
inline

Subtracts one coordinate from another.

Parameters
otherThe other coordinate to subtract.
Returns
The difference of the two coordinates.

◆ operator/()

Coordinate3D LevelZ::Coordinate3D::operator/ ( int scalar) const
inline

Divides the coordinate by a scalar.

Parameters
scalarThe scalar to divide by.
Returns
The quotient of the coordinate and the scalar.

◆ operator<<()

std::ostream & LevelZ::Coordinate3D::operator<< ( std::ostream & strm)
inline

Overloads the << operator to allow for easy printing of a Coordinate3D.

Parameters
strmThe output stream to write to.
Returns
The output stream.

◆ operator==()

bool LevelZ::Coordinate3D::operator== ( const Coordinate3D & other) const
inline

Compares two coordinates for equality.

Parameters
otherThe other coordinate to compare to.
Returns
True if the coordinates are equal, false otherwise.

◆ to_string()

std::string LevelZ::Coordinate3D::to_string ( ) const
inlinevirtual

Converts this 3D coordinate to a string.

Returns
The string representation of the coordinate.

Implements LevelZ::Coordinate.

Member Data Documentation

◆ x

double LevelZ::Coordinate3D::x

The X coordinate.

◆ y

double LevelZ::Coordinate3D::y

The Y coordinate.

◆ z

double LevelZ::Coordinate3D::z

The Z coordinate.


The documentation for this struct was generated from the following file: