41 const T Y) {
x=X;
y=Y;}
42 void set (
const T v[2]) {
x=v[0];
y=v[1];}
78 const SLVec2& v){output<<
"["<<v.
x<<
","<<v.
y<<
"]";
return output;}
90 if (L>0) {
x/=L;
y/=L;}
93 const T max) {
x = (
x>max)?max : (
x<min)?min :
x;
94 y = (
y>max)?max : (
y<min)?min :
y;}
102 y = r * sin(phiRAD);}
108 T xAC = A.
x-C.
x, xC =
x-C.
x, xCB = C.
x-B.
x;
109 T yAC = A.
y-C.
y, yBC = B.
y-C.
y, yC =
y-C.
y, yCA = C.
y-A.
y;
111 T u = (yBC*xC + xCB*yC) / (yBC*xAC + xCB*yAC);
112 T v = (yCA*xC + xAC*yC) / (yBC*xAC + xCB*yAC);
147 typedef vector<SLVec2d> SLVVec2d;
vector< SLVec2f > SLVVec2f
SLVec2< SLfloat > SLVec2f
The SLScene class represents the top level instance holding the scene structure.
2D vector template class for standard 2D vector algebra.
void clampMinMax(const T min, const T max)
SLVec2 operator/(const T s) const
SLbool operator<(const SLVec2 &v) const
T operator*(const SLVec2 &v) const
void sub(const SLVec2 &a, const SLVec2 &b)
SLVec2 & operator-=(const SLVec2 &v)
SLbool operator>=(const SLVec2 &v) const
SLbool operator<=(const SLVec2 &v) const
void setMax(const SLVec2 &v)
SLVec2 & operator/=(const T s)
SLstring toString(SLstring delimiter=", ", int decimals=2)
Conversion to string.
SLVec2 barycentricCoords(SLVec2 A, SLVec2 B, SLVec2 C)
Calculate the barycentric coordinate uv of the point within a triangle ABC.
SLbool operator>(const SLVec2 &v) const
void print(const char *str=nullptr)
SLVec2 & operator=(const SLVec2 &v)
SLbool operator==(const SLVec2 &v) const
void setMin(const SLVec2 &v)
void toPolar(T &r, T &phiRAD)
Calculates polar coords with radius & angle phi in radians (-pi < phi < pi)
T diff(const SLVec2 &v)
Calculate the absolute to the vector v.
void add(const SLVec2 &a, const SLVec2 &b)
SLbool operator!=(const SLVec2 &v) const
SLVec2 & operator*=(const T s)
SLVec2 & operator+=(const SLVec2 &v)
void set(const SLVec2 &v)
void set(const T X, const T Y)
friend std::ostream & operator<<(std::ostream &output, const SLVec2 &v)
void fromPolar(T r, T phiRAD)
Calculates the vector from polar coords r & phi in radians (-pi < phi < pi)
SLVec2 & operator&=(const SLVec2 &v)
SLVec2 operator+(const SLVec2 &v) const
SLVec2 operator&(const SLVec2 &v) const
SLVec2(const T X, const T Y)
string toString(float f, int roundedDecimals)
Returns a string from a float with max. one trailing zero.