2D vector. More...
#include <kanzi/core/cpp/math.hpp>
#include <kanzi/core/legacy/kzs_types.hpp>
#include <kanzi/core/legacy/util/math/kzc_vector3.hpp>
#include <kanzi/core/legacy/wrappers/kzs_math.hpp>
Classes | |
struct | KzcVector2 |
Structure of 2D vector. More... | |
Functions | |
KZ_INLINE struct KzcVector2 | kzcVector2 (kzFloat x, kzFloat y) |
Creates a 2D vector. More... | |
KZ_INLINE kzFloat | kzcVector2GetX (const struct KzcVector2 *vector) |
Gets the X component of a 2D vector. More... | |
KZ_INLINE kzFloat | kzcVector2GetY (const struct KzcVector2 *vector) |
Gets the Y component of a 2D vector. More... | |
KZ_INLINE kzFloat * | kzcVector2GetComponents (struct KzcVector2 *vector) |
Gets the underlying component array of a 2D vector. More... | |
KZ_INLINE void | kzcVector2Set (struct KzcVector2 *vector, kzFloat x, kzFloat y) |
Sets all components for 2D vector. More... | |
KZ_INLINE void | kzcVector2SetX (struct KzcVector2 *vector, kzFloat x) |
Sets X component for 2D vector. More... | |
KZ_INLINE void | kzcVector2SetY (struct KzcVector2 *vector, kzFloat y) |
Sets Y component for 2D vector. More... | |
KZ_INLINE void | kzcVector2Add (const struct KzcVector2 *first, const struct KzcVector2 *second, struct KzcVector2 *targetVector) |
Adds two 2D vectors. More... | |
KZ_INLINE void | kzcVector2Subtract (const struct KzcVector2 *first, const struct KzcVector2 *second, struct KzcVector2 *targetVector) |
Subtracts two 2D vectors. More... | |
KZ_INLINE void | kzcVector2ComponentMultiply (const struct KzcVector2 *first, const struct KzcVector2 *second, struct KzcVector2 *targetVector) |
Component-multiplies two 2D vectors. More... | |
KZ_INLINE void | kzcVector2ComponentDivide (const struct KzcVector2 *first, const struct KzcVector2 *second, struct KzcVector2 *targetVector) |
Component-divides two 2D vectors. More... | |
KZ_INLINE void | kzcVector2ComponentModulo (const struct KzcVector2 *first, const struct KzcVector2 *second, struct KzcVector2 *targetVector) |
Component-modulo of two 2D vectors. More... | |
KZ_INLINE void | kzcVector2ComponentAbs (const struct KzcVector2 *vector, struct KzcVector2 *out_vector) |
Abs of a 2D vector. More... | |
KZ_INLINE void | kzcVector2ComponentCeil (const struct KzcVector2 *vector, struct KzcVector2 *out_vector) |
Ceil of a 2D vector. More... | |
KZ_INLINE void | kzcVector2ComponentFloor (const struct KzcVector2 *vector, struct KzcVector2 *out_vector) |
Floor of a 2D vector. More... | |
KZ_INLINE void | kzcVector2ComponentRound (const struct KzcVector2 *vector, struct KzcVector2 *out_vector) |
Round of a 2D vector. More... | |
KZ_INLINE void | kzcVector2ComponentSqrt (const struct KzcVector2 *vector, struct KzcVector2 *out_vector) |
Square root of a 2D vector component-wise. More... | |
KZ_INLINE void | kzcVector2ComponentPow (const struct KzcVector2 *vector, kzFloat exponent, struct KzcVector2 *out_vector) |
Raises a 2D vector to power of 'exponent' component-wise. More... | |
KZ_INLINE void | kzcVector2Scale (const struct KzcVector2 *vector, kzFloat factor, struct KzcVector2 *out_vector) |
Scales 2D vector. More... | |
KZ_INLINE void | kzcVector2Negate (const struct KzcVector2 *vector, struct KzcVector2 *targetVector) |
Negates 2D vector. More... | |
KZ_INLINE kzFloat | kzcVector2Dot (const struct KzcVector2 *left, const struct KzcVector2 *right) |
Calculates dot product of two 2D vectors. More... | |
KZ_INLINE kzFloat | kzcVector2PseudoCross (const struct KzcVector2 *left, const struct KzcVector2 *right) |
Calculates pseudo-cross product of two 2D vectors. More... | |
KZ_INLINE kzFloat | kzcVector2GetLengthSquared (const struct KzcVector2 *vector) |
Returns length squared of a 2D vector. More... | |
KZ_INLINE kzFloat | kzcVector2GetLength (const struct KzcVector2 *vector) |
Returns the length of 2D vector. More... | |
KZ_INLINE kzFloat | kzcVector2Distance (const struct KzcVector2 *vector1, const struct KzcVector2 *vector2) |
Returns the distance between two 2D point vectors. More... | |
KZ_INLINE void | kzcVector2Normalize (struct KzcVector2 *vector) |
Normalizes a 2D vector. More... | |
KZ_INLINE void | kzcVector2Reflect (const struct KzcVector2 *vector, const struct KzcVector2 *axis, struct KzcVector2 *targetVector) |
Reflects a 2D vector according to given axis vector. More... | |
KZ_INLINE kzBool | kzcVector2IsEqual (const struct KzcVector2 *first, const struct KzcVector2 *second) |
Checks if two 2D vectors are equal. More... | |
KZ_INLINE struct KzcVector3 | kzcVector2ToVector3 (const struct KzcVector2 *vector) |
Converts a 2D vector to a 3D vector. More... | |
KZ_INLINE struct KzcVector2 | kzcVector2FromVector3 (const struct KzcVector3 *vector) |
Converts a 3D vector to a 2D vector. More... | |
KZ_INLINE struct KzcVector2 | kzcVector2ComponentMax (const struct KzcVector2 *vectorA, const struct KzcVector2 *vectorB) |
Returns the component maximum of two vectors. More... | |
KZ_INLINE struct KzcVector2 | kzcVector2ComponentMin (const struct KzcVector2 *vectorA, const struct KzcVector2 *vectorB) |
Returns the component minimum of two vectors. More... | |
KZ_INLINE struct KzcVector2 | kzcVector2ComponentStep (const struct KzcVector2 *vectorA, const struct KzcVector2 *vectorB) |
Returns the component-wise step() of two vectors. More... | |
void | kzcVector2SetInvalid (struct KzcVector2 *vector) |
Sets the vector components to NaN. More... | |
Variables | |
KANZI_API const struct KzcVector2 | KZC_VECTOR2_ZERO |
Constant zero 2D vector. More... | |
KANZI_API const struct KzcVector2 | KZC_VECTOR2_X_AXIS |
Constant unit 2D vector for X axis. More... | |
KANZI_API const struct KzcVector2 | KZC_VECTOR2_Y_AXIS |
Constant unit 2D vector for Y axis. More... | |
KANZI_API const struct KzcVector2 | KZC_VECTOR2_X_AXIS_NEGATIVE |
Constant unit 2D vector for negative X axis. More... | |
KANZI_API const struct KzcVector2 | KZC_VECTOR2_Y_AXIS_NEGATIVE |
Constant unit 2D vector for negative Y axis. More... | |
2D vector.
Copyright 2008-2017 by Rightware. All rights reserved.
KZ_INLINE struct KzcVector2 kzcVector2 | ( | kzFloat | x, |
kzFloat | y | ||
) |
Creates a 2D vector.
KZ_INLINE kzFloat kzcVector2GetX | ( | const struct KzcVector2 * | vector | ) |
Gets the X component of a 2D vector.
KZ_INLINE kzFloat kzcVector2GetY | ( | const struct KzcVector2 * | vector | ) |
Gets the Y component of a 2D vector.
KZ_INLINE kzFloat* kzcVector2GetComponents | ( | struct KzcVector2 * | vector | ) |
Gets the underlying component array of a 2D vector.
KZ_INLINE void kzcVector2Set | ( | struct KzcVector2 * | vector, |
kzFloat | x, | ||
kzFloat | y | ||
) |
Sets all components for 2D vector.
KZ_INLINE void kzcVector2SetX | ( | struct KzcVector2 * | vector, |
kzFloat | x | ||
) |
Sets X component for 2D vector.
KZ_INLINE void kzcVector2SetY | ( | struct KzcVector2 * | vector, |
kzFloat | y | ||
) |
Sets Y component for 2D vector.
KZ_INLINE void kzcVector2Add | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second, | ||
struct KzcVector2 * | targetVector | ||
) |
Adds two 2D vectors.
KZ_INLINE void kzcVector2Subtract | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second, | ||
struct KzcVector2 * | targetVector | ||
) |
Subtracts two 2D vectors.
KZ_INLINE void kzcVector2ComponentMultiply | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second, | ||
struct KzcVector2 * | targetVector | ||
) |
Component-multiplies two 2D vectors.
KZ_INLINE void kzcVector2ComponentDivide | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second, | ||
struct KzcVector2 * | targetVector | ||
) |
Component-divides two 2D vectors.
KZ_INLINE void kzcVector2ComponentModulo | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second, | ||
struct KzcVector2 * | targetVector | ||
) |
Component-modulo of two 2D vectors.
KZ_INLINE void kzcVector2ComponentAbs | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | out_vector | ||
) |
Abs of a 2D vector.
KZ_INLINE void kzcVector2ComponentCeil | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | out_vector | ||
) |
Ceil of a 2D vector.
KZ_INLINE void kzcVector2ComponentFloor | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | out_vector | ||
) |
Floor of a 2D vector.
KZ_INLINE void kzcVector2ComponentRound | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | out_vector | ||
) |
Round of a 2D vector.
KZ_INLINE void kzcVector2ComponentSqrt | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | out_vector | ||
) |
Square root of a 2D vector component-wise.
KZ_INLINE void kzcVector2ComponentPow | ( | const struct KzcVector2 * | vector, |
kzFloat | exponent, | ||
struct KzcVector2 * | out_vector | ||
) |
Raises a 2D vector to power of 'exponent' component-wise.
KZ_INLINE void kzcVector2Scale | ( | const struct KzcVector2 * | vector, |
kzFloat | factor, | ||
struct KzcVector2 * | out_vector | ||
) |
Scales 2D vector.
KZ_INLINE void kzcVector2Negate | ( | const struct KzcVector2 * | vector, |
struct KzcVector2 * | targetVector | ||
) |
Negates 2D vector.
KZ_INLINE kzFloat kzcVector2Dot | ( | const struct KzcVector2 * | left, |
const struct KzcVector2 * | right | ||
) |
Calculates dot product of two 2D vectors.
KZ_INLINE kzFloat kzcVector2PseudoCross | ( | const struct KzcVector2 * | left, |
const struct KzcVector2 * | right | ||
) |
Calculates pseudo-cross product of two 2D vectors.
U x V = Uy * Vx - Ux * Vy.
KZ_INLINE kzFloat kzcVector2GetLengthSquared | ( | const struct KzcVector2 * | vector | ) |
Returns length squared of a 2D vector.
KZ_INLINE kzFloat kzcVector2GetLength | ( | const struct KzcVector2 * | vector | ) |
Returns the length of 2D vector.
KZ_INLINE kzFloat kzcVector2Distance | ( | const struct KzcVector2 * | vector1, |
const struct KzcVector2 * | vector2 | ||
) |
Returns the distance between two 2D point vectors.
KZ_INLINE void kzcVector2Normalize | ( | struct KzcVector2 * | vector | ) |
Normalizes a 2D vector.
KZ_INLINE void kzcVector2Reflect | ( | const struct KzcVector2 * | vector, |
const struct KzcVector2 * | axis, | ||
struct KzcVector2 * | targetVector | ||
) |
Reflects a 2D vector according to given axis vector.
Axis has to be normalized.
KZ_INLINE kzBool kzcVector2IsEqual | ( | const struct KzcVector2 * | first, |
const struct KzcVector2 * | second | ||
) |
Checks if two 2D vectors are equal.
KZ_INLINE struct KzcVector3 kzcVector2ToVector3 | ( | const struct KzcVector2 * | vector | ) |
Converts a 2D vector to a 3D vector.
Z will be zero.
KZ_INLINE struct KzcVector2 kzcVector2FromVector3 | ( | const struct KzcVector3 * | vector | ) |
Converts a 3D vector to a 2D vector.
Z will be discarded.
KZ_INLINE struct KzcVector2 kzcVector2ComponentMax | ( | const struct KzcVector2 * | vectorA, |
const struct KzcVector2 * | vectorB | ||
) |
Returns the component maximum of two vectors.
KZ_INLINE struct KzcVector2 kzcVector2ComponentMin | ( | const struct KzcVector2 * | vectorA, |
const struct KzcVector2 * | vectorB | ||
) |
Returns the component minimum of two vectors.
KZ_INLINE struct KzcVector2 kzcVector2ComponentStep | ( | const struct KzcVector2 * | vectorA, |
const struct KzcVector2 * | vectorB | ||
) |
Returns the component-wise step() of two vectors.
void kzcVector2SetInvalid | ( | struct KzcVector2 * | vector | ) |
Sets the vector components to NaN.
KANZI_API const struct KzcVector2 KZC_VECTOR2_ZERO |
Constant zero 2D vector.
KANZI_API const struct KzcVector2 KZC_VECTOR2_X_AXIS |
Constant unit 2D vector for X axis.
KANZI_API const struct KzcVector2 KZC_VECTOR2_Y_AXIS |
Constant unit 2D vector for Y axis.
KANZI_API const struct KzcVector2 KZC_VECTOR2_X_AXIS_NEGATIVE |
Constant unit 2D vector for negative X axis.
KANZI_API const struct KzcVector2 KZC_VECTOR2_Y_AXIS_NEGATIVE |
Constant unit 2D vector for negative Y axis.