About
The vector classes of the MAXON API are based on these generic vector templates:
For basic data types see Basic Data Types.
Classes
Two Component Vectors
Two-component vectors contain these members:
maxon::Float based vector classes are:
maxon::Int based vector classes are:
Three Component Vectors
Three-component vectors contain these members:
maxon::Float based vector classes are:
maxon::Int based vector classes are:
Four Component Vectors
Four-component vectors contain these members:
maxon::Float based vector classes are:
maxon::Int based vector classes are:
Data
A member of a vector can be simply accessed directly or by using the "[]" operator:
vecA[0] = 1.0;
vecA[1] = 2.0;
vecA[2] = 3.0;
The length or a vector can be calculated with:
else
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
constexpr T GetSquaredLength() const
Returns the squared length of the vector.
Definition: vec.h:466
If all components of a given vector are zero, it can be checked with:
if (!vec.IsZero())
vec.SetZero();
The sum of all vector components is calculated with:
Float64 Float
Definition: apibase.h:197
A vector consisting of four components X, Y, Z and W.
Definition: vec4.h:21
The vector values can further be edited with:
Further values are accessed with:
const char Py_ssize_t const char Py_ssize_t Py_ssize_t max
Definition: modsupport.h:59
const char Py_ssize_t const char Py_ssize_t min
Definition: modsupport.h:58
A subset of the vector can be obtained with:
Assignment
A vector can be constructed and changed with the following operators:
void Py_ssize_t * pos
Definition: dictobject.h:50
Comparison
Two vectors can be compared with:
{
}
PyObject Py_hash_t hash
Definition: dictobject.h:35
UInt64 UInt
unsigned 32/64 bit int, size depends on the platform
Definition: apibase.h:189
BoolType IsEqual(const Vec3 &other, ValueTypeParam epsilon) const
Tests component-wise if the difference is no bigger than 'epsilon'.
Definition: vec.h:352
constexpr HashInt GetHashCode() const
Definition: vec.h:336
Mathematical Functions
Vector related mathematical functions are:
- GetAngle(): Calculates the angle between the given vectors.
- Cross(): Calculates the cross product.
- Dot(): Calculates the dot product.
- Note
- For more complex vector operations like intersections see Geometry Utility Manual.
Colors
For vectors defining a color value the explicit class maxon::Color exists:
Utility
Further utility functions are:
- maxon::ReflectRay(): Calculates the reflection vector for the given vector to the given normal.
Color specific utility functions are:
DiagnosticOutput(
"Color @, Brightness @, Dark @", colorBlend, brightness, dark);
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:181
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsColorPerceivedAsDark(const ColorA &color)
Definition: vector4d.h:241
MAXON_ATTRIBUTE_FORCE_INLINE Float GetPerceivedBrightness(const ColorA &color)
Definition: vector4d.h:229
MAXON_ATTRIBUTE_FORCE_INLINE COLORTYPE BlendColor(const COLORTYPE &col1, const COLORTYPE &col2, const typename COLORTYPE::ValueType blendValue)
Definition: vector4d.h:212
A color consisting of three components R, G, B and an alpha.
Definition: col4.h:16
Further Reading