3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
cVec2 Class Reference

The 2D-vector, refer it as coat::vec2 in the Core API. More...

#include <cVec2.h>

Public Member Functions

 cVec2 (const float S)
 
 cVec2 (const float X, const float Y)
 
 cVec2 (const cVec2 &v)
 
void Copy (const float *Src)
 
void SetZero ()
 
void SetOne ()
 
void Set (const float S)
 
void Set (const float X, const float Y)
 
float operator[] (const int index) const
 
float & operator[] (const int index)
 
const cVec2 operator- () const
 
cVec2operator+= (const cVec2 &)
 
cVec2operator-= (const cVec2 &)
 
cVec2operator*= (const cVec2 &)
 
cVec2operator*= (const float)
 
cVec2operator/= (const cVec2 &)
 
cVec2operator/= (const float)
 
void Transform (const cMat3 &)
 
void operator*= (const cMat3 &)
 
void TransformCoordinate (const cMat4 &)
 
void TransformNormal (const cMat4 &)
 
const cVec2 operator+ (const cVec2 &) const
 
const cVec2 operator- (const cVec2 &) const
 
const cVec2 operator* (const cVec2 &) const
 
const cVec2 operator* (const float) const
 
const cVec2 operator/ (const cVec2 &) const
 
const cVec2 operator/ (const float) const
 
const cVec2 operator* (const cMat3 &) const
 
bool operator== (const cVec2 &) const
 
bool operator!= (const cVec2 &) const
 
float Length () const
 
float LengthSq () const
 
float Normalize ()
 
float NormalizeSafe (const cVec2 &Fallback)
 
bool IsValid () const
 
bool IsNormalized (const float Eps=cMath::Epsilon) const
 
bool IsZero (const float Eps=cMath::Epsilon) const
 
const cVec2 ToRound () const
 
void Round ()
 
void Truncate (const float MaxLength)
 
__inline float distance2 (const cVec2 &)
 
__inline float distance (const cVec2 &)
 
float DistanceToLineSegSq (const cVec2 &A, const cVec2 &B, float *pScale=nullptr) const
 
std::tuple< float, float > __getstate__ ()
 
void __setstate__ (const std::tuple< float, float > &state)
 
const std::string __repr__ () const
 
int GetDimension () const
 
const float * ToFloatPtr () const
 
float * ToFloatPtr ()
 
void ToPolar (float *Radius, float *Angle) const
 
float ToBaryCentric (const cVec2 &t0, const cVec2 &t1, const cVec2 &t2, float &u, float &v) const
 
bool IsInsideTri (const cVec2 &t0, const cVec2 &t1, const cVec2 &t2) const
 
const cStr ToString (const int Prec=2) const
 
const cVec2 ToNormal () const
 
const cVec2 ToPerpCw () const
 
const cVec2 ToPerpCcw () const
 
void Clear (void *=0)
 
void AddWithWeight (cVec2 const &src, float weight)
 
void SetPosition (float aX, float aY)
 
const float * GetPosition () const
 

Static Public Member Functions

static const cVec2 Transform (const cVec2 &, const cMat3 &)
 
static const cVec4 Transform (const cVec2 &, const cMat4 &)
 
static const cVec2 TransformCoordinate (const cVec2 &, const cMat4 &)
 
static const cVec2 TransformNormal (const cVec2 &, const cMat4 &)
 
static bool Equals (const cVec2 &, const cVec2 &, const float Eps=cMath::Epsilon)
 
static const cVec2 Round (const cVec2 &)
 
static const cVec2 Abs (const cVec2 &)
 
static const cVec2 Fract (const cVec2 &)
 
static float Angle (const cVec2 &, const cVec2 &)
 
static float AreaSigned (const cVec2 &t0, const cVec2 &t1, const cVec2 &t2)
 
static float Ccw (const cVec2 &, const cVec2 &)
 
static const cVec2 Clamp (const cVec2 &Value, const cVec2 &Lo, const cVec2 &Hi)
 
static float Distance (const cVec2 &, const cVec2 &)
 
static float DistanceSq (const cVec2 &, const cVec2 &)
 
static float Dot (const cVec2 &, const cVec2 &)
 
static float Length (const cVec2 &)
 
static float LengthSq (const cVec2 &)
 
static const cVec2 Lerp (const cVec2 &, const cVec2 &, const float)
 
static const cVec2 Lerp05 (const cVec2 &, const cVec2 &)
 
static const cVec2 Max (const cVec2 &, const cVec2 &)
 
static const cVec2 Min (const cVec2 &, const cVec2 &)
 
static const cVec2 Normalize (const cVec2 &)
 
static const cVec2 NormalizeSafe (const cVec2 &Src, const cVec2 &Fallback)
 
static const cVec2 PerpCw (const cVec2 &)
 
static const cVec2 PerpCcw (const cVec2 &)
 
static const cVec2 Reflect (const cVec2 &RayDir, const cVec2 &Normal)
 
static const cVec2 Refract (const cVec2 &RayDir, const cVec2 &Normal, const float Eta)
 
static const cVec2 Truncate (const cVec2 &u, const float MaxLength)
 
static const cVec2 RandRange1 ()
 
static const cVec2 RandNormal ()
 
static const cVec2 Rand (const cVec2 &Lo, const cVec2 &Hi)
 
static bool SegIntersection (const cVec2 &L0, const cVec2 &L1, const cVec2 &R0, const cVec2 &R1, float *l=nullptr, float *r=nullptr)
 
static const cVec2 FromBaryCentric (const cVec2 &t0, const cVec2 &t1, const cVec2 &t2, const float u, const float v)
 
static const cVec2 FromPolar (const float Radius, const float Angle)
 

Public Attributes

float x
 
float y
 

Static Public Attributes

static const cVec2 Zero
 
static const cVec2 One
 
static const cVec2 Infinity
 
static const cVec2 AxisX
 
static const cVec2 AxisY
 
static const cVec2 AxisNegX
 
static const cVec2 AxisNegY
 

Friends

const cVec2 operator* (const float s, const cVec2 &u)
 
const cVec2 operator/ (const float s, const cVec2 &u)
 
cStroperator<< (cStr &, const cVec2 &)
 

Detailed Description

The 2D-vector, refer it as coat::vec2 in the Core API.


The documentation for this class was generated from the following files: