Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
jm::Vertex3 Class Reference

A three dimensional vector. Owns special functions for 3D space. More...

Public Member Functions

 Vertex3 (double x=0, double y=0, double z=0) noexcept
 Constructor for arbitrary vector.
 
 Vertex3 (const Vertex2 &xy, double z=0) noexcept
 Constructor for arbitrary vector.
 
 Vertex3 (const Vertex3 &another) noexcept=default
 Copy constructor.
 
Vertex3 crossProduct (const Vertex3 &another) const
 Calculates the cross-product of this vector with the other.
 
double dotProduct (const Vertex3 &another) const
 Calculates the dot product of this vector with another vector. The dot product is defined as the sum of the products of the corresponding components of the two vectors.
 
bool isCollinear (const Vertex3 &another) const
 This method checks whether the two vectors are collinear. Two vectors are collinear if they are parallel to each other.
 
bool isOrthogonal (const Vertex3 &another) const
 This method calculates whether the two vectors are orthogonal. Two vectors are orthogonal if they are perpendicular to each other.
 
bool isNull () const
 This method checks if the vector is the zero vector (taking into account RESABS).
 
bool isValid () const
 This method checks if the vector has any "NaN" entries. If all entries are defined, it returns true.
 
double angleTo (const Vertex3 &another) const
 Returns the angle between this vector and another vector.
 
double abs () const
 This method returns the absolute value of the vector. The absolute value is equal to the length.
 
void rotateX (double angle)
 Rotates the vector around the X-axis by the specified angle.
 
void rotateY (double angle)
 Rotates the vector around the Y-axis by the specified angle.
 
void rotateZ (double angle)
 Rotates the vector around the Z-axis by the specified angle.
 
Vertex3 rotatedZ (double angle) const
 Rotates the vector around the Z-axis by the specified angle and returns the result.
 
void rotate (double angle, const Vertex3 &axis)
 Rotates the vector around the given axis by the specified angle.
 
Vertex3normalize ()
 This method normalizes the vector. A normalized vector has a length of 1 and the reference to this vector is returned.
 
Vertex3 normalized () const
 This method returns a normalized vector. A normalized vector has a length of 1. This vector is not changed in the process.
 
Vertex3 scale (const Vertex3 &another) const
 This method multiplies this vector line by line with the other vector.
 
double biggest () const
 This method returns the largest component of x,y,z from this vector.
 
Vertex3operator+= (const Vertex3 &v)
 Implementation of the operator +=.
 
Vertex3operator-= (const Vertex3 &v)
 Implementation of the operator -=.
 
Vertex3 operator/ (double b) const
 Implementation of the operator /.
 
Vertex3 operator+ (const Vertex3 &v1) const
 Implementation of the operator +.
 
Vertex3 operator- (const Vertex3 &v1) const
 Implementation of the operator -.
 
Vertex3operator= (const Vertex3 &another)
 

Public Attributes

double x = 0.0
 X component of vector.
 
double y = 0.0
 Y component of vector.
 
double z = 0.0
 Z component of vector.
 

Friends

DllExport friend std::ostream & operator<< (std::ostream &out, const Vertex3 &vertex)
 Implementation of the operator <<.
 
DllExport friend Stringoperator<< (String &out, const Vertex3 &vertex)
 Implementation of the operator <<.
 

Detailed Description

A three dimensional vector. Owns special functions for 3D space.

Constructor & Destructor Documentation

◆ Vertex3() [1/3]

jm::Vertex3::Vertex3 ( double  x = 0,
double  y = 0,
double  z = 0 
)
explicitnoexcept

Constructor for arbitrary vector.

Parameters
xX component of vector
yY component of vector
zZ component of vector

◆ Vertex3() [2/3]

jm::Vertex3::Vertex3 ( const Vertex2 xy,
double  z = 0 
)
explicitnoexcept

Constructor for arbitrary vector.

Parameters
xy2D Vector with x and y component.
zZ component of vector

◆ Vertex3() [3/3]

jm::Vertex3::Vertex3 ( const Vertex3 another)
defaultnoexcept

Copy constructor.

Parameters
anotherThe other vector

Member Function Documentation

◆ abs()

double jm::Vertex3::abs ( ) const

This method returns the absolute value of the vector. The absolute value is equal to the length.

◆ angleTo()

double jm::Vertex3::angleTo ( const Vertex3 another) const

Returns the angle between this vector and another vector.

Parameters
anotherThe vector we want to know the angle to.
Returns
Angle in radians.

◆ biggest()

double jm::Vertex3::biggest ( ) const

This method returns the largest component of x,y,z from this vector.

◆ crossProduct()

Vertex3 jm::Vertex3::crossProduct ( const Vertex3 another) const

Calculates the cross-product of this vector with the other.

Parameters
anotherThe other vector.
Returns
The result of "this x another".

◆ dotProduct()

double jm::Vertex3::dotProduct ( const Vertex3 another) const

Calculates the dot product of this vector with another vector. The dot product is defined as the sum of the products of the corresponding components of the two vectors.

  • If the dot product is 0, then the two vectors are orthogonal (perpendicular) to each other.
  • If the dot product is > 0, then the included angle between the two vectors is acute.
  • If the dot product is < 0, then the included angle between the two vectors is obtuse.
  • For normalized vectors, the dot product is equal to the projection of one vector onto the other.
    Parameters
    anotherThe other vector.
    Returns
    The result of "this dot another".

◆ isCollinear()

bool jm::Vertex3::isCollinear ( const Vertex3 another) const

This method checks whether the two vectors are collinear. Two vectors are collinear if they are parallel to each other.

Parameters
anotherThe other vector.
Returns
true if the vectors are collinear.

◆ isNull()

bool jm::Vertex3::isNull ( ) const

This method checks if the vector is the zero vector (taking into account RESABS).

Returns
true if the vector is the zero vector.

◆ isOrthogonal()

bool jm::Vertex3::isOrthogonal ( const Vertex3 another) const

This method calculates whether the two vectors are orthogonal. Two vectors are orthogonal if they are perpendicular to each other.

Parameters
anotherThe other vector.
Returns
true if the vectors are orthogonal.

◆ isValid()

bool jm::Vertex3::isValid ( ) const

This method checks if the vector has any "NaN" entries. If all entries are defined, it returns true.

Returns
true if all entries are defined, false if any entry is "NaN".

◆ normalize()

Vertex3 & jm::Vertex3::normalize ( )

This method normalizes the vector. A normalized vector has a length of 1 and the reference to this vector is returned.

Returns
Reference to this vector after normalization.
Note
If this vector has a length close to 0, it is returned unchanged.

◆ normalized()

Vertex3 jm::Vertex3::normalized ( ) const

This method returns a normalized vector. A normalized vector has a length of 1. This vector is not changed in the process.

Returns
The normalized vector.
Note
If this vector has a length close to 0, it is returned unchanged.

◆ operator+()

Vertex3 jm::Vertex3::operator+ ( const Vertex3 v1) const

Implementation of the operator +.

◆ operator+=()

Vertex3 & jm::Vertex3::operator+= ( const Vertex3 v)

Implementation of the operator +=.

◆ operator-()

Vertex3 jm::Vertex3::operator- ( const Vertex3 v1) const

Implementation of the operator -.

◆ operator-=()

Vertex3 & jm::Vertex3::operator-= ( const Vertex3 v)

Implementation of the operator -=.

◆ operator/()

Vertex3 jm::Vertex3::operator/ ( double  b) const

Implementation of the operator /.

◆ operator=()

Vertex3 & jm::Vertex3::operator= ( const Vertex3 another)

◆ rotate()

void jm::Vertex3::rotate ( double  angle,
const Vertex3 axis 
)

Rotates the vector around the given axis by the specified angle.

Parameters
angleThe rotation angle in radians.
axisThe rotation axis.

◆ rotatedZ()

Vertex3 jm::Vertex3::rotatedZ ( double  angle) const

Rotates the vector around the Z-axis by the specified angle and returns the result.

Parameters
angleThe rotation angle in radians.

◆ rotateX()

void jm::Vertex3::rotateX ( double  angle)

Rotates the vector around the X-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ rotateY()

void jm::Vertex3::rotateY ( double  angle)

Rotates the vector around the Y-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ rotateZ()

void jm::Vertex3::rotateZ ( double  angle)

Rotates the vector around the Z-axis by the specified angle.

Parameters
angleThe rotation angle in radians.

◆ scale()

Vertex3 jm::Vertex3::scale ( const Vertex3 another) const

This method multiplies this vector line by line with the other vector.

Returns
Returns the result of the calculation. This vector remains unchanged.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

DllExport friend std::ostream & operator<< ( std::ostream &  out,
const Vertex3 vertex 
)
friend

Implementation of the operator <<.

◆ operator<< [2/2]

DllExport friend String & operator<< ( String out,
const Vertex3 vertex 
)
friend

Implementation of the operator <<.

Member Data Documentation

◆ x

double jm::Vertex3::x = 0.0

X component of vector.

Note
We need fast access to this value and other protection measures are not necessary. So we leave it public.

◆ y

double jm::Vertex3::y = 0.0

Y component of vector.

Note
We need fast access to this value and other protection measures are not necessary. So we leave it public.

◆ z

double jm::Vertex3::z = 0.0

Z component of vector.

Note
We need fast access to this value and other protection measures are not necessary. So we leave it public.