A class representing a point in 3D space.
More...
#include <OficinaTypes.hpp>
|
static vec3 | Zero () |
| Returns a vec3 with both coordinates having the value 0.0f. More...
|
|
static vec3 | One () |
| Returns a vec3 with both coordinates having the value 1.0f. More...
|
|
static vec3 | Up () |
| Returns a vec3 with coordinates indicating the Up direction. More...
|
|
static vec3 | Down () |
| Returns a vec3 with coordinates indicating the Down direction. More...
|
|
static vec3 | Left () |
| Returns a vec3 with coordinates indicating the Left direction. More...
|
|
static vec3 | Right () |
| Returns a vec3 with coordinates indicating the Right direction. More...
|
|
static vec3 | Front () |
| Returns a vec3 with coordinates indicating the Front direction. More...
|
|
static vec3 | Back () |
| Returns a vec3 with coordinates indicating the Back direction. More...
|
|
static float | distance (vec3 first, vec3 second) |
| Calculates the distance between two vectors. More...
|
|
static float | squareDistance (vec3 first, vec3 second) |
| Calculates the square distance between two vectors. Useful if you don't want the Square Root operation to be executed on the value for performance reasons. More...
|
|
|
union { |
struct { |
float x |
| X coordinate of point. More...
|
|
float y |
| Y coordinate of point. More...
|
|
float z |
| Z coordinate of point. More...
|
|
} | |
|
struct { |
float v [3] |
| Array of coordinates of the point. More...
|
|
} | |
|
}; | |
|
A class representing a point in 3D space.
◆ vec3() [1/3]
Constructs class with null values.
◆ vec3() [2/3]
Constructs class with two equal values.
- Parameters
-
n | Value to be given to coordinates. |
◆ vec3() [3/3]
vec3::vec3 |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z |
|
) |
| |
Constructs class with two values.
- Parameters
-
X | Value to be given to x coordinate. |
Y | Value to be given to y coordinate. |
Z | Value to be given to y coordinate. |
◆ Back()
static vec3 vec3::Back |
( |
| ) |
|
|
static |
Returns a vec3 with coordinates indicating the Back direction.
- Returns
- A back-facing vec3.
◆ clamp()
void vec3::clamp |
( |
vec3 |
origin, |
|
|
vec3 |
end |
|
) |
| |
Encloses this vector inside a box, with its edges described by two other vectors.
- Parameters
-
origin | Minimum values for the vector. |
end | Maximum values for the vector. |
- Warning
- In case a single coordinate of origin is bigger than end's, the vector will not be clamped on that coordinate.
◆ distance()
static float vec3::distance |
( |
vec3 |
first, |
|
|
vec3 |
second |
|
) |
| |
|
static |
Calculates the distance between two vectors.
- Parameters
-
first | First vector. |
second | Second vector. |
- Returns
- Distance value between the two desired points.
◆ Down()
static vec3 vec3::Down |
( |
| ) |
|
|
static |
Returns a vec3 with coordinates indicating the Down direction.
- Returns
- A down-facing vec3.
◆ Front()
static vec3 vec3::Front |
( |
| ) |
|
|
static |
Returns a vec3 with coordinates indicating the Front direction.
- Returns
- A front-facing vec3.
◆ getNormalized()
vec3 vec3::getNormalized |
( |
| ) |
|
Gets a normalized version of this vector.
- Returns
- A normalized vector.
◆ getTruncated()
vec3 vec3::getTruncated |
( |
| ) |
|
Returns a copy of this vec3 truncated to the nearest integer.
- Returns
- The truncated vec3 of this.
◆ Left()
static vec3 vec3::Left |
( |
| ) |
|
|
static |
Returns a vec3 with coordinates indicating the Left direction.
- Returns
- A left-facing vec3.
◆ length()
Gets the magnitude (length) of this vector.
- Returns
- The magnitude of this vector.
◆ normalize()
◆ One()
static vec3 vec3::One |
( |
| ) |
|
|
static |
Returns a vec3 with both coordinates having the value 1.0f.
- Returns
- An unitary-value vec3.
◆ operator!=() [1/2]
bool vec3::operator!= |
( |
const vec3 |
| ) |
|
◆ operator!=() [2/2]
bool vec3::operator!= |
( |
const float |
| ) |
|
◆ operator*() [1/2]
const vec3 vec3::operator* |
( |
const vec3 |
| ) |
|
◆ operator*() [2/2]
const vec3 vec3::operator* |
( |
const float |
| ) |
|
◆ operator*=() [1/2]
◆ operator*=() [2/2]
vec3& vec3::operator*= |
( |
const float |
| ) |
|
◆ operator+() [1/2]
const vec3 vec3::operator+ |
( |
const vec3 |
| ) |
|
◆ operator+() [2/2]
const vec3 vec3::operator+ |
( |
const float |
| ) |
|
◆ operator+=() [1/2]
◆ operator+=() [2/2]
vec3& vec3::operator+= |
( |
const float |
| ) |
|
◆ operator-() [1/2]
const vec3 vec3::operator- |
( |
const vec3 |
| ) |
|
◆ operator-() [2/2]
const vec3 vec3::operator- |
( |
const float |
| ) |
|
◆ operator-=() [1/2]
◆ operator-=() [2/2]
vec3& vec3::operator-= |
( |
const float |
| ) |
|
◆ operator/() [1/2]
const vec3 vec3::operator/ |
( |
const vec3 |
| ) |
|
◆ operator/() [2/2]
const vec3 vec3::operator/ |
( |
const float |
| ) |
|
◆ operator/=() [1/2]
◆ operator/=() [2/2]
vec3& vec3::operator/= |
( |
const float |
| ) |
|
◆ operator<() [1/2]
bool vec3::operator< |
( |
const vec3 |
| ) |
|
◆ operator<() [2/2]
bool vec3::operator< |
( |
const float |
| ) |
|
◆ operator<=() [1/2]
bool vec3::operator<= |
( |
const vec3 |
| ) |
|
◆ operator<=() [2/2]
bool vec3::operator<= |
( |
const float |
| ) |
|
◆ operator=() [1/2]
◆ operator=() [2/2]
vec3& vec3::operator= |
( |
const float |
| ) |
|
◆ operator==() [1/2]
bool vec3::operator== |
( |
const vec3 |
| ) |
|
◆ operator==() [2/2]
bool vec3::operator== |
( |
const float |
| ) |
|
◆ operator>() [1/2]
bool vec3::operator> |
( |
const vec3 |
| ) |
|
◆ operator>() [2/2]
bool vec3::operator> |
( |
const float |
| ) |
|
◆ operator>=() [1/2]
bool vec3::operator>= |
( |
const vec3 |
| ) |
|
◆ operator>=() [2/2]
bool vec3::operator>= |
( |
const float |
| ) |
|
◆ Right()
static vec3 vec3::Right |
( |
| ) |
|
|
static |
Returns a vec3 with coordinates indicating the Right direction.
- Returns
- A right-facing vec3.
◆ squareDistance()
static float vec3::squareDistance |
( |
vec3 |
first, |
|
|
vec3 |
second |
|
) |
| |
|
static |
Calculates the square distance between two vectors. Useful if you don't want the Square Root operation to be executed on the value for performance reasons.
- Parameters
-
first | First vector. |
second | Second vector. |
- Returns
- Square distance value between the two desired points.
◆ toString()
std::string vec3::toString |
( |
| ) |
|
Getsa string with the vec3 values.
- Returns
- Values inside vec3, in format {x, y}.
◆ truncate()
Truncates the coordinates of this.
◆ Up()
Returns a vec3 with coordinates indicating the Up direction.
- Returns
- An up-facing vec3.
◆ Zero()
static vec3 vec3::Zero |
( |
| ) |
|
|
static |
Returns a vec3 with both coordinates having the value 0.0f.
- Returns
- A null-values vec3.
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
oss, |
|
|
const vec3 & |
v |
|
) |
| |
|
friend |
◆ @13
Array of coordinates of the point.
The documentation for this class was generated from the following file: