Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Opcode::Point Class Reference

#include <Opcode.h>

Inheritance diagram for Opcode::Point:
Opcode::HPoint

Public Member Functions

inline_ Point ()
 Empty constructor. More...
 
inline_ Point (float _x, float _y, float _z)
 Constructor from a single float. More...
 
inline_ Point (const float f[3])
 Constructor from array. More...
 
inline_ Point (const Point &p)
 Copy constructor. More...
 
inline_ ~Point ()
 Destructor. More...
 
inline_ PointZero ()
 Clears the vector. More...
 
inline_ PointSetPlusInfinity ()
 
inline_ PointSetMinusInfinity ()
 
PointPositiveUnitRandomVector ()
 Sets positive unit random vector. More...
 
PointUnitRandomVector ()
 Sets unit random vector. More...
 
inline_ PointSet (float _x, float _y, float _z)
 Assignment from values. More...
 
inline_ PointSet (const float f[3])
 Assignment from array. More...
 
inline_ PointSet (const Point &src)
 Assignment from another point. More...
 
inline_ PointAdd (const Point &p)
 Adds a vector. More...
 
inline_ PointAdd (float _x, float _y, float _z)
 Adds a vector. More...
 
inline_ PointAdd (const float f[3])
 Adds a vector. More...
 
inline_ PointAdd (const Point &p, const Point &q)
 Adds vectors. More...
 
inline_ PointSub (const Point &p)
 Subtracts a vector. More...
 
inline_ PointSub (float _x, float _y, float _z)
 Subtracts a vector. More...
 
inline_ PointSub (const float f[3])
 Subtracts a vector. More...
 
inline_ PointSub (const Point &p, const Point &q)
 Subtracts vectors. More...
 
inline_ PointNeg ()
 this = -this More...
 
inline_ PointNeg (const Point &a)
 this = -a More...
 
inline_ PointMult (float s)
 Multiplies by a scalar. More...
 
inline_ PointMult (const Point &a, float scalar)
 this = a * scalar More...
 
inline_ PointMac (const Point &a, const Point &b, float scalar)
 this = a + b * scalar More...
 
inline_ PointMac (const Point &a, float scalar)
 this = this + a * scalar More...
 
inline_ PointMsc (const Point &a, const Point &b, float scalar)
 this = a - b * scalar More...
 
inline_ PointMsc (const Point &a, float scalar)
 this = this - a * scalar More...
 
inline_ PointMac2 (const Point &a, const Point &b, float scalarb, const Point &c, float scalarc)
 this = a + b * scalarb + c * scalarc More...
 
inline_ PointMsc2 (const Point &a, const Point &b, float scalarb, const Point &c, float scalarc)
 this = a - b * scalarb - c * scalarc More...
 
inline_ PointMult (const Matrix3x3 &mat, const Point &a)
 this = mat * a More...
 
inline_ PointMult2 (const Matrix3x3 &mat1, const Point &a1, const Matrix3x3 &mat2, const Point &a2)
 this = mat1 * a1 + mat2 * a2 More...
 
inline_ PointMac (const Matrix3x3 &mat, const Point &a)
 this = this + mat * a More...
 
inline_ PointTransMult (const Matrix3x3 &mat, const Point &a)
 this = transpose(mat) * a More...
 
inline_ PointLerp (const Point &a, const Point &b, float t)
 Linear interpolate between two vectors: this = a + t * (b - a) More...
 
inline_ PointHerp (const Point &p0, const Point &p1, const Point &p2, const Point &p3, float t)
 
inline_ PointTransform (const Point &r, const Matrix3x3 &rotpos, const Point &linpos)
 this = rotpos * r + linpos More...
 
inline_ PointInvTransform (const Point &r, const Matrix3x3 &rotpos, const Point &linpos)
 this = trans(rotpos) * (r - linpos) More...
 
inline_ float Min () const
 Returns MIN(x, y, z);. More...
 
inline_ float Max () const
 Returns MAX(x, y, z);. More...
 
inline_ PointMin (const Point &p)
 Sets each element to be componentwise minimum. More...
 
inline_ PointMax (const Point &p)
 Sets each element to be componentwise maximum. More...
 
inline_ PointClamp (float min, float max)
 Clamps each element. More...
 
inline_ float SquareMagnitude () const
 Computes square magnitude. More...
 
inline_ float Magnitude () const
 Computes magnitude. More...
 
inline_ float Volume () const
 Computes volume. More...
 
inline_ bool ApproxZero () const
 Checks the point is near zero. More...
 
inline_ bool IsZero () const
 Tests for exact zero vector. More...
 
inline_ bool IsValid () const
 Checks point validity. More...
 
void Tweak (udword coord_mask, udword tweak_mask)
 Slighty moves the point. More...
 
inline_ void TweakBigger ()
 Slighty moves the point out. More...
 
inline_ void TweakSmaller ()
 Slighty moves the point in. More...
 
inline_ PointNormalize ()
 Normalizes the vector. More...
 
inline_ PointSetLength (float length)
 Sets vector length. More...
 
inline_ PointClampLength (float limit_length)
 Clamps vector length. More...
 
inline_ float Distance (const Point &b) const
 Computes distance to another point. More...
 
inline_ float SquareDistance (const Point &b) const
 Computes square distance to another point. More...
 
inline_ float Dot (const Point &p) const
 Dot product dp = this|a. More...
 
inline_ PointCross (const Point &a, const Point &b)
 Cross product this = a x b. More...
 
inline_ udword VectorCode () const
 Vector code ( bitmask = sign(z) | sign(y) | sign(x) ) More...
 
inline_ PointComponent LargestAxis () const
 Returns largest axis. More...
 
inline_ PointComponent ClosestAxis () const
 Returns closest axis. More...
 
inline_ PointComponent SmallestAxis () const
 Returns smallest axis. More...
 
PointRefract (const Point &eye, const Point &n, float refractindex, Point &refracted)
 Refracts the point. More...
 
PointProjectToPlane (const Plane &p)
 Projects the point onto a plane. More...
 
void ProjectToScreen (float halfrenderwidth, float halfrenderheight, const Matrix4x4 &mat, HPoint &projected) const
 Projects the point onto the screen. More...
 
PointUnfold (Plane &p, Point &a, Point &b)
 Unfolds the point onto a plane according to edge(a,b) More...
 
inline_ udword GetHashValue () const
 Hash function from Ville Miettinen. More...
 
void SetNotUsed ()
 Stuff magic values in the point, marking it as explicitely not used. More...
 
bool IsNotUsed () const
 Checks the point is marked as not used. More...
 
inline_ Point operator- () const
 Unary operator for Point Negate = - Point. More...
 
inline_ Point operator+ (const Point &p) const
 Operator for Point Plus = Point + Point. More...
 
inline_ Point operator- (const Point &p) const
 Operator for Point Minus = Point - Point. More...
 
inline_ Point operator* (const Point &p) const
 Operator for Point Mul = Point * Point. More...
 
inline_ Point operator* (float s) const
 Operator for Point Scale = Point * float. More...
 
inline_ Point operator/ (const Point &p) const
 Operator for Point Div = Point / Point. More...
 
inline_ Point operator/ (float s) const
 Operator for Point Scale = Point / float. More...
 
inline_ float operator| (const Point &p) const
 Operator for float DotProd = Point | Point. More...
 
inline_ Point operator^ (const Point &p) const
 Operator for Point VecProd = Point ^ Point. More...
 
inline_ Pointoperator+= (const Point &p)
 Operator for Point += Point. More...
 
inline_ Pointoperator+= (float s)
 Operator for Point += float. More...
 
inline_ Pointoperator-= (const Point &p)
 Operator for Point -= Point. More...
 
inline_ Pointoperator-= (float s)
 Operator for Point -= float. More...
 
inline_ Pointoperator*= (const Point &p)
 Operator for Point *= Point. More...
 
inline_ Pointoperator*= (float s)
 Operator for Point *= float. More...
 
inline_ Pointoperator/= (const Point &p)
 Operator for Point /= Point. More...
 
inline_ Pointoperator/= (float s)
 Operator for Point /= float. More...
 
inline_ bool operator== (const Point &p) const
 Operator for "if(Point==Point)". More...
 
inline_ bool operator!= (const Point &p) const
 Operator for "if(Point!=Point)". More...
 
inline_ Point operator* (const Matrix3x3 &mat) const
 Operator for Point Mul = Point * Matrix3x3. More...
 
inline_ Point operator* (const Matrix4x4 &mat) const
 Operator for Point Mul = Point * Matrix4x4. More...
 
inline_ Pointoperator*= (const Matrix3x3 &mat)
 Operator for Point *= Matrix3x3. More...
 
inline_ Pointoperator*= (const Matrix4x4 &mat)
 Operator for Point *= Matrix4x4. More...
 
 operator HPoint () const
 Cast a Point to a HPoint. w is set to zero. More...
 
inline_ float operator[] (int n) const
 
inline_ floatoperator[] (int n)
 

Public Attributes

float x
 
float y
 
float z
 

Friends

inline_ friend Point operator* (float s, const Point &p)
 Operator for Point Scale = float * Point. More...
 
inline_ friend Point operator/ (float s, const Point &p)
 Operator for Point Scale = float / Point. More...
 

Detailed Description

Definition at line 26 of file Opcode.h.

Constructor & Destructor Documentation

inline_ Opcode::Point::Point ( )
inline

Empty constructor.

Definition at line 31 of file Opcode.h.

Referenced by Opcode::HPoint::operator*().

39 {
inline_ Opcode::Point::Point ( float  _x,
float  _y,
float  _z 
)
inline

Constructor from a single float.

Constructor from floats

Definition at line 36 of file Opcode.h.

39 {
inline_ Opcode::Point::Point ( const float  f[3])
inline

Constructor from array.

Definition at line 38 of file Opcode.h.

39 {
inline_ Opcode::Point::Point ( const Point p)
inline

Copy constructor.

Definition at line 40 of file Opcode.h.

inline_ Opcode::Point::~Point ( )
inline

Destructor.

Definition at line 42 of file Opcode.h.

Member Function Documentation

inline_ Point& Opcode::Point::Add ( const Point p)
inline

Adds a vector.

Definition at line 65 of file Opcode.h.

inline_ Point& Opcode::Point::Add ( float  _x,
float  _y,
float  _z 
)
inline

Adds a vector.

Definition at line 67 of file Opcode.h.

inline_ Point& Opcode::Point::Add ( const float  f[3])
inline

Adds a vector.

Definition at line 69 of file Opcode.h.

inline_ Point& Opcode::Point::Add ( const Point p,
const Point q 
)
inline

Adds vectors.

Definition at line 71 of file Opcode.h.

inline_ bool Opcode::Point::ApproxZero ( ) const
inline

Checks the point is near zero.

Definition at line 225 of file Opcode.h.

inline_ Point& Opcode::Point::Clamp ( float  min,
float  max 
)
inline

Clamps each element.

Definition at line 209 of file Opcode.h.

inline_ Point& Opcode::Point::ClampLength ( float  limit_length)
inline

Clamps vector length.

Definition at line 294 of file Opcode.h.

inline_ PointComponent Opcode::Point::ClosestAxis ( ) const
inline

Returns closest axis.

Definition at line 352 of file Opcode.h.

inline_ Point& Opcode::Point::Cross ( const Point a,
const Point b 
)
inline

Cross product this = a x b.

Definition at line 327 of file Opcode.h.

inline_ float Opcode::Point::Distance ( const Point b) const
inline

Computes distance to another point.

Definition at line 312 of file Opcode.h.

inline_ float Opcode::Point::Dot ( const Point p) const
inline

Dot product dp = this|a.

Definition at line 324 of file Opcode.h.

inline_ udword Opcode::Point::GetHashValue ( ) const
inline

Hash function from Ville Miettinen.

Definition at line 384 of file Opcode.h.

inline_ Point& Opcode::Point::Herp ( const Point p0,
const Point p1,
const Point p2,
const Point p3,
float  t 
)
inline

Hermite interpolate between p1 and p2. p0 and p3 are used for finding gradient at p1 and p2. this = p0 * (2t^2 - t^3 - t)/2

  • p1 * (3t^3 - 5t^2 + 2)/2
  • p2 * (4t^2 - 3t^3 + t)/2
  • p3 * (t^3 - t^2)/2

Definition at line 179 of file Opcode.h.

Point & Point::InvTransform ( const Point r,
const Matrix3x3 rotpos,
const Point linpos 
)

this = trans(rotpos) * (r - linpos)

Definition at line 185 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

186 {
187  float sx = r.x - linpos.x;
188  float sy = r.y - linpos.y;
189  float sz = r.z - linpos.z;
190  x = sx * rotpos.m[0][0] + sy * rotpos.m[1][0] + sz * rotpos.m[2][0];
191  y = sx * rotpos.m[0][1] + sy * rotpos.m[1][1] + sz * rotpos.m[2][1];
192  z = sx * rotpos.m[0][2] + sy * rotpos.m[1][2] + sz * rotpos.m[2][2];
193  return *this;
194 }
bool Point::IsNotUsed ( ) const

Checks the point is marked as not used.

Definition at line 137 of file IcePoint.cpp.

References FALSE, IR, TRUE, x, y, and z.

138 {
139  if(IR(x)!=0xffffffff) return FALSE;
140  if(IR(y)!=0xffffffff) return FALSE;
141  if(IR(z)!=0xffffffff) return FALSE;
142  return TRUE;
143 }
inline_ bool Opcode::Point::IsValid ( ) const
inline

Checks point validity.

Definition at line 235 of file Opcode.h.

inline_ bool Opcode::Point::IsZero ( ) const
inline

Tests for exact zero vector.

Definition at line 228 of file Opcode.h.

inline_ PointComponent Opcode::Point::LargestAxis ( ) const
inline

Returns largest axis.

Definition at line 342 of file Opcode.h.

inline_ Point& Opcode::Point::Lerp ( const Point a,
const Point b,
float  t 
)
inline

Linear interpolate between two vectors: this = a + t * (b - a)

Definition at line 166 of file Opcode.h.

inline_ Point& Opcode::Point::Mac ( const Point a,
const Point b,
float  scalar 
)
inline

this = a + b * scalar

Definition at line 100 of file Opcode.h.

inline_ Point& Opcode::Point::Mac ( const Point a,
float  scalar 
)
inline

this = this + a * scalar

Definition at line 109 of file Opcode.h.

Point & Point::Mac ( const Matrix3x3 mat,
const Point a 
)

this = this + mat * a

Definition at line 161 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

162 {
163  x += a.x * mat.m[0][0] + a.y * mat.m[0][1] + a.z * mat.m[0][2];
164  y += a.x * mat.m[1][0] + a.y * mat.m[1][1] + a.z * mat.m[1][2];
165  z += a.x * mat.m[2][0] + a.y * mat.m[2][1] + a.z * mat.m[2][2];
166  return *this;
167 }
inline_ Point& Opcode::Point::Mac2 ( const Point a,
const Point b,
float  scalarb,
const Point c,
float  scalarc 
)
inline

this = a + b * scalarb + c * scalarc

Definition at line 136 of file Opcode.h.

inline_ float Opcode::Point::Magnitude ( ) const
inline

Computes magnitude.

Definition at line 220 of file Opcode.h.

Referenced by Angle().

inline_ float Opcode::Point::Max ( ) const
inline

Returns MAX(x, y, z);.

Definition at line 202 of file Opcode.h.

Referenced by Opcode::OPComputeMinMax(), and OPComputeMinMax().

inline_ Point& Opcode::Point::Max ( const Point p)
inline

Sets each element to be componentwise maximum.

Definition at line 206 of file Opcode.h.

inline_ float Opcode::Point::Min ( ) const
inline

Returns MIN(x, y, z);.

Definition at line 200 of file Opcode.h.

Referenced by Opcode::OPComputeMinMax(), and OPComputeMinMax().

inline_ Point& Opcode::Point::Min ( const Point p)
inline

Sets each element to be componentwise minimum.

Definition at line 204 of file Opcode.h.

inline_ Point& Opcode::Point::Msc ( const Point a,
const Point b,
float  scalar 
)
inline

this = a - b * scalar

Definition at line 118 of file Opcode.h.

inline_ Point& Opcode::Point::Msc ( const Point a,
float  scalar 
)
inline

this = this - a * scalar

Definition at line 127 of file Opcode.h.

inline_ Point& Opcode::Point::Msc2 ( const Point a,
const Point b,
float  scalarb,
const Point c,
float  scalarc 
)
inline

this = a - b * scalarb - c * scalarc

Definition at line 145 of file Opcode.h.

inline_ Point& Opcode::Point::Mult ( float  s)
inline

Multiplies by a scalar.

Definition at line 88 of file Opcode.h.

inline_ Point& Opcode::Point::Mult ( const Point a,
float  scalar 
)
inline

this = a * scalar

Definition at line 91 of file Opcode.h.

Point & Point::Mult ( const Matrix3x3 mat,
const Point a 
)

this = mat * a

Definition at line 145 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

146 {
147  x = a.x * mat.m[0][0] + a.y * mat.m[0][1] + a.z * mat.m[0][2];
148  y = a.x * mat.m[1][0] + a.y * mat.m[1][1] + a.z * mat.m[1][2];
149  z = a.x * mat.m[2][0] + a.y * mat.m[2][1] + a.z * mat.m[2][2];
150  return *this;
151 }
Point & Point::Mult2 ( const Matrix3x3 mat1,
const Point a1,
const Matrix3x3 mat2,
const Point a2 
)

this = mat1 * a1 + mat2 * a2

Definition at line 153 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

154 {
155  x = a1.x * mat1.m[0][0] + a1.y * mat1.m[0][1] + a1.z * mat1.m[0][2] + a2.x * mat2.m[0][0] + a2.y * mat2.m[0][1] + a2.z * mat2.m[0][2];
156  y = a1.x * mat1.m[1][0] + a1.y * mat1.m[1][1] + a1.z * mat1.m[1][2] + a2.x * mat2.m[1][0] + a2.y * mat2.m[1][1] + a2.z * mat2.m[1][2];
157  z = a1.x * mat1.m[2][0] + a1.y * mat1.m[2][1] + a1.z * mat1.m[2][2] + a2.x * mat2.m[2][0] + a2.y * mat2.m[2][1] + a2.z * mat2.m[2][2];
158  return *this;
159 }
inline_ Point& Opcode::Point::Neg ( )
inline

this = -this

Definition at line 83 of file Opcode.h.

inline_ Point& Opcode::Point::Neg ( const Point a)
inline

this = -a

Definition at line 85 of file Opcode.h.

inline_ Point& Opcode::Point::Normalize ( )
inline

Normalizes the vector.

Definition at line 270 of file Opcode.h.

Referenced by Opcode::Triangle::Inflate().

Point::operator HPoint ( ) const

Cast a Point to a HPoint. w is set to zero.

Definition at line 86 of file IcePoint.cpp.

References f, x, y, and z.

86 { return HPoint(x, y, z, 0.0f); }
inline_ bool Opcode::Point::operator!= ( const Point p) const
inline

Operator for "if(Point!=Point)".

Definition at line 456 of file Opcode.h.

inline_ Point Opcode::Point::operator* ( const Point p) const
inline

Operator for Point Mul = Point * Point.

Definition at line 407 of file Opcode.h.

inline_ Point Opcode::Point::operator* ( float  s) const
inline

Operator for Point Scale = Point * float.

Definition at line 409 of file Opcode.h.

inline_ Point Opcode::Point::operator* ( const Matrix3x3 mat) const
inline

Operator for Point Mul = Point * Matrix3x3.

Definition at line 461 of file Opcode.h.

inline_ Point Opcode::Point::operator* ( const Matrix4x4 mat) const
inline

Operator for Point Mul = Point * Matrix4x4.

Definition at line 473 of file Opcode.h.

inline_ Point& Opcode::Point::operator*= ( const Point p)
inline

Operator for Point *= Point.

Definition at line 442 of file Opcode.h.

inline_ Point& Opcode::Point::operator*= ( float  s)
inline

Operator for Point *= float.

Definition at line 444 of file Opcode.h.

inline_ Point& Opcode::Point::operator*= ( const Matrix3x3 mat)
inline

Operator for Point *= Matrix3x3.

Definition at line 485 of file Opcode.h.

inline_ Point& Opcode::Point::operator*= ( const Matrix4x4 mat)
inline

Operator for Point *= Matrix4x4.

Definition at line 500 of file Opcode.h.

inline_ Point Opcode::Point::operator+ ( const Point p) const
inline

Operator for Point Plus = Point + Point.

Definition at line 402 of file Opcode.h.

inline_ Point& Opcode::Point::operator+= ( const Point p)
inline

Operator for Point += Point.

Definition at line 432 of file Opcode.h.

inline_ Point& Opcode::Point::operator+= ( float  s)
inline

Operator for Point += float.

Definition at line 434 of file Opcode.h.

inline_ Point Opcode::Point::operator- ( ) const
inline

Unary operator for Point Negate = - Point.

Definition at line 399 of file Opcode.h.

inline_ Point Opcode::Point::operator- ( const Point p) const
inline

Operator for Point Minus = Point - Point.

Definition at line 404 of file Opcode.h.

inline_ Point& Opcode::Point::operator-= ( const Point p)
inline

Operator for Point -= Point.

Definition at line 437 of file Opcode.h.

inline_ Point& Opcode::Point::operator-= ( float  s)
inline

Operator for Point -= float.

Definition at line 439 of file Opcode.h.

inline_ Point Opcode::Point::operator/ ( const Point p) const
inline

Operator for Point Div = Point / Point.

Definition at line 414 of file Opcode.h.

inline_ Point Opcode::Point::operator/ ( float  s) const
inline

Operator for Point Scale = Point / float.

Definition at line 416 of file Opcode.h.

inline_ Point& Opcode::Point::operator/= ( const Point p)
inline

Operator for Point /= Point.

Definition at line 447 of file Opcode.h.

inline_ Point& Opcode::Point::operator/= ( float  s)
inline

Operator for Point /= float.

Definition at line 449 of file Opcode.h.

inline_ bool Opcode::Point::operator== ( const Point p) const
inline

Operator for "if(Point==Point)".

Definition at line 454 of file Opcode.h.

inline_ float Opcode::Point::operator[] ( int  n) const
inline

Definition at line 519 of file Opcode.h.

inline_ float& Opcode::Point::operator[] ( int  n)
inline

Definition at line 520 of file Opcode.h.

inline_ Point Opcode::Point::operator^ ( const Point p) const
inline

Operator for Point VecProd = Point ^ Point.

Definition at line 423 of file Opcode.h.

inline_ float Opcode::Point::operator| ( const Point p) const
inline

Operator for float DotProd = Point | Point.

Definition at line 421 of file Opcode.h.

Point & Point::PositiveUnitRandomVector ( )

Sets positive unit random vector.

Creates a positive unit random vector.

Returns
Self-reference

Definition at line 60 of file IcePoint.cpp.

61 {
62  x = UnitRandomFloat();
63  y = UnitRandomFloat();
64  z = UnitRandomFloat();
65  Normalize();
66  return *this;
67 }
Point & Point::ProjectToPlane ( const Plane p)

Projects the point onto a plane.

Definition at line 110 of file IcePoint.cpp.

References Opcode::Plane::d, and Opcode::Plane::n.

111 {
112  *this-= (p.d + (*this|p.n))*p.n;
113  return *this;
114 }
void Point::ProjectToScreen ( float  halfrenderwidth,
float  halfrenderheight,
const Matrix4x4 mat,
HPoint projected 
) const

Projects the point onto the screen.

Definition at line 116 of file IcePoint.cpp.

References f, Opcode::HPoint::w, x, y, and z.

117 {
118  projected = HPoint(x, y, z, 1.0f) * mat;
119  projected.w = 1.0f / projected.w;
120 
121  projected.x*=projected.w;
122  projected.y*=projected.w;
123  projected.z*=projected.w;
124 
125  projected.x *= halfrenderwidth; projected.x += halfrenderwidth;
126  projected.y *= -halfrenderheight; projected.y += halfrenderheight;
127 }
Point & Point::Refract ( const Point eye,
const Point n,
float  refractindex,
Point refracted 
)

Refracts the point.

Definition at line 88 of file IcePoint.cpp.

References x, y, and z.

89 {
90  // Point EyePt = eye position
91  // Point p = current vertex
92  // Point n = vertex normal
93  // Point rv = refracted vector
94  // Eye vector - doesn't need to be normalized
95  Point Env;
96  Env.x = eye.x - x;
97  Env.y = eye.y - y;
98  Env.z = eye.z - z;
99 
100  float NDotE = n|Env;
101  float NDotN = n|n;
102  NDotE /= refractindex;
103 
104  // Refracted vector
105  refracted = n*NDotE - Env*NDotN;
106 
107  return *this;
108 }
inline_ Point& Opcode::Point::Set ( float  _x,
float  _y,
float  _z 
)
inline

Assignment from values.

Definition at line 58 of file Opcode.h.

inline_ Point& Opcode::Point::Set ( const float  f[3])
inline

Assignment from array.

Definition at line 60 of file Opcode.h.

inline_ Point& Opcode::Point::Set ( const Point src)
inline

Assignment from another point.

Definition at line 62 of file Opcode.h.

inline_ Point& Opcode::Point::SetLength ( float  length)
inline

Sets vector length.

Definition at line 284 of file Opcode.h.

inline_ Point& Opcode::Point::SetMinusInfinity ( )
inline
  • infinity

Definition at line 50 of file Opcode.h.

void Point::SetNotUsed ( )

Stuff magic values in the point, marking it as explicitely not used.

Definition at line 129 of file IcePoint.cpp.

References IR, x, y, and z.

130 {
131  // We use a particular integer pattern : 0xffffffff everywhere. This is a NAN.
132  IR(x) = 0xffffffff;
133  IR(y) = 0xffffffff;
134  IR(z) = 0xffffffff;
135 }
inline_ Point& Opcode::Point::SetPlusInfinity ( )
inline
  • infinity

Definition at line 48 of file Opcode.h.

inline_ PointComponent Opcode::Point::SmallestAxis ( ) const
inline

Returns smallest axis.

Definition at line 362 of file Opcode.h.

inline_ float Opcode::Point::SquareDistance ( const Point b) const
inline

Computes square distance to another point.

Definition at line 318 of file Opcode.h.

inline_ float Opcode::Point::SquareMagnitude ( ) const
inline

Computes square magnitude.

Definition at line 218 of file Opcode.h.

Referenced by Opcode::Ray::SquareDistance(), and Opcode::Segment::SquareDistance().

inline_ Point& Opcode::Point::Sub ( const Point p)
inline

Subtracts a vector.

Definition at line 74 of file Opcode.h.

inline_ Point& Opcode::Point::Sub ( float  _x,
float  _y,
float  _z 
)
inline

Subtracts a vector.

Definition at line 76 of file Opcode.h.

inline_ Point& Opcode::Point::Sub ( const float  f[3])
inline

Subtracts a vector.

Definition at line 78 of file Opcode.h.

inline_ Point& Opcode::Point::Sub ( const Point p,
const Point q 
)
inline

Subtracts vectors.

Definition at line 80 of file Opcode.h.

Point & Point::Transform ( const Point r,
const Matrix3x3 rotpos,
const Point linpos 
)

this = rotpos * r + linpos

Definition at line 177 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

178 {
179  x = r.x * rotpos.m[0][0] + r.y * rotpos.m[0][1] + r.z * rotpos.m[0][2] + linpos.x;
180  y = r.x * rotpos.m[1][0] + r.y * rotpos.m[1][1] + r.z * rotpos.m[1][2] + linpos.y;
181  z = r.x * rotpos.m[2][0] + r.y * rotpos.m[2][1] + r.z * rotpos.m[2][2] + linpos.z;
182  return *this;
183 }
Point & Point::TransMult ( const Matrix3x3 mat,
const Point a 
)

this = transpose(mat) * a

Definition at line 169 of file IcePoint.cpp.

References Opcode::Matrix3x3::m, x, y, and z.

170 {
171  x = a.x * mat.m[0][0] + a.y * mat.m[1][0] + a.z * mat.m[2][0];
172  y = a.x * mat.m[0][1] + a.y * mat.m[1][1] + a.z * mat.m[2][1];
173  z = a.x * mat.m[0][2] + a.y * mat.m[1][2] + a.z * mat.m[2][2];
174  return *this;
175 }
void Opcode::Point::Tweak ( udword  coord_mask,
udword  tweak_mask 
)
inline

Slighty moves the point.

Definition at line 244 of file Opcode.h.

inline_ void Opcode::Point::TweakBigger ( )
inline

Slighty moves the point out.

Definition at line 254 of file Opcode.h.

inline_ void Opcode::Point::TweakSmaller ( )
inline

Slighty moves the point in.

Definition at line 262 of file Opcode.h.

Point& Opcode::Point::Unfold ( Plane p,
Point a,
Point b 
)

Unfolds the point onto a plane according to edge(a,b)

Point & Point::UnitRandomVector ( )

Sets unit random vector.

Creates a unit random vector.

Returns
Self-reference

Definition at line 75 of file IcePoint.cpp.

76 {
77  x = UnitRandomFloat() - 0.5f;
78  y = UnitRandomFloat() - 0.5f;
79  z = UnitRandomFloat() - 0.5f;
80  Normalize();
81  return *this;
82 }
inline_ udword Opcode::Point::VectorCode ( ) const
inline

Vector code ( bitmask = sign(z) | sign(y) | sign(x) )

Definition at line 336 of file Opcode.h.

inline_ float Opcode::Point::Volume ( ) const
inline

Computes volume.

Definition at line 222 of file Opcode.h.

inline_ Point& Opcode::Point::Zero ( )
inline

Clears the vector.

Definition at line 45 of file Opcode.h.

Friends And Related Function Documentation

inline_ friend Point operator* ( float  s,
const Point p 
)
friend

Operator for Point Scale = float * Point.

Definition at line 411 of file Opcode.h.

inline_ friend Point operator/ ( float  s,
const Point p 
)
friend

Operator for Point Scale = float / Point.

Definition at line 418 of file Opcode.h.

Member Data Documentation


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