summaryrefslogtreecommitdiffhomepage
path: root/Opcode/Ice
diff options
context:
space:
mode:
authorFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2011-12-08 16:00:07 +0000
committerFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2011-12-08 16:00:07 +0000
commit78e29455c5cb4acce769498a5a32be6a3c6085b4 (patch)
treec71549e69f306cfc302d4c76b48cf99afd7f2f76 /Opcode/Ice
parente33e19d0587146859d48a134ec9fd94e7b7ba5cd (diff)
downloadstarshatter-78e29455c5cb4acce769498a5a32be6a3c6085b4.zip
starshatter-78e29455c5cb4acce769498a5a32be6a3c6085b4.tar.gz
starshatter-78e29455c5cb4acce769498a5a32be6a3c6085b4.tar.bz2
Fixing up faulty references to class "Point" to "IcePoint"
Diffstat (limited to 'Opcode/Ice')
-rw-r--r--Opcode/Ice/IceAABB.h56
-rw-r--r--Opcode/Ice/IceBoundingSphere.h34
-rw-r--r--Opcode/Ice/IceHPoint.h12
-rw-r--r--Opcode/Ice/IceIndexedTriangle.h34
-rw-r--r--Opcode/Ice/IceLSS.h8
-rw-r--r--Opcode/Ice/IceMatrix3x3.h30
-rw-r--r--Opcode/Ice/IceMatrix4x4.h26
-rw-r--r--Opcode/Ice/IceOBB.h24
-rw-r--r--Opcode/Ice/IcePlane.cpp12
-rw-r--r--Opcode/Ice/IcePlane.h26
-rw-r--r--Opcode/Ice/IcePoint.cpp38
-rw-r--r--Opcode/Ice/IcePoint.h252
-rw-r--r--Opcode/Ice/IceRay.cpp6
-rw-r--r--Opcode/Ice/IceRay.h22
-rw-r--r--Opcode/Ice/IceSegment.cpp6
-rw-r--r--Opcode/Ice/IceSegment.h26
-rw-r--r--Opcode/Ice/IceTriangle.cpp66
-rw-r--r--Opcode/Ice/IceTriangle.h12
-rw-r--r--Opcode/Ice/IceTrilist.h2
19 files changed, 346 insertions, 346 deletions
diff --git a/Opcode/Ice/IceAABB.h b/Opcode/Ice/IceAABB.h
index 573629e..2c2ce79 100644
--- a/Opcode/Ice/IceAABB.h
+++ b/Opcode/Ice/IceAABB.h
@@ -20,15 +20,15 @@
AABB& Add(const AABB& aabb); \
float MakeCube(AABB& cube) const; \
void MakeSphere(Sphere& sphere) const; \
- const sbyte* ComputeOutline(const Point& local_eye, sdword& num) const; \
- float ComputeBoxArea(const Point& eye, const Matrix4x4& mat, float width, float height, sdword& num) const; \
+ const sbyte* ComputeOutline(const IcePoint& local_eye, sdword& num) const; \
+ float ComputeBoxArea(const IcePoint& eye, const Matrix4x4& mat, float width, float height, sdword& num) const; \
bool IsInside(const AABB& box) const; \
bool ComputePlanes(Plane* planes) const; \
- bool ComputePoints(Point* pts) const; \
- const Point* GetVertexNormals() const; \
+ bool ComputePoints(IcePoint* pts) const; \
+ const IcePoint* GetVertexNormals() const; \
const udword* GetEdges() const; \
- const Point* GetEdgeNormals() const; \
- inline_ BOOL ContainsPoint(const Point& p) const \
+ const IcePoint* GetEdgeNormals() const; \
+ inline_ BOOL ContainsPoint(const IcePoint& p) const \
{ \
if(p.x > GetMax(0) || p.x < GetMin(0)) return FALSE; \
if(p.y > GetMax(1) || p.y < GetMin(1)) return FALSE; \
@@ -282,7 +282,7 @@
* \param max [in] the max point
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void SetMinMax(const Point& min, const Point& max) { mCenter = (max + min)*0.5f; mExtents = (max - min)*0.5f; }
+ void SetMinMax(const IcePoint& min, const IcePoint& max) { mCenter = (max + min)*0.5f; mExtents = (max - min)*0.5f; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -291,7 +291,7 @@
* \param e [in] the extents vector
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void SetCenterExtents(const Point& c, const Point& e) { mCenter = c; mExtents = e; }
+ void SetCenterExtents(const IcePoint& c, const IcePoint& e) { mCenter = c; mExtents = e; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -305,7 +305,7 @@
* Setups a point AABB.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void SetPoint(const Point& pt) { mCenter = pt; mExtents.Zero(); }
+ void SetPoint(const IcePoint& pt) { mCenter = pt; mExtents.Zero(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -321,10 +321,10 @@
* \param p [in] the next point
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void Extend(const Point& p)
+ void Extend(const IcePoint& p)
{
- Point Max = mCenter + mExtents;
- Point Min = mCenter - mExtents;
+ IcePoint Max = mCenter + mExtents;
+ IcePoint Min = mCenter - mExtents;
if(p.x > Max.x) Max.x = p.x;
if(p.x < Min.x) Min.x = p.x;
@@ -340,9 +340,9 @@
// Data access
//! Get min point of the box
- inline_ void GetMin(Point& min) const { min = mCenter - mExtents; }
+ inline_ void GetMin(IcePoint& min) const { min = mCenter - mExtents; }
//! Get max point of the box
- inline_ void GetMax(Point& max) const { max = mCenter + mExtents; }
+ inline_ void GetMax(IcePoint& max) const { max = mCenter + mExtents; }
//! Get component of the box's min point along a given axis
inline_ float GetMin(udword axis) const { return mCenter[axis] - mExtents[axis]; }
@@ -350,9 +350,9 @@
inline_ float GetMax(udword axis) const { return mCenter[axis] + mExtents[axis]; }
//! Get box center
- inline_ void GetCenter(Point& center) const { center = mCenter; }
+ inline_ void GetCenter(IcePoint& center) const { center = mCenter; }
//! Get box extents
- inline_ void GetExtents(Point& extents) const { extents = mExtents; }
+ inline_ void GetExtents(IcePoint& extents) const { extents = mExtents; }
//! Get component of the box's center along a given axis
inline_ float GetCenter(udword axis) const { return mCenter[axis]; }
@@ -360,7 +360,7 @@
inline_ float GetExtents(udword axis) const { return mExtents[axis]; }
//! Get box diagonal
- inline_ void GetDiagonal(Point& diagonal) const { diagonal = mExtents * 2.0f; }
+ inline_ void GetDiagonal(IcePoint& diagonal) const { diagonal = mExtents * 2.0f; }
inline_ float GetWidth() const { return mExtents.x * 2.0f; }
inline_ float GetHeight() const { return mExtents.y * 2.0f; }
inline_ float GetDepth() const { return mExtents.z * 2.0f; }
@@ -392,7 +392,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline_ bool GomezIntersect(const AABB& a)
{
- Point T = mCenter - a.mCenter; // Vector from A to B
+ IcePoint T = mCenter - a.mCenter; // Vector from A to B
return ((fabsf(T.x) <= (a.mExtents.x + mExtents.x))
&& (fabsf(T.y) <= (a.mExtents.y + mExtents.y))
&& (fabsf(T.z) <= (a.mExtents.z + mExtents.z)));
@@ -427,13 +427,13 @@
aabb.mCenter = mCenter * mtx;
// Compute new extents. FPU code & CPU code have been interleaved for improved performance.
- Point Ex(mtx.m[0][0] * mExtents.x, mtx.m[0][1] * mExtents.x, mtx.m[0][2] * mExtents.x);
+ IcePoint Ex(mtx.m[0][0] * mExtents.x, mtx.m[0][1] * mExtents.x, mtx.m[0][2] * mExtents.x);
IR(Ex.x)&=0x7fffffff; IR(Ex.y)&=0x7fffffff; IR(Ex.z)&=0x7fffffff;
- Point Ey(mtx.m[1][0] * mExtents.y, mtx.m[1][1] * mExtents.y, mtx.m[1][2] * mExtents.y);
+ IcePoint Ey(mtx.m[1][0] * mExtents.y, mtx.m[1][1] * mExtents.y, mtx.m[1][2] * mExtents.y);
IR(Ey.x)&=0x7fffffff; IR(Ey.y)&=0x7fffffff; IR(Ey.z)&=0x7fffffff;
- Point Ez(mtx.m[2][0] * mExtents.z, mtx.m[2][1] * mExtents.z, mtx.m[2][2] * mExtents.z);
+ IcePoint Ez(mtx.m[2][0] * mExtents.z, mtx.m[2][1] * mExtents.z, mtx.m[2][2] * mExtents.z);
IR(Ez.x)&=0x7fffffff; IR(Ez.y)&=0x7fffffff; IR(Ez.z)&=0x7fffffff;
aabb.mExtents.x = Ex.x + Ey.x + Ez.x;
@@ -463,19 +463,19 @@
inline_ AABB& operator/=(float s) { mExtents/=s; return *this; }
//! Operator for AABB += Point. Translates the box.
- inline_ AABB& operator+=(const Point& trans)
+ inline_ AABB& operator+=(const IcePoint& trans)
{
mCenter+=trans;
return *this;
}
private:
- Point mCenter; //!< AABB Center
- Point mExtents; //!< x, y and z extents
+ IcePoint mCenter; //!< AABB Center
+ IcePoint mExtents; //!< x, y and z extents
};
#endif
- inline_ void ComputeMinMax(const Point& p, Point& min, Point& max)
+ inline_ void ComputeMinMax(const IcePoint& p, IcePoint& min, IcePoint& max)
{
if(p.x > max.x) max.x = p.x;
if(p.x < min.x) min.x = p.x;
@@ -487,12 +487,12 @@
if(p.z < min.z) min.z = p.z;
}
- inline_ void ComputeAABB(AABB& aabb, const Point* list, udword nb_pts)
+ inline_ void ComputeAABB(AABB& aabb, const IcePoint* list, udword nb_pts)
{
if(list)
{
- Point Maxi(MIN_FLOAT, MIN_FLOAT, MIN_FLOAT);
- Point Mini(MAX_FLOAT, MAX_FLOAT, MAX_FLOAT);
+ IcePoint Maxi(MIN_FLOAT, MIN_FLOAT, MIN_FLOAT);
+ IcePoint Mini(MAX_FLOAT, MAX_FLOAT, MAX_FLOAT);
while(nb_pts--)
{
// _prefetch(list+1); // off by one ?
diff --git a/Opcode/Ice/IceBoundingSphere.h b/Opcode/Ice/IceBoundingSphere.h
index c66524c..5cbc5a4 100644
--- a/Opcode/Ice/IceBoundingSphere.h
+++ b/Opcode/Ice/IceBoundingSphere.h
@@ -27,36 +27,36 @@
//! Constructor
inline_ Sphere() {}
//! Constructor
- inline_ Sphere(const Point& center, float radius) : mCenter(center), mRadius(radius) {}
+ inline_ Sphere(const IcePoint& center, float radius) : mCenter(center), mRadius(radius) {}
//! Constructor
- Sphere(udword nb_verts, const Point* verts);
+ Sphere(udword nb_verts, const IcePoint* verts);
//! Copy constructor
inline_ Sphere(const Sphere& sphere) : mCenter(sphere.mCenter), mRadius(sphere.mRadius) {}
//! Destructor
inline_ ~Sphere() {}
- BSphereMethod Compute(udword nb_verts, const Point* verts);
- bool FastCompute(udword nb_verts, const Point* verts);
+ BSphereMethod Compute(udword nb_verts, const IcePoint* verts);
+ bool FastCompute(udword nb_verts, const IcePoint* verts);
// Access methods
- inline_ const Point& GetCenter() const { return mCenter; }
+ inline_ const IcePoint& GetCenter() const { return mCenter; }
inline_ float GetRadius() const { return mRadius; }
- inline_ const Point& Center() const { return mCenter; }
+ inline_ const IcePoint& Center() const { return mCenter; }
inline_ float Radius() const { return mRadius; }
- inline_ Sphere& Set(const Point& center, float radius) { mCenter = center; mRadius = radius; return *this; }
- inline_ Sphere& SetCenter(const Point& center) { mCenter = center; return *this; }
+ inline_ Sphere& Set(const IcePoint& center, float radius) { mCenter = center; mRadius = radius; return *this; }
+ inline_ Sphere& SetCenter(const IcePoint& center) { mCenter = center; return *this; }
inline_ Sphere& SetRadius(float radius) { mRadius = radius; return *this; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Tests if a point is contained within the sphere.
- * \param p [in] the point to test
+ * Tests if a IcePoint is contained within the sphere.
+ * \param p [in] the IcePoint to test
* \return true if inside the sphere
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ bool Contains(const Point& p) const
+ inline_ bool Contains(const IcePoint& p) const
{
return mCenter.SquareDistance(p) <= mRadius*mRadius;
}
@@ -90,13 +90,13 @@
// Sounds ok but maybe there's a better way?
float R2 = mRadius * mRadius;
#ifdef USE_MIN_MAX
- const Point& Max = ((ShadowAABB&)&aabb).mMax;
- const Point& Min = ((ShadowAABB&)&aabb).mMin;
+ const IcePoint& Max = ((ShadowAABB&)&aabb).mMax;
+ const IcePoint& Min = ((ShadowAABB&)&aabb).mMin;
#else
- Point Max; aabb.GetMax(Max);
- Point Min; aabb.GetMin(Min);
+ IcePoint Max; aabb.GetMax(Max);
+ IcePoint Min; aabb.GetMin(Min);
#endif
- Point p;
+ IcePoint p;
p.x=Max.x; p.y=Max.y; p.z=Max.z; if(mCenter.SquareDistance(p)>=R2) return FALSE;
p.x=Min.x; if(mCenter.SquareDistance(p)>=R2) return FALSE;
p.x=Max.x; p.y=Min.y; if(mCenter.SquareDistance(p)>=R2) return FALSE;
@@ -135,7 +135,7 @@
return TRUE;
}
public:
- Point mCenter; //!< Sphere center
+ IcePoint mCenter; //!< Sphere center
float mRadius; //!< Sphere radius
};
diff --git a/Opcode/Ice/IceHPoint.h b/Opcode/Ice/IceHPoint.h
index 3065d8e..9251691 100644
--- a/Opcode/Ice/IceHPoint.h
+++ b/Opcode/Ice/IceHPoint.h
@@ -12,18 +12,18 @@
#ifndef __ICEHPOINT_H__
#define __ICEHPOINT_H__
- class ICEMATHS_API HPoint : public Point
+ class ICEMATHS_API HPoint : public IcePoint
{
public:
//! Empty constructor
inline_ HPoint() {}
//! Constructor from floats
- inline_ HPoint(float _x, float _y, float _z, float _w=0.0f) : Point(_x, _y, _z), w(_w) {}
+ inline_ HPoint(float _x, float _y, float _z, float _w=0.0f) : IcePoint(_x, _y, _z), w(_w) {}
//! Constructor from array
- inline_ HPoint(const float f[4]) : Point(f), w(f[3]) {}
+ inline_ HPoint(const float f[4]) : IcePoint(f), w(f[3]) {}
//! Constructor from a Point
- inline_ HPoint(const Point& p, float _w=0.0f) : Point(p), w(_w) {}
+ inline_ HPoint(const IcePoint& p, float _w=0.0f) : IcePoint(p), w(_w) {}
//! Destructor
inline_ ~HPoint() {}
@@ -129,7 +129,7 @@
// Arithmetic operators
//! Operator for Point Mul = HPoint * Matrix3x3;
- Point operator*(const Matrix3x3& mat) const;
+ IcePoint operator*(const Matrix3x3& mat) const;
//! Operator for HPoint Mul = HPoint * Matrix4x4;
HPoint operator*(const Matrix4x4& mat) const;
@@ -147,7 +147,7 @@
// Cast operators
//! Cast a HPoint to a Point. w is discarded.
- inline_ operator Point() const { return Point(x, y, z); }
+ inline_ operator HPoint() const { return IcePoint(x, y, z); }
public:
float w;
diff --git a/Opcode/Ice/IceIndexedTriangle.h b/Opcode/Ice/IceIndexedTriangle.h
index 0c497ee..5dc39ea 100644
--- a/Opcode/Ice/IceIndexedTriangle.h
+++ b/Opcode/Ice/IceIndexedTriangle.h
@@ -37,17 +37,17 @@
// Methods
void Flip();
- float Area(const Point* verts) const;
- float Perimeter(const Point* verts) const;
- float Compacity(const Point* verts) const;
- void Normal(const Point* verts, Point& normal) const;
- void DenormalizedNormal(const Point* verts, Point& normal) const;
- void Center(const Point* verts, Point& center) const;
- void CenteredNormal(const Point* verts, Point& normal) const;
- void RandomPoint(const Point* verts, Point& random) const;
- bool IsVisible(const Point* verts, const Point& source) const;
- bool BackfaceCulling(const Point* verts, const Point& source) const;
- float ComputeOcclusionPotential(const Point* verts, const Point& view) const;
+ float Area(const IcePoint* verts) const;
+ float Perimeter(const IcePoint* verts) const;
+ float Compacity(const IcePoint* verts) const;
+ void Normal(const IcePoint* verts, IcePoint& normal) const;
+ void DenormalizedNormal(const IcePoint* verts, IcePoint& normal) const;
+ void Center(const IcePoint* verts, IcePoint& center) const;
+ void CenteredNormal(const IcePoint* verts, IcePoint& normal) const;
+ void RandomPoint(const IcePoint* verts, IcePoint& random) const;
+ bool IsVisible(const IcePoint* verts, const IcePoint& source) const;
+ bool BackfaceCulling(const IcePoint* verts, const IcePoint& source) const;
+ float ComputeOcclusionPotential(const IcePoint* verts, const IcePoint& view) const;
bool ReplaceVertex(udword oldref, udword newref);
bool IsDegenerate() const;
bool HasVertex(udword ref) const;
@@ -56,13 +56,13 @@
udword OppositeVertex(udword vref0, udword vref1) const;
inline_ udword OppositeVertex(ubyte edgenb) const { return mVRef[2-edgenb]; }
void GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2) const;
- float MinEdgeLength(const Point* verts) const;
- float MaxEdgeLength(const Point* verts) const;
- void ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null) const;
- float Angle(const IndexedTriangle& tri, const Point* verts) const;
- inline_ Plane PlaneEquation(const Point* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
+ float MinEdgeLength(const IcePoint* verts) const;
+ float MaxEdgeLength(const IcePoint* verts) const;
+ void ComputePoint(const IcePoint* verts, float u, float v, IcePoint& pt, udword* nearvtx=null) const;
+ float Angle(const IndexedTriangle& tri, const IcePoint* verts) const;
+ inline_ Plane PlaneEquation(const IcePoint* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
bool Equal(const IndexedTriangle& tri) const;
- CubeIndex ComputeCubeIndex(const Point* verts) const;
+ CubeIndex ComputeCubeIndex(const IcePoint* verts) const;
};
#endif // __ICEINDEXEDTRIANGLE_H__
diff --git a/Opcode/Ice/IceLSS.h b/Opcode/Ice/IceLSS.h
index c16c29f..8c2c154 100644
--- a/Opcode/Ice/IceLSS.h
+++ b/Opcode/Ice/IceLSS.h
@@ -32,13 +32,13 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Tests if a point is contained within the LSS.
- * \param pt [in] the point to test
+ * Tests if a IcePoint is contained within the LSS.
+ * \param pt [in] the IcePoint to test
* \return true if inside the LSS
- * \warning point and LSS must be in same space
+ * \warning IcePoint and LSS must be in same space
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ bool Contains(const Point& pt) const { return SquareDistance(pt) <= mRadius*mRadius; }
+ inline_ bool Contains(const IcePoint& pt) const { return SquareDistance(pt) <= mRadius*mRadius; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
diff --git a/Opcode/Ice/IceMatrix3x3.h b/Opcode/Ice/IceMatrix3x3.h
index 2266fc5..5b8f141 100644
--- a/Opcode/Ice/IceMatrix3x3.h
+++ b/Opcode/Ice/IceMatrix3x3.h
@@ -43,13 +43,13 @@
}
//! Sets the scale from a Point. The point is put on the diagonal.
- inline_ void SetScale(const Point& p) { m[0][0] = p.x; m[1][1] = p.y; m[2][2] = p.z; }
+ inline_ void SetScale(const IcePoint& p) { m[0][0] = p.x; m[1][1] = p.y; m[2][2] = p.z; }
//! Sets the scale from floats. Values are put on the diagonal.
inline_ void SetScale(float sx, float sy, float sz) { m[0][0] = sx; m[1][1] = sy; m[2][2] = sz; }
//! Scales from a Point. Each row is multiplied by a component.
- inline_ void Scale(const Point& p)
+ inline_ void Scale(const IcePoint& p)
{
m[0][0] *= p.x; m[0][1] *= p.x; m[0][2] *= p.x;
m[1][0] *= p.y; m[1][1] *= p.y; m[1][2] *= p.y;
@@ -69,17 +69,17 @@
// Row-column access
//! Returns a row.
- inline_ void GetRow(const udword r, Point& p) const { p.x = m[r][0]; p.y = m[r][1]; p.z = m[r][2]; }
+ inline_ void GetRow(const udword r, IcePoint& p) const { p.x = m[r][0]; p.y = m[r][1]; p.z = m[r][2]; }
//! Returns a row.
- inline_ const Point& GetRow(const udword r) const { return *(const Point*)&m[r][0]; }
+ inline_ const IcePoint& GetRow(const udword r) const { return *(const IcePoint*)&m[r][0]; }
//! Returns a row.
- inline_ Point& GetRow(const udword r) { return *(Point*)&m[r][0]; }
+ inline_ IcePoint& GetRow(const udword r) { return *(IcePoint*)&m[r][0]; }
//! Sets a row.
- inline_ void SetRow(const udword r, const Point& p) { m[r][0] = p.x; m[r][1] = p.y; m[r][2] = p.z; }
+ inline_ void SetRow(const udword r, const IcePoint& p) { m[r][0] = p.x; m[r][1] = p.y; m[r][2] = p.z; }
//! Returns a column.
- inline_ void GetCol(const udword c, Point& p) const { p.x = m[0][c]; p.y = m[1][c]; p.z = m[2][c]; }
+ inline_ void GetCol(const udword c, IcePoint& p) const { p.x = m[0][c]; p.y = m[1][c]; p.z = m[2][c]; }
//! Sets a column.
- inline_ void SetCol(const udword c, const Point& p) { m[0][c] = p.x; m[1][c] = p.y; m[2][c] = p.z; }
+ inline_ void SetCol(const udword c, const IcePoint& p) { m[0][c] = p.x; m[1][c] = p.y; m[2][c] = p.z; }
//! Computes the trace. The trace is the sum of the 3 diagonal components.
inline_ float Trace() const { return m[0][0] + m[1][1] + m[2][2]; }
@@ -124,7 +124,7 @@
//! [ -a.y a.x 0.0 ]
//! This is also called a "cross matrix" since for any vectors A and B,
//! A^B = Skew(A) * B = - B * Skew(A);
- inline_ void SkewSymmetric(const Point& a)
+ inline_ void SkewSymmetric(const IcePoint& a)
{
m[0][0] = 0.0f;
m[0][1] = -a.z;
@@ -258,7 +258,7 @@
}
//! Makes a rotation matrix mapping vector "from" to vector "to".
- Matrix3x3& FromTo(const Point& from, const Point& to);
+ Matrix3x3& FromTo(const IcePoint& from, const IcePoint& to);
//! Set a rotation matrix around the X axis.
//! 1 0 0
@@ -281,7 +281,7 @@
void RotYX(float y, float x);
//! Make a rotation matrix about an arbitrary axis
- Matrix3x3& Rot(float angle, const Point& axis);
+ Matrix3x3& Rot(float angle, const IcePoint& axis);
//! Transpose the matrix.
void Transpose()
@@ -380,7 +380,7 @@ void FromQuatL2(const Quat &q, float l2);
}
//! Operator for Point Mul = Matrix3x3 * Point;
- inline_ Point operator*(const Point& v) const { return Point(GetRow(0)|v, GetRow(1)|v, GetRow(2)|v); }
+ inline_ IcePoint operator*(const IcePoint& v) const { return IcePoint(GetRow(0)|v, GetRow(1)|v, GetRow(2)|v); }
//! Operator for Matrix3x3 Mul = Matrix3x3 * float;
inline_ Matrix3x3 operator*(float s) const
@@ -440,7 +440,7 @@ void FromQuatL2(const Quat &q, float l2);
//! Operator for Matrix3x3 *= Matrix3x3
inline_ Matrix3x3& operator*=(const Matrix3x3& mat)
{
- Point TempRow;
+ IcePoint TempRow;
GetRow(0, TempRow);
m[0][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0];
@@ -484,8 +484,8 @@ void FromQuatL2(const Quat &q, float l2);
//! Cast a Matrix3x3 to a Quat.
operator Quat() const;
- inline_ const Point& operator[](int row) const { return *(const Point*)&m[row][0]; }
- inline_ Point& operator[](int row) { return *(Point*)&m[row][0]; }
+ inline_ const IcePoint& operator[](int row) const { return *(const IcePoint*)&m[row][0]; }
+ inline_ IcePoint& operator[](int row) { return *(IcePoint*)&m[row][0]; }
public:
diff --git a/Opcode/Ice/IceMatrix4x4.h b/Opcode/Ice/IceMatrix4x4.h
index d61a461..0b08a4a 100644
--- a/Opcode/Ice/IceMatrix4x4.h
+++ b/Opcode/Ice/IceMatrix4x4.h
@@ -72,7 +72,7 @@
//! Returns a row.
inline_ void GetRow(const udword r, HPoint& p) const { p.x=m[r][0]; p.y=m[r][1]; p.z=m[r][2]; p.w=m[r][3]; }
//! Returns a row.
- inline_ void GetRow(const udword r, Point& p) const { p.x=m[r][0]; p.y=m[r][1]; p.z=m[r][2]; }
+ inline_ void GetRow(const udword r, IcePoint& p) const { p.x=m[r][0]; p.y=m[r][1]; p.z=m[r][2]; }
//! Returns a row.
inline_ const HPoint& GetRow(const udword r) const { return *(const HPoint*)&m[r][0]; }
//! Returns a row.
@@ -80,23 +80,23 @@
//! Sets a row.
inline_ void SetRow(const udword r, const HPoint& p) { m[r][0]=p.x; m[r][1]=p.y; m[r][2]=p.z; m[r][3]=p.w; }
//! Sets a row.
- inline_ void SetRow(const udword r, const Point& p) { m[r][0]=p.x; m[r][1]=p.y; m[r][2]=p.z; m[r][3]= (r!=3) ? 0.0f : 1.0f; }
+ inline_ void SetRow(const udword r, const IcePoint& p) { m[r][0]=p.x; m[r][1]=p.y; m[r][2]=p.z; m[r][3]= (r!=3) ? 0.0f : 1.0f; }
//! Returns a column.
inline_ void GetCol(const udword c, HPoint& p) const { p.x=m[0][c]; p.y=m[1][c]; p.z=m[2][c]; p.w=m[3][c]; }
//! Returns a column.
- inline_ void GetCol(const udword c, Point& p) const { p.x=m[0][c]; p.y=m[1][c]; p.z=m[2][c]; }
+ inline_ void GetCol(const udword c, IcePoint& p) const { p.x=m[0][c]; p.y=m[1][c]; p.z=m[2][c]; }
//! Sets a column.
inline_ void SetCol(const udword c, const HPoint& p) { m[0][c]=p.x; m[1][c]=p.y; m[2][c]=p.z; m[3][c]=p.w; }
//! Sets a column.
- inline_ void SetCol(const udword c, const Point& p) { m[0][c]=p.x; m[1][c]=p.y; m[2][c]=p.z; m[3][c]= (c!=3) ? 0.0f : 1.0f; }
+ inline_ void SetCol(const udword c, const IcePoint& p) { m[0][c]=p.x; m[1][c]=p.y; m[2][c]=p.z; m[3][c]= (c!=3) ? 0.0f : 1.0f; }
// Translation
//! Returns the translation part of the matrix.
inline_ const HPoint& GetTrans() const { return GetRow(3); }
//! Gets the translation part of the matrix
- inline_ void GetTrans(Point& p) const { p.x=m[3][0]; p.y=m[3][1]; p.z=m[3][2]; }
+ inline_ void GetTrans(IcePoint& p) const { p.x=m[3][0]; p.y=m[3][1]; p.z=m[3][2]; }
//! Sets the translation part of the matrix, from a Point.
- inline_ void SetTrans(const Point& p) { m[3][0]=p.x; m[3][1]=p.y; m[3][2]=p.z; }
+ inline_ void SetTrans(const IcePoint& p) { m[3][0]=p.x; m[3][1]=p.y; m[3][2]=p.z; }
//! Sets the translation part of the matrix, from a HPoint.
inline_ void SetTrans(const HPoint& p) { m[3][0]=p.x; m[3][1]=p.y; m[3][2]=p.z; m[3][3]=p.w; }
//! Sets the translation part of the matrix, from floats.
@@ -104,11 +104,11 @@
// Scale
//! Sets the scale from a Point. The point is put on the diagonal.
- inline_ void SetScale(const Point& p) { m[0][0]=p.x; m[1][1]=p.y; m[2][2]=p.z; }
+ inline_ void SetScale(const IcePoint& p) { m[0][0]=p.x; m[1][1]=p.y; m[2][2]=p.z; }
//! Sets the scale from floats. Values are put on the diagonal.
inline_ void SetScale(float sx, float sy, float sz) { m[0][0]=sx; m[1][1]=sy; m[2][2]=sz; }
//! Scales from a Point. Each row is multiplied by a component.
- void Scale(const Point& p)
+ void Scale(const IcePoint& p)
{
m[0][0] *= p.x; m[1][0] *= p.y; m[2][0] *= p.z;
m[0][1] *= p.x; m[1][1] *= p.y; m[2][1] *= p.z;
@@ -218,7 +218,7 @@
void RotZ(float angle) { float Cos = cosf(angle), Sin = sinf(angle); Identity(); m[0][0] = m[1][1] = Cos; m[1][0] = -Sin; m[0][1] = Sin; }
//! Makes a rotation matrix about an arbitrary axis
- Matrix4x4& Rot(float angle, Point& p1, Point& p2);
+ Matrix4x4& Rot(float angle, IcePoint& p1, IcePoint& p2);
//! Transposes the matrix.
void Transpose()
@@ -303,9 +303,9 @@
inline_ HPoint operator*(const HPoint& v) const { return HPoint(GetRow(0)|v, GetRow(1)|v, GetRow(2)|v, GetRow(3)|v); }
//! Operator for Point Mul = Matrix4x4 * Point;
- inline_ Point operator*(const Point& v) const
+ inline_ IcePoint operator*(const IcePoint& v) const
{
- return Point( m[0][0]*v.x + m[0][1]*v.y + m[0][2]*v.z + m[0][3],
+ return IcePoint( m[0][0]*v.x + m[0][1]*v.y + m[0][2]*v.z + m[0][3],
m[1][0]*v.x + m[1][1]*v.y + m[1][2]*v.z + m[1][3],
m[2][0]*v.x + m[2][1]*v.y + m[2][2]*v.z + m[2][3] );
}
@@ -434,7 +434,7 @@
};
//! Quickly rotates & translates a vector, using the 4x3 part of a 4x4 matrix
- inline_ void TransformPoint4x3(Point& dest, const Point& source, const Matrix4x4& rot)
+ inline_ void TransformPoint4x3(IcePoint& dest, const IcePoint& source, const Matrix4x4& rot)
{
dest.x = rot.m[3][0] + source.x * rot.m[0][0] + source.y * rot.m[1][0] + source.z * rot.m[2][0];
dest.y = rot.m[3][1] + source.x * rot.m[0][1] + source.y * rot.m[1][1] + source.z * rot.m[2][1];
@@ -442,7 +442,7 @@
}
//! Quickly rotates a vector, using the 3x3 part of a 4x4 matrix
- inline_ void TransformPoint3x3(Point& dest, const Point& source, const Matrix4x4& rot)
+ inline_ void TransformPoint3x3(IcePoint& dest, const IcePoint& source, const Matrix4x4& rot)
{
dest.x = source.x * rot.m[0][0] + source.y * rot.m[1][0] + source.z * rot.m[2][0];
dest.y = source.x * rot.m[0][1] + source.y * rot.m[1][1] + source.z * rot.m[2][1];
diff --git a/Opcode/Ice/IceOBB.h b/Opcode/Ice/IceOBB.h
index 4747f7f..2badb18 100644
--- a/Opcode/Ice/IceOBB.h
+++ b/Opcode/Ice/IceOBB.h
@@ -21,7 +21,7 @@
//! Constructor
inline_ OBB() {}
//! Constructor
- inline_ OBB(const Point& center, const Point& extents, const Matrix3x3& rot) : mCenter(center), mExtents(extents), mRot(rot) {}
+ inline_ OBB(const IcePoint& center, const IcePoint& extents, const Matrix3x3& rot) : mCenter(center), mExtents(extents), mRot(rot) {}
//! Destructor
inline_ ~OBB() {}
@@ -39,12 +39,12 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Tests if a point is contained within the OBB.
- * \param p [in] the world point to test
+ * Tests if a IcePoint is contained within the OBB.
+ * \param p [in] the world IcePoint to test
* \return true if inside the OBB
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- bool ContainsPoint(const Point& p) const;
+ bool ContainsPoint(const IcePoint& p) const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -103,7 +103,7 @@
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- bool ComputePoints(Point* pts) const;
+ bool ComputePoints(IcePoint* pts) const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -112,7 +112,7 @@
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- bool ComputeVertexNormals(Point* pts) const;
+ bool ComputeVertexNormals(IcePoint* pts) const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -128,7 +128,7 @@
* \return edge normals in local space
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- const Point* GetLocalEdgeNormals() const;
+ const IcePoint* GetLocalEdgeNormals() const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -137,7 +137,7 @@
* \param world_normal [out] edge normal in world space
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void ComputeWorldEdgeNormal(udword edge_index, Point& world_normal) const;
+ void ComputeWorldEdgeNormal(udword edge_index, IcePoint& world_normal) const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -156,8 +156,8 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL IsInside(const OBB& box) const;
- inline_ const Point& GetCenter() const { return mCenter; }
- inline_ const Point& GetExtents() const { return mExtents; }
+ inline_ const IcePoint& GetCenter() const { return mCenter; }
+ inline_ const IcePoint& GetExtents() const { return mExtents; }
inline_ const Matrix3x3& GetRot() const { return mRot; }
inline_ void GetRotatedExtents(Matrix3x3& extents) const
@@ -166,8 +166,8 @@
extents.Scale(mExtents);
}
- Point mCenter; //!< B for Box
- Point mExtents; //!< B for Bounding
+ IcePoint mCenter; //!< B for Box
+ IcePoint mExtents; //!< B for Bounding
Matrix3x3 mRot; //!< O for Oriented
// Orientation is stored in row-major format,
diff --git a/Opcode/Ice/IcePlane.cpp b/Opcode/Ice/IcePlane.cpp
index 36fe473..cd4758c 100644
--- a/Opcode/Ice/IcePlane.cpp
+++ b/Opcode/Ice/IcePlane.cpp
@@ -25,16 +25,16 @@ using namespace IceMaths;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Computes the plane equation from 3 points.
- * \param p0 [in] first point
- * \param p1 [in] second point
- * \param p2 [in] third point
+ * \param p0 [in] first IcePoint
+ * \param p1 [in] second IcePoint
+ * \param p2 [in] third IcePoint
* \return Self-reference
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-Plane& Plane::Set(const Point& p0, const Point& p1, const Point& p2)
+Plane& Plane::Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2)
{
- Point Edge0 = p1 - p0;
- Point Edge1 = p2 - p0;
+ IcePoint Edge0 = p1 - p0;
+ IcePoint Edge1 = p2 - p0;
n = Edge0 ^ Edge1;
n.Normalize();
diff --git a/Opcode/Ice/IcePlane.h b/Opcode/Ice/IcePlane.h
index 0e0604c..d514e68 100644
--- a/Opcode/Ice/IcePlane.h
+++ b/Opcode/Ice/IcePlane.h
@@ -22,11 +22,11 @@
//! Constructor from a normal and a distance
inline_ Plane(float nx, float ny, float nz, float d) { Set(nx, ny, nz, d); }
//! Constructor from a point on the plane and a normal
- inline_ Plane(const Point& p, const Point& n) { Set(p, n); }
+ inline_ Plane(const IcePoint& p, const IcePoint& n) { Set(p, n); }
//! Constructor from three points
- inline_ Plane(const Point& p0, const Point& p1, const Point& p2) { Set(p0, p1, p2); }
+ inline_ Plane(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) { Set(p0, p1, p2); }
//! Constructor from a normal and a distance
- inline_ Plane(const Point& _n, float _d) { n = _n; d = _d; }
+ inline_ Plane(const IcePoint& _n, float _d) { n = _n; d = _d; }
//! Copy constructor
inline_ Plane(const Plane& plane) : n(plane.n), d(plane.d) { }
//! Destructor
@@ -34,11 +34,11 @@
inline_ Plane& Zero() { n.Zero(); d = 0.0f; return *this; }
inline_ Plane& Set(float nx, float ny, float nz, float _d) { n.Set(nx, ny, nz); d = _d; return *this; }
- inline_ Plane& Set(const Point& p, const Point& _n) { n = _n; d = - p | _n; return *this; }
- Plane& Set(const Point& p0, const Point& p1, const Point& p2);
+ inline_ Plane& Set(const IcePoint& p, const IcePoint& _n) { n = _n; d = - p | _n; return *this; }
+ Plane& Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2);
- inline_ float Distance(const Point& p) const { return (p | n) + d; }
- inline_ bool Belongs(const Point& p) const { return fabsf(Distance(p)) < PLANE_EPSILON; }
+ inline_ float Distance(const IcePoint& p) const { return (p | n) + d; }
+ inline_ bool Belongs(const IcePoint& p) const { return fabsf(Distance(p)) < PLANE_EPSILON; }
inline_ void Normalize()
{
@@ -50,11 +50,11 @@
}
public:
// Members
- Point n; //!< The normal to the plane
+ IcePoint n; //!< The normal to the plane
float d; //!< The distance from the origin
// Cast operators
- inline_ operator Point() const { return n; }
+ inline_ operator IcePoint() const { return n; }
inline_ operator HPoint() const { return HPoint(n, d); }
// Arithmetic operators
@@ -68,8 +68,8 @@
inline_ Plane& operator*=(const Matrix4x4& m)
{
// Old code from Irion. Kept for reference.
- Point n2 = HPoint(n, 0.0f) * m;
- d = -((Point) (HPoint( -d*n, 1.0f ) * m) | n2);
+ IcePoint n2 = HPoint(n, 0.0f) * m;
+ d = -((IcePoint) (HPoint( -d*n, 1.0f ) * m) | n2);
n = n2;
return *this;
}
@@ -90,7 +90,7 @@
transformed.n = plane.n * Matrix3x3(transform);
// Compute new d
- transformed.d = plane.d - (Point(transform.GetTrans())|transformed.n);
+ transformed.d = plane.d - (IcePoint(transform.GetTrans())|transformed.n);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -107,7 +107,7 @@
plane.n *= Matrix3x3(transform);
// Compute new d
- plane.d -= Point(transform.GetTrans())|plane.n;
+ plane.d -= IcePoint(transform.GetTrans())|plane.n;
}
#endif // __ICEPLANE_H__
diff --git a/Opcode/Ice/IcePoint.cpp b/Opcode/Ice/IcePoint.cpp
index 9fd7570..717fc53 100644
--- a/Opcode/Ice/IcePoint.cpp
+++ b/Opcode/Ice/IcePoint.cpp
@@ -56,7 +56,7 @@ using namespace IceMaths;
* \return Self-reference
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-Point& Point::PositiveUnitRandomVector()
+IcePoint& IcePoint::PositiveUnitRandomVector()
{
x = UnitRandomFloat();
y = UnitRandomFloat();
@@ -71,7 +71,7 @@ Point& Point::PositiveUnitRandomVector()
* \return Self-reference
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-Point& Point::UnitRandomVector()
+IcePoint& IcePoint::UnitRandomVector()
{
x = UnitRandomFloat() - 0.5f;
y = UnitRandomFloat() - 0.5f;
@@ -82,16 +82,16 @@ Point& Point::UnitRandomVector()
// Cast operator
// WARNING: not inlined
-Point::operator HPoint() const { return HPoint(x, y, z, 0.0f); }
+IcePoint::operator HPoint() const { return HPoint(x, y, z, 0.0f); }
-Point& Point::Refract(const Point& eye, const Point& n, float refractindex, Point& refracted)
+IcePoint& IcePoint::Refract(const IcePoint& eye, const IcePoint& n, float refractindex, IcePoint& refracted)
{
- // Point EyePt = eye position
- // Point p = current vertex
- // Point n = vertex normal
- // Point rv = refracted vector
+ // IcePoint EyePt = eye position
+ // IcePoint p = current vertex
+ // IcePoint n = vertex normal
+ // IcePoint rv = refracted vector
// Eye vector - doesn't need to be normalized
- Point Env;
+ IcePoint Env;
Env.x = eye.x - x;
Env.y = eye.y - y;
Env.z = eye.z - z;
@@ -106,13 +106,13 @@ Point& Point::Refract(const Point& eye, const Point& n, float refractindex, Poin
return *this;
}
-Point& Point::ProjectToPlane(const Plane& p)
+IcePoint& IcePoint::ProjectToPlane(const Plane& p)
{
*this-= (p.d + (*this|p.n))*p.n;
return *this;
}
-void Point::ProjectToScreen(float halfrenderwidth, float halfrenderheight, const Matrix4x4& mat, HPoint& projected) const
+void IcePoint::ProjectToScreen(float halfrenderwidth, float halfrenderheight, const Matrix4x4& mat, HPoint& projected) const
{
projected = HPoint(x, y, z, 1.0f) * mat;
projected.w = 1.0f / projected.w;
@@ -125,7 +125,7 @@ void Point::ProjectToScreen(float halfrenderwidth, float halfrenderheight, const
projected.y *= -halfrenderheight; projected.y += halfrenderheight;
}
-void Point::SetNotUsed()
+void IcePoint::SetNotUsed()
{
// We use a particular integer pattern : 0xffffffff everywhere. This is a NAN.
IR(x) = 0xffffffff;
@@ -133,7 +133,7 @@ void Point::SetNotUsed()
IR(z) = 0xffffffff;
}
-BOOL Point::IsNotUsed() const
+BOOL IcePoint::IsNotUsed() const
{
if(IR(x)!=0xffffffff) return FALSE;
if(IR(y)!=0xffffffff) return FALSE;
@@ -141,7 +141,7 @@ BOOL Point::IsNotUsed() const
return TRUE;
}
-Point& Point::Mult(const Matrix3x3& mat, const Point& a)
+IcePoint& IcePoint::Mult(const Matrix3x3& mat, const IcePoint& a)
{
x = a.x * mat.m[0][0] + a.y * mat.m[0][1] + a.z * mat.m[0][2];
y = a.x * mat.m[1][0] + a.y * mat.m[1][1] + a.z * mat.m[1][2];
@@ -149,7 +149,7 @@ Point& Point::Mult(const Matrix3x3& mat, const Point& a)
return *this;
}
-Point& Point::Mult2(const Matrix3x3& mat1, const Point& a1, const Matrix3x3& mat2, const Point& a2)
+IcePoint& IcePoint::Mult2(const Matrix3x3& mat1, const IcePoint& a1, const Matrix3x3& mat2, const IcePoint& a2)
{
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];
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,7 +157,7 @@ Point& Point::Mult2(const Matrix3x3& mat1, const Point& a1, const Matrix3x3& mat
return *this;
}
-Point& Point::Mac(const Matrix3x3& mat, const Point& a)
+IcePoint& IcePoint::Mac(const Matrix3x3& mat, const IcePoint& a)
{
x += a.x * mat.m[0][0] + a.y * mat.m[0][1] + a.z * mat.m[0][2];
y += a.x * mat.m[1][0] + a.y * mat.m[1][1] + a.z * mat.m[1][2];
@@ -165,7 +165,7 @@ Point& Point::Mac(const Matrix3x3& mat, const Point& a)
return *this;
}
-Point& Point::TransMult(const Matrix3x3& mat, const Point& a)
+IcePoint& IcePoint::TransMult(const Matrix3x3& mat, const IcePoint& a)
{
x = a.x * mat.m[0][0] + a.y * mat.m[1][0] + a.z * mat.m[2][0];
y = a.x * mat.m[0][1] + a.y * mat.m[1][1] + a.z * mat.m[2][1];
@@ -173,7 +173,7 @@ Point& Point::TransMult(const Matrix3x3& mat, const Point& a)
return *this;
}
-Point& Point::Transform(const Point& r, const Matrix3x3& rotpos, const Point& linpos)
+IcePoint& IcePoint::Transform(const IcePoint& r, const Matrix3x3& rotpos, const IcePoint& linpos)
{
x = r.x * rotpos.m[0][0] + r.y * rotpos.m[0][1] + r.z * rotpos.m[0][2] + linpos.x;
y = r.x * rotpos.m[1][0] + r.y * rotpos.m[1][1] + r.z * rotpos.m[1][2] + linpos.y;
@@ -181,7 +181,7 @@ Point& Point::Transform(const Point& r, const Matrix3x3& rotpos, const Point& li
return *this;
}
-Point& Point::InvTransform(const Point& r, const Matrix3x3& rotpos, const Point& linpos)
+IcePoint& IcePoint::InvTransform(const IcePoint& r, const Matrix3x3& rotpos, const IcePoint& linpos)
{
float sx = r.x - linpos.x;
float sy = r.y - linpos.y;
diff --git a/Opcode/Ice/IcePoint.h b/Opcode/Ice/IcePoint.h
index 78148d6..7f55a27 100644
--- a/Opcode/Ice/IcePoint.h
+++ b/Opcode/Ice/IcePoint.h
@@ -22,72 +22,72 @@
const float EPSILON2 = 1.0e-20f;
- class ICEMATHS_API Point
+ class ICEMATHS_API IcePoint
{
public:
//! Empty constructor
- inline_ Point() {}
+ inline_ IcePoint() {}
//! Constructor from a single float
// inline_ Point(float val) : x(val), y(val), z(val) {}
// Removed since it introduced the nasty "Point T = *Matrix4x4.GetTrans();" bug.......
//! Constructor from floats
- inline_ Point(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}
+ inline_ IcePoint(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}
//! Constructor from array
- inline_ Point(const float f[3]) : x(f[_X]), y(f[_Y]), z(f[_Z]) {}
+ inline_ IcePoint(const float f[3]) : x(f[_X]), y(f[_Y]), z(f[_Z]) {}
//! Copy constructor
- inline_ Point(const Point& p) : x(p.x), y(p.y), z(p.z) {}
+ inline_ IcePoint(const IcePoint& p) : x(p.x), y(p.y), z(p.z) {}
//! Destructor
- inline_ ~Point() {}
+ inline_ ~IcePoint() {}
//! Clears the vector
- inline_ Point& Zero() { x = y = z = 0.0f; return *this; }
+ inline_ IcePoint& Zero() { x = y = z = 0.0f; return *this; }
//! + infinity
- inline_ Point& SetPlusInfinity() { x = y = z = MAX_FLOAT; return *this; }
+ inline_ IcePoint& SetPlusInfinity() { x = y = z = MAX_FLOAT; return *this; }
//! - infinity
- inline_ Point& SetMinusInfinity() { x = y = z = MIN_FLOAT; return *this; }
+ inline_ IcePoint& SetMinusInfinity() { x = y = z = MIN_FLOAT; return *this; }
//! Sets positive unit random vector
- Point& PositiveUnitRandomVector();
+ IcePoint& PositiveUnitRandomVector();
//! Sets unit random vector
- Point& UnitRandomVector();
+ IcePoint& UnitRandomVector();
//! Assignment from values
- inline_ Point& Set(float _x, float _y, float _z) { x = _x; y = _y; z = _z; return *this; }
+ inline_ IcePoint& Set(float _x, float _y, float _z) { x = _x; y = _y; z = _z; return *this; }
//! Assignment from array
- inline_ Point& Set(const float f[3]) { x = f[_X]; y = f[_Y]; z = f[_Z]; return *this; }
+ inline_ IcePoint& Set(const float f[3]) { x = f[_X]; y = f[_Y]; z = f[_Z]; return *this; }
//! Assignment from another point
- inline_ Point& Set(const Point& src) { x = src.x; y = src.y; z = src.z; return *this; }
+ inline_ IcePoint& Set(const IcePoint& src) { x = src.x; y = src.y; z = src.z; return *this; }
//! Adds a vector
- inline_ Point& Add(const Point& p) { x += p.x; y += p.y; z += p.z; return *this; }
+ inline_ IcePoint& Add(const IcePoint& p) { x += p.x; y += p.y; z += p.z; return *this; }
//! Adds a vector
- inline_ Point& Add(float _x, float _y, float _z) { x += _x; y += _y; z += _z; return *this; }
+ inline_ IcePoint& Add(float _x, float _y, float _z) { x += _x; y += _y; z += _z; return *this; }
//! Adds a vector
- inline_ Point& Add(const float f[3]) { x += f[_X]; y += f[_Y]; z += f[_Z]; return *this; }
+ inline_ IcePoint& Add(const float f[3]) { x += f[_X]; y += f[_Y]; z += f[_Z]; return *this; }
//! Adds vectors
- inline_ Point& Add(const Point& p, const Point& q) { x = p.x+q.x; y = p.y+q.y; z = p.z+q.z; return *this; }
+ inline_ IcePoint& Add(const IcePoint& p, const IcePoint& q) { x = p.x+q.x; y = p.y+q.y; z = p.z+q.z; return *this; }
//! Subtracts a vector
- inline_ Point& Sub(const Point& p) { x -= p.x; y -= p.y; z -= p.z; return *this; }
+ inline_ IcePoint& Sub(const IcePoint& p) { x -= p.x; y -= p.y; z -= p.z; return *this; }
//! Subtracts a vector
- inline_ Point& Sub(float _x, float _y, float _z) { x -= _x; y -= _y; z -= _z; return *this; }
+ inline_ IcePoint& Sub(float _x, float _y, float _z) { x -= _x; y -= _y; z -= _z; return *this; }
//! Subtracts a vector
- inline_ Point& Sub(const float f[3]) { x -= f[_X]; y -= f[_Y]; z -= f[_Z]; return *this; }
+ inline_ IcePoint& Sub(const float f[3]) { x -= f[_X]; y -= f[_Y]; z -= f[_Z]; return *this; }
//! Subtracts vectors
- inline_ Point& Sub(const Point& p, const Point& q) { x = p.x-q.x; y = p.y-q.y; z = p.z-q.z; return *this; }
+ inline_ IcePoint& Sub(const IcePoint& p, const IcePoint& q) { x = p.x-q.x; y = p.y-q.y; z = p.z-q.z; return *this; }
//! this = -this
- inline_ Point& Neg() { x = -x; y = -y; z = -z; return *this; }
+ inline_ IcePoint& Neg() { x = -x; y = -y; z = -z; return *this; }
//! this = -a
- inline_ Point& Neg(const Point& a) { x = -a.x; y = -a.y; z = -a.z; return *this; }
+ inline_ IcePoint& Neg(const IcePoint& a) { x = -a.x; y = -a.y; z = -a.z; return *this; }
//! Multiplies by a scalar
- inline_ Point& Mult(float s) { x *= s; y *= s; z *= s; return *this; }
+ inline_ IcePoint& Mult(float s) { x *= s; y *= s; z *= s; return *this; }
//! this = a * scalar
- inline_ Point& Mult(const Point& a, float scalar)
+ inline_ IcePoint& Mult(const IcePoint& a, float scalar)
{
x = a.x * scalar;
y = a.y * scalar;
@@ -96,7 +96,7 @@
}
//! this = a + b * scalar
- inline_ Point& Mac(const Point& a, const Point& b, float scalar)
+ inline_ IcePoint& Mac(const IcePoint& a, const IcePoint& b, float scalar)
{
x = a.x + b.x * scalar;
y = a.y + b.y * scalar;
@@ -105,7 +105,7 @@
}
//! this = this + a * scalar
- inline_ Point& Mac(const Point& a, float scalar)
+ inline_ IcePoint& Mac(const IcePoint& a, float scalar)
{
x += a.x * scalar;
y += a.y * scalar;
@@ -114,7 +114,7 @@
}
//! this = a - b * scalar
- inline_ Point& Msc(const Point& a, const Point& b, float scalar)
+ inline_ IcePoint& Msc(const IcePoint& a, const IcePoint& b, float scalar)
{
x = a.x - b.x * scalar;
y = a.y - b.y * scalar;
@@ -123,7 +123,7 @@
}
//! this = this - a * scalar
- inline_ Point& Msc(const Point& a, float scalar)
+ inline_ IcePoint& Msc(const IcePoint& a, float scalar)
{
x -= a.x * scalar;
y -= a.y * scalar;
@@ -132,7 +132,7 @@
}
//! this = a + b * scalarb + c * scalarc
- inline_ Point& Mac2(const Point& a, const Point& b, float scalarb, const Point& c, float scalarc)
+ inline_ IcePoint& Mac2(const IcePoint& a, const IcePoint& b, float scalarb, const IcePoint& c, float scalarc)
{
x = a.x + b.x * scalarb + c.x * scalarc;
y = a.y + b.y * scalarb + c.y * scalarc;
@@ -141,7 +141,7 @@
}
//! this = a - b * scalarb - c * scalarc
- inline_ Point& Msc2(const Point& a, const Point& b, float scalarb, const Point& c, float scalarc)
+ inline_ IcePoint& Msc2(const IcePoint& a, const IcePoint& b, float scalarb, const IcePoint& c, float scalarc)
{
x = a.x - b.x * scalarb - c.x * scalarc;
y = a.y - b.y * scalarb - c.y * scalarc;
@@ -150,19 +150,19 @@
}
//! this = mat * a
- inline_ Point& Mult(const Matrix3x3& mat, const Point& a);
+ inline_ IcePoint& Mult(const Matrix3x3& mat, const IcePoint& a);
//! this = mat1 * a1 + mat2 * a2
- inline_ Point& Mult2(const Matrix3x3& mat1, const Point& a1, const Matrix3x3& mat2, const Point& a2);
+ inline_ IcePoint& Mult2(const Matrix3x3& mat1, const IcePoint& a1, const Matrix3x3& mat2, const IcePoint& a2);
//! this = this + mat * a
- inline_ Point& Mac(const Matrix3x3& mat, const Point& a);
+ inline_ IcePoint& Mac(const Matrix3x3& mat, const IcePoint& a);
//! this = transpose(mat) * a
- inline_ Point& TransMult(const Matrix3x3& mat, const Point& a);
+ inline_ IcePoint& TransMult(const Matrix3x3& mat, const IcePoint& a);
//! Linear interpolate between two vectors: this = a + t * (b - a)
- inline_ Point& Lerp(const Point& a, const Point& b, float t)
+ inline_ IcePoint& Lerp(const IcePoint& a, const IcePoint& b, float t)
{
x = a.x + t * (b.x - a.x);
y = a.y + t * (b.y - a.y);
@@ -175,7 +175,7 @@
//! + p1 * (3t^3 - 5t^2 + 2)/2
//! + p2 * (4t^2 - 3t^3 + t)/2
//! + p3 * (t^3 - t^2)/2
- inline_ Point& Herp(const Point& p0, const Point& p1, const Point& p2, const Point& p3, float t)
+ inline_ IcePoint& Herp(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2, const IcePoint& p3, float t)
{
float t2 = t * t;
float t3 = t2 * t;
@@ -190,22 +190,22 @@
}
//! this = rotpos * r + linpos
- inline_ Point& Transform(const Point& r, const Matrix3x3& rotpos, const Point& linpos);
+ inline_ IcePoint& Transform(const IcePoint& r, const Matrix3x3& rotpos, const IcePoint& linpos);
//! this = trans(rotpos) * (r - linpos)
- inline_ Point& InvTransform(const Point& r, const Matrix3x3& rotpos, const Point& linpos);
+ inline_ IcePoint& InvTransform(const IcePoint& r, const Matrix3x3& rotpos, const IcePoint& linpos);
//! Returns MIN(x, y, z);
inline_ float Min() const { return MIN(x, MIN(y, z)); }
//! Returns MAX(x, y, z);
inline_ float Max() const { return MAX(x, MAX(y, z)); }
//! Sets each element to be componentwise minimum
- inline_ Point& Min(const Point& p) { x = MIN(x, p.x); y = MIN(y, p.y); z = MIN(z, p.z); return *this; }
+ inline_ IcePoint& Min(const IcePoint& p) { x = MIN(x, p.x); y = MIN(y, p.y); z = MIN(z, p.z); return *this; }
//! Sets each element to be componentwise maximum
- inline_ Point& Max(const Point& p) { x = MAX(x, p.x); y = MAX(y, p.y); z = MAX(z, p.z); return *this; }
+ inline_ IcePoint& Max(const IcePoint& p) { x = MAX(x, p.x); y = MAX(y, p.y); z = MAX(z, p.z); return *this; }
//! Clamps each element
- inline_ Point& Clamp(float min, float max)
+ inline_ IcePoint& Clamp(float min, float max)
{
if(x<min) x=min; if(x>max) x=max;
if(y<min) y=min; if(y>max) y=max;
@@ -220,7 +220,7 @@
//! Computes volume
inline_ float Volume() const { return x * y * z; }
- //! Checks the point is near zero
+ //! Checks the IcePoint is near zero
inline_ bool ApproxZero() const { return SquareMagnitude() < EPSILON2; }
//! Tests for exact zero vector
@@ -230,7 +230,7 @@
return TRUE;
}
- //! Checks point validity
+ //! Checks IcePoint validity
inline_ BOOL IsValid() const
{
if(!IsValidFloat(x)) return FALSE;
@@ -239,7 +239,7 @@
return TRUE;
}
- //! Slighty moves the point
+ //! Slighty moves the IcePoint
void Tweak(udword coord_mask, udword tweak_mask)
{
if(coord_mask&1) { udword Dummy = IR(x); Dummy^=tweak_mask; x = FR(Dummy); }
@@ -249,7 +249,7 @@
#define TWEAKMASK 0x3fffff
#define TWEAKNOTMASK ~TWEAKMASK
- //! Slighty moves the point out
+ //! Slighty moves the IcePoint out
inline_ void TweakBigger()
{
udword Dummy = (IR(x)&TWEAKNOTMASK); if(!IS_NEGATIVE_FLOAT(x)) Dummy+=TWEAKMASK+1; x = FR(Dummy);
@@ -257,7 +257,7 @@
Dummy = (IR(z)&TWEAKNOTMASK); if(!IS_NEGATIVE_FLOAT(z)) Dummy+=TWEAKMASK+1; z = FR(Dummy);
}
- //! Slighty moves the point in
+ //! Slighty moves the IcePoint in
inline_ void TweakSmaller()
{
udword Dummy = (IR(x)&TWEAKNOTMASK); if(IS_NEGATIVE_FLOAT(x)) Dummy+=TWEAKMASK+1; x = FR(Dummy);
@@ -266,7 +266,7 @@
}
//! Normalizes the vector
- inline_ Point& Normalize()
+ inline_ IcePoint& Normalize()
{
float M = x*x + y*y + z*z;
if(M)
@@ -280,7 +280,7 @@
}
//! Sets vector length
- inline_ Point& SetLength(float length)
+ inline_ IcePoint& SetLength(float length)
{
float NewLength = length / Magnitude();
x *= NewLength;
@@ -290,7 +290,7 @@
}
//! Clamps vector length
- inline_ Point& ClampLength(float limit_length)
+ inline_ IcePoint& ClampLength(float limit_length)
{
if(limit_length>=0.0f) // Magnitude must be positive
{
@@ -307,23 +307,23 @@
return *this;
}
- //! Computes distance to another point
- inline_ float Distance(const Point& b) const
+ //! Computes distance to another IcePoint
+ inline_ float Distance(const IcePoint& b) const
{
return sqrtf((x - b.x)*(x - b.x) + (y - b.y)*(y - b.y) + (z - b.z)*(z - b.z));
}
- //! Computes square distance to another point
- inline_ float SquareDistance(const Point& b) const
+ //! Computes square distance to another IcePoint
+ inline_ float SquareDistance(const IcePoint& b) const
{
return ((x - b.x)*(x - b.x) + (y - b.y)*(y - b.y) + (z - b.z)*(z - b.z));
}
//! Dot product dp = this|a
- inline_ float Dot(const Point& p) const { return p.x * x + p.y * y + p.z * z; }
+ inline_ float Dot(const IcePoint& p) const { return p.x * x + p.y * y + p.z * z; }
//! Cross product this = a x b
- inline_ Point& Cross(const Point& a, const Point& b)
+ inline_ IcePoint& Cross(const IcePoint& a, const IcePoint& b)
{
x = a.y * b.z - a.z * b.y;
y = a.z * b.x - a.x * b.z;
@@ -367,17 +367,17 @@
return m;
}
- //! Refracts the point
- Point& Refract(const Point& eye, const Point& n, float refractindex, Point& refracted);
+ //! Refracts the IcePoint
+ IcePoint& Refract(const IcePoint& eye, const IcePoint& n, float refractindex, IcePoint& refracted);
- //! Projects the point onto a plane
- Point& ProjectToPlane(const Plane& p);
+ //! Projects the IcePoint onto a plane
+ IcePoint& ProjectToPlane(const Plane& p);
- //! Projects the point onto the screen
+ //! Projects the IcePoint onto the screen
void ProjectToScreen(float halfrenderwidth, float halfrenderheight, const Matrix4x4& mat, HPoint& projected) const;
- //! Unfolds the point onto a plane according to edge(a,b)
- Point& Unfold(Plane& p, Point& a, Point& b);
+ //! Unfolds the IcePoint onto a plane according to edge(a,b)
+ IcePoint& Unfold(Plane& p, IcePoint& a, IcePoint& b);
//! Hash function from Ville Miettinen
inline_ udword GetHashValue() const
@@ -387,101 +387,101 @@
return (f>>22)^(f>>12)^(f);
}
- //! Stuff magic values in the point, marking it as explicitely not used.
+ //! Stuff magic values in the IcePoint, marking it as explicitely not used.
void SetNotUsed();
- //! Checks the point is marked as not used
+ //! Checks the IcePoint is marked as not used
BOOL IsNotUsed() const;
// Arithmetic operators
- //! Unary operator for Point Negate = - Point
- inline_ Point operator-() const { return Point(-x, -y, -z); }
-
- //! Operator for Point Plus = Point + Point.
- inline_ Point operator+(const Point& p) const { return Point(x + p.x, y + p.y, z + p.z); }
- //! Operator for Point Minus = Point - Point.
- inline_ Point operator-(const Point& p) const { return Point(x - p.x, y - p.y, z - p.z); }
-
- //! Operator for Point Mul = Point * Point.
- inline_ Point operator*(const Point& p) const { return Point(x * p.x, y * p.y, z * p.z); }
- //! Operator for Point Scale = Point * float.
- inline_ Point operator*(float s) const { return Point(x * s, y * s, z * s ); }
- //! Operator for Point Scale = float * Point.
- inline_ friend Point operator*(float s, const Point& p) { return Point(s * p.x, s * p.y, s * p.z); }
-
- //! Operator for Point Div = Point / Point.
- inline_ Point operator/(const Point& p) const { return Point(x / p.x, y / p.y, z / p.z); }
- //! Operator for Point Scale = Point / float.
- inline_ Point operator/(float s) const { s = 1.0f / s; return Point(x * s, y * s, z * s); }
- //! Operator for Point Scale = float / Point.
- inline_ friend Point operator/(float s, const Point& p) { return Point(s / p.x, s / p.y, s / p.z); }
-
- //! Operator for float DotProd = Point | Point.
- inline_ float operator|(const Point& p) const { return x*p.x + y*p.y + z*p.z; }
- //! Operator for Point VecProd = Point ^ Point.
- inline_ Point operator^(const Point& p) const
+ //! Unary operator for IcePoint Negate = - IcePoint
+ inline_ IcePoint operator-() const { return IcePoint(-x, -y, -z); }
+
+ //! Operator for IcePoint Plus = IcePoint + IcePoint.
+ inline_ IcePoint operator+(const IcePoint& p) const { return IcePoint(x + p.x, y + p.y, z + p.z); }
+ //! Operator for IcePoint Minus = IcePoint - IcePoint.
+ inline_ IcePoint operator-(const IcePoint& p) const { return IcePoint(x - p.x, y - p.y, z - p.z); }
+
+ //! Operator for IcePoint Mul = IcePoint * IcePoint.
+ inline_ IcePoint operator*(const IcePoint& p) const { return IcePoint(x * p.x, y * p.y, z * p.z); }
+ //! Operator for IcePoint Scale = IcePoint * float.
+ inline_ IcePoint operator*(float s) const { return IcePoint(x * s, y * s, z * s ); }
+ //! Operator for IcePoint Scale = float * IcePoint.
+ inline_ friend IcePoint operator*(float s, const IcePoint& p) { return IcePoint(s * p.x, s * p.y, s * p.z); }
+
+ //! Operator for IcePoint Div = IcePoint / IcePoint.
+ inline_ IcePoint operator/(const IcePoint& p) const { return IcePoint(x / p.x, y / p.y, z / p.z); }
+ //! Operator for IcePoint Scale = IcePoint / float.
+ inline_ IcePoint operator/(float s) const { s = 1.0f / s; return IcePoint(x * s, y * s, z * s); }
+ //! Operator for IcePoint Scale = float / IcePoint.
+ inline_ friend IcePoint operator/(float s, const IcePoint& p) { return IcePoint(s / p.x, s / p.y, s / p.z); }
+
+ //! Operator for float DotProd = IcePoint | IcePoint.
+ inline_ float operator|(const IcePoint& p) const { return x*p.x + y*p.y + z*p.z; }
+ //! Operator for IcePoint VecProd = IcePoint ^ IcePoint.
+ inline_ IcePoint operator^(const IcePoint& p) const
{
- return Point(
+ return IcePoint(
y * p.z - z * p.y,
z * p.x - x * p.z,
x * p.y - y * p.x );
}
- //! Operator for Point += Point.
- inline_ Point& operator+=(const Point& p) { x += p.x; y += p.y; z += p.z; return *this; }
- //! Operator for Point += float.
- inline_ Point& operator+=(float s) { x += s; y += s; z += s; return *this; }
+ //! Operator for IcePoint += IcePoint.
+ inline_ IcePoint& operator+=(const IcePoint& p) { x += p.x; y += p.y; z += p.z; return *this; }
+ //! Operator for IcePoint += float.
+ inline_ IcePoint& operator+=(float s) { x += s; y += s; z += s; return *this; }
- //! Operator for Point -= Point.
- inline_ Point& operator-=(const Point& p) { x -= p.x; y -= p.y; z -= p.z; return *this; }
- //! Operator for Point -= float.
- inline_ Point& operator-=(float s) { x -= s; y -= s; z -= s; return *this; }
+ //! Operator for IcePoint -= IcePoint.
+ inline_ IcePoint& operator-=(const IcePoint& p) { x -= p.x; y -= p.y; z -= p.z; return *this; }
+ //! Operator for IcePoint -= float.
+ inline_ IcePoint& operator-=(float s) { x -= s; y -= s; z -= s; return *this; }
- //! Operator for Point *= Point.
- inline_ Point& operator*=(const Point& p) { x *= p.x; y *= p.y; z *= p.z; return *this; }
- //! Operator for Point *= float.
- inline_ Point& operator*=(float s) { x *= s; y *= s; z *= s; return *this; }
+ //! Operator for IcePoint *= IcePoint.
+ inline_ IcePoint& operator*=(const IcePoint& p) { x *= p.x; y *= p.y; z *= p.z; return *this; }
+ //! Operator for IcePoint *= float.
+ inline_ IcePoint& operator*=(float s) { x *= s; y *= s; z *= s; return *this; }
- //! Operator for Point /= Point.
- inline_ Point& operator/=(const Point& p) { x /= p.x; y /= p.y; z /= p.z; return *this; }
- //! Operator for Point /= float.
- inline_ Point& operator/=(float s) { s = 1.0f/s; x *= s; y *= s; z *= s; return *this; }
+ //! Operator for IcePoint /= IcePoint.
+ inline_ IcePoint& operator/=(const IcePoint& p) { x /= p.x; y /= p.y; z /= p.z; return *this; }
+ //! Operator for IcePoint /= float.
+ inline_ IcePoint& operator/=(float s) { s = 1.0f/s; x *= s; y *= s; z *= s; return *this; }
// Logical operators
- //! Operator for "if(Point==Point)"
- inline_ bool operator==(const Point& p) const { return ( (IR(x)==IR(p.x))&&(IR(y)==IR(p.y))&&(IR(z)==IR(p.z))); }
- //! Operator for "if(Point!=Point)"
- inline_ bool operator!=(const Point& p) const { return ( (IR(x)!=IR(p.x))||(IR(y)!=IR(p.y))||(IR(z)!=IR(p.z))); }
+ //! Operator for "if(IcePoint==IcePoint)"
+ inline_ bool operator==(const IcePoint& p) const { return ( (IR(x)==IR(p.x))&&(IR(y)==IR(p.y))&&(IR(z)==IR(p.z))); }
+ //! Operator for "if(IcePoint!=IcePoint)"
+ inline_ bool operator!=(const IcePoint& p) const { return ( (IR(x)!=IR(p.x))||(IR(y)!=IR(p.y))||(IR(z)!=IR(p.z))); }
// Arithmetic operators
- //! Operator for Point Mul = Point * Matrix3x3.
- inline_ Point operator*(const Matrix3x3& mat) const
+ //! Operator for IcePoint Mul = IcePoint * Matrix3x3.
+ inline_ IcePoint operator*(const Matrix3x3& mat) const
{
class ShadowMatrix3x3{ public: float m[3][3]; }; // To allow inlining
const ShadowMatrix3x3* Mat = (const ShadowMatrix3x3*)&mat;
- return Point(
+ return IcePoint(
x * Mat->m[0][0] + y * Mat->m[1][0] + z * Mat->m[2][0],
x * Mat->m[0][1] + y * Mat->m[1][1] + z * Mat->m[2][1],
x * Mat->m[0][2] + y * Mat->m[1][2] + z * Mat->m[2][2] );
}
- //! Operator for Point Mul = Point * Matrix4x4.
- inline_ Point operator*(const Matrix4x4& mat) const
+ //! Operator for IcePoint Mul = IcePoint * Matrix4x4.
+ inline_ IcePoint operator*(const Matrix4x4& mat) const
{
class ShadowMatrix4x4{ public: float m[4][4]; }; // To allow inlining
const ShadowMatrix4x4* Mat = (const ShadowMatrix4x4*)&mat;
- return Point(
+ return IcePoint(
x * Mat->m[0][0] + y * Mat->m[1][0] + z * Mat->m[2][0] + Mat->m[3][0],
x * Mat->m[0][1] + y * Mat->m[1][1] + z * Mat->m[2][1] + Mat->m[3][1],
x * Mat->m[0][2] + y * Mat->m[1][2] + z * Mat->m[2][2] + Mat->m[3][2]);
}
- //! Operator for Point *= Matrix3x3.
- inline_ Point& operator*=(const Matrix3x3& mat)
+ //! Operator for IcePoint *= Matrix3x3.
+ inline_ IcePoint& operator*=(const Matrix3x3& mat)
{
class ShadowMatrix3x3{ public: float m[3][3]; }; // To allow inlining
const ShadowMatrix3x3* Mat = (const ShadowMatrix3x3*)&mat;
@@ -495,8 +495,8 @@
return *this;
}
- //! Operator for Point *= Matrix4x4.
- inline_ Point& operator*=(const Matrix4x4& mat)
+ //! Operator for IcePoint *= Matrix4x4.
+ inline_ IcePoint& operator*=(const Matrix4x4& mat)
{
class ShadowMatrix4x4{ public: float m[4][4]; }; // To allow inlining
const ShadowMatrix4x4* Mat = (const ShadowMatrix4x4*)&mat;
@@ -512,7 +512,7 @@
// Cast operators
- //! Cast a Point to a HPoint. w is set to zero.
+ //! Cast a IcePoint to a HPoint. w is set to zero.
operator HPoint() const;
inline_ operator const float*() const { return &x; }
@@ -522,7 +522,7 @@
float x, y, z;
};
- FUNCTION ICEMATHS_API void Normalize1(Point& a);
- FUNCTION ICEMATHS_API void Normalize2(Point& a);
+ FUNCTION ICEMATHS_API void Normalize1(IcePoint& a);
+ FUNCTION ICEMATHS_API void Normalize2(IcePoint& a);
#endif //__ICEPOINT_H__
diff --git a/Opcode/Ice/IceRay.cpp b/Opcode/Ice/IceRay.cpp
index be04043..a3872f6 100644
--- a/Opcode/Ice/IceRay.cpp
+++ b/Opcode/Ice/IceRay.cpp
@@ -18,7 +18,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
- O = Origin = impact point
+ O = Origin = impact IcePoint
i = normalized vector along the x axis
j = normalized vector along the y axis = actually the normal vector in O
D = Direction vector, norm |D| = 1
@@ -63,9 +63,9 @@
using namespace IceMaths;
-float Ray::SquareDistance(const Point& point, float* t) const
+float Ray::SquareDistance(const IcePoint& Point, float* t) const
{
- Point Diff = point - mOrig;
+ IcePoint Diff = Point - mOrig;
float fT = Diff | mDir;
if(fT<=0.0f)
diff --git a/Opcode/Ice/IceRay.h b/Opcode/Ice/IceRay.h
index f99a78b..c40552b 100644
--- a/Opcode/Ice/IceRay.h
+++ b/Opcode/Ice/IceRay.h
@@ -18,31 +18,31 @@
//! Constructor
inline_ Ray() {}
//! Constructor
- inline_ Ray(const Point& orig, const Point& dir) : mOrig(orig), mDir(dir) {}
+ inline_ Ray(const IcePoint& orig, const IcePoint& dir) : mOrig(orig), mDir(dir) {}
//! Copy constructor
inline_ Ray(const Ray& ray) : mOrig(ray.mOrig), mDir(ray.mDir) {}
//! Destructor
inline_ ~Ray() {}
- float SquareDistance(const Point& point, float* t=null) const;
- inline_ float Distance(const Point& point, float* t=null) const { return sqrtf(SquareDistance(point, t)); }
+ float SquareDistance(const IcePoint& point, float* t=null) const;
+ inline_ float Distance(const IcePoint& point, float* t=null) const { return sqrtf(SquareDistance(point, t)); }
- Point mOrig; //!< Ray origin
- Point mDir; //!< Normalized direction
+ IcePoint mOrig; //!< Ray origin
+ IcePoint mDir; //!< Normalized direction
};
- inline_ void ComputeReflexionVector(Point& reflected, const Point& incoming_dir, const Point& outward_normal)
+ inline_ void ComputeReflexionVector(IcePoint& reflected, const IcePoint& incoming_dir, const IcePoint& outward_normal)
{
reflected = incoming_dir - outward_normal * 2.0f * (incoming_dir|outward_normal);
}
- inline_ void ComputeReflexionVector(Point& reflected, const Point& source, const Point& impact, const Point& normal)
+ inline_ void ComputeReflexionVector(IcePoint& reflected, const IcePoint& source, const IcePoint& impact, const IcePoint& normal)
{
- Point V = impact - source;
+ IcePoint V = impact - source;
reflected = V - normal * 2.0f * (V|normal);
}
- inline_ void DecomposeVector(Point& normal_compo, Point& tangent_compo, const Point& outward_dir, const Point& outward_normal)
+ inline_ void DecomposeVector(IcePoint& normal_compo, IcePoint& tangent_compo, const IcePoint& outward_dir, const IcePoint& outward_normal)
{
normal_compo = outward_normal * (outward_dir|outward_normal);
tangent_compo = outward_dir - normal_compo;
@@ -56,7 +56,7 @@
* \param world [in] world transform
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ void ComputeLocalDirection(Point& local_dir, const Point& world_dir, const Matrix4x4& world)
+ inline_ void ComputeLocalDirection(IcePoint& local_dir, const IcePoint& world_dir, const Matrix4x4& world)
{
// Get world direction back in local space
// Matrix3x3 InvWorld = world;
@@ -72,7 +72,7 @@
* \param world [in] world transform
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ void ComputeLocalPoint(Point& local_pt, const Point& world_pt, const Matrix4x4& world)
+ inline_ void ComputeLocalPoint(IcePoint& local_pt, const IcePoint& world_pt, const Matrix4x4& world)
{
// Get world vertex back in local space
Matrix4x4 InvWorld = world;
diff --git a/Opcode/Ice/IceSegment.cpp b/Opcode/Ice/IceSegment.cpp
index 4b51343..f8d1553 100644
--- a/Opcode/Ice/IceSegment.cpp
+++ b/Opcode/Ice/IceSegment.cpp
@@ -26,10 +26,10 @@
using namespace IceMaths;
-float Segment::SquareDistance(const Point& point, float* t) const
+float Segment::SquareDistance(const IcePoint& Point, float* t) const
{
- Point Diff = point - mP0;
- Point Dir = mP1 - mP0;
+ IcePoint Diff = Point - mP0;
+ IcePoint Dir = mP1 - mP0;
float fT = Diff | Dir;
if(fT<=0.0f)
diff --git a/Opcode/Ice/IceSegment.h b/Opcode/Ice/IceSegment.h
index 3dc8314..e3ce8ab 100644
--- a/Opcode/Ice/IceSegment.h
+++ b/Opcode/Ice/IceSegment.h
@@ -18,19 +18,19 @@
//! Constructor
inline_ Segment() {}
//! Constructor
- inline_ Segment(const Point& p0, const Point& p1) : mP0(p0), mP1(p1) {}
+ inline_ Segment(const IcePoint& p0, const IcePoint& p1) : mP0(p0), mP1(p1) {}
//! Copy constructor
inline_ Segment(const Segment& seg) : mP0(seg.mP0), mP1(seg.mP1) {}
//! Destructor
inline_ ~Segment() {}
- inline_ const Point& GetOrigin() const { return mP0; }
- inline_ Point ComputeDirection() const { return mP1 - mP0; }
- inline_ void ComputeDirection(Point& dir) const { dir = mP1 - mP0; }
+ inline_ const IcePoint& GetOrigin() const { return mP0; }
+ inline_ IcePoint ComputeDirection() const { return mP1 - mP0; }
+ inline_ void ComputeDirection(IcePoint& dir) const { dir = mP1 - mP0; }
inline_ float ComputeLength() const { return mP1.Distance(mP0); }
inline_ float ComputeSquareLength() const { return mP1.SquareDistance(mP0); }
- inline_ void SetOriginDirection(const Point& origin, const Point& direction)
+ inline_ void SetOriginDirection(const IcePoint& origin, const IcePoint& direction)
{
mP0 = mP1 = origin;
mP1 += direction;
@@ -38,18 +38,18 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Computes a point on the segment
- * \param pt [out] point on segment
- * \param t [in] point's parameter [t=0 => pt = mP0, t=1 => pt = mP1]
+ * Computes a IcePoint on the segment
+ * \param pt [out] IcePoint on segment
+ * \param t [in] IcePoint's parameter [t=0 => pt = mP0, t=1 => pt = mP1]
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ void ComputePoint(Point& pt, float t) const { pt = mP0 + t * (mP1 - mP0); }
+ inline_ void ComputePoint(IcePoint& pt, float t) const { pt = mP0 + t * (mP1 - mP0); }
- float SquareDistance(const Point& point, float* t=null) const;
- inline_ float Distance(const Point& point, float* t=null) const { return sqrtf(SquareDistance(point, t)); }
+ float SquareDistance(const IcePoint& IcePoint, float* t=null) const;
+ inline_ float Distance(const IcePoint& IcePoint, float* t=null) const { return sqrtf(SquareDistance(IcePoint, t)); }
- Point mP0; //!< Start of segment
- Point mP1; //!< End of segment
+ IcePoint mP0; //!< Start of segment
+ IcePoint mP1; //!< End of segment
};
#endif // __ICESEGMENT_H__
diff --git a/Opcode/Ice/IceTriangle.cpp b/Opcode/Ice/IceTriangle.cpp
index ef89109..69a858f 100644
--- a/Opcode/Ice/IceTriangle.cpp
+++ b/Opcode/Ice/IceTriangle.cpp
@@ -24,7 +24,7 @@ using namespace IceMaths;
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static sdword VPlaneSideEps(const Point& v, const Plane& plane, float epsilon)
+static sdword VPlaneSideEps(const IcePoint& v, const Plane& plane, float epsilon)
{
// Compute distance from current vertex to the plane
float Dist = plane.Distance(v);
@@ -42,7 +42,7 @@ static sdword VPlaneSideEps(const Point& v, const Plane& plane, float epsilon)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Triangle::Flip()
{
- Point Tmp = mVerts[1];
+ IcePoint Tmp = mVerts[1];
mVerts[1] = mVerts[2];
mVerts[2] = Tmp;
}
@@ -55,9 +55,9 @@ void Triangle::Flip()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
float Triangle::Area() const
{
- const Point& p0 = mVerts[0];
- const Point& p1 = mVerts[1];
- const Point& p2 = mVerts[2];
+ const IcePoint& p0 = mVerts[0];
+ const IcePoint& p1 = mVerts[1];
+ const IcePoint& p2 = mVerts[2];
return ((p0 - p1)^(p0 - p2)).Magnitude() * 0.5f;
}
@@ -69,9 +69,9 @@ float Triangle::Area() const
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
float Triangle::Perimeter() const
{
- const Point& p0 = mVerts[0];
- const Point& p1 = mVerts[1];
- const Point& p2 = mVerts[2];
+ const IcePoint& p0 = mVerts[0];
+ const IcePoint& p1 = mVerts[1];
+ const IcePoint& p2 = mVerts[2];
return p0.Distance(p1)
+ p0.Distance(p2)
+ p1.Distance(p2);
@@ -96,11 +96,11 @@ float Triangle::Compacity() const
* \param normal [out] the computed normal
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void Triangle::Normal(Point& normal) const
+void Triangle::Normal(IcePoint& normal) const
{
- const Point& p0 = mVerts[0];
- const Point& p1 = mVerts[1];
- const Point& p2 = mVerts[2];
+ const IcePoint& p0 = mVerts[0];
+ const IcePoint& p1 = mVerts[1];
+ const IcePoint& p2 = mVerts[2];
normal = ((p0 - p1)^(p0 - p2)).Normalize();
}
@@ -110,11 +110,11 @@ void Triangle::Normal(Point& normal) const
* \param normal [out] the computed normal
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void Triangle::DenormalizedNormal(Point& normal) const
+void Triangle::DenormalizedNormal(IcePoint& normal) const
{
- const Point& p0 = mVerts[0];
- const Point& p1 = mVerts[1];
- const Point& p2 = mVerts[2];
+ const IcePoint& p0 = mVerts[0];
+ const IcePoint& p1 = mVerts[1];
+ const IcePoint& p2 = mVerts[2];
normal = ((p0 - p1)^(p0 - p2));
}
@@ -124,11 +124,11 @@ void Triangle::DenormalizedNormal(Point& normal) const
* \param center [out] the computed center
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void Triangle::Center(Point& center) const
+void Triangle::Center(IcePoint& center) const
{
- const Point& p0 = mVerts[0];
- const Point& p1 = mVerts[1];
- const Point& p2 = mVerts[2];
+ const IcePoint& p0 = mVerts[0];
+ const IcePoint& p1 = mVerts[1];
+ const IcePoint& p2 = mVerts[2];
center = (p0 + p1 + p2)*INV3;
}
@@ -171,9 +171,9 @@ void Triangle::ComputeMoment(Moment& m)
Center(m.mCentroid);
// Second-order components. Handle zero-area faces.
- Point& p = mVerts[0];
- Point& q = mVerts[1];
- Point& r = mVerts[2];
+ IcePoint& p = mVerts[0];
+ IcePoint& q = mVerts[1];
+ IcePoint& r = mVerts[2];
if(m.mArea==0.0f)
{
// This triangle has zero area. The second order components would be eliminated with the usual formula, so, for the
@@ -242,24 +242,24 @@ float Triangle::MaxEdgeLength() const
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Computes a point on the triangle according to the stabbing information.
- * \param u,v [in] point's barycentric coordinates
- * \param pt [out] point on triangle
+ * Computes a IcePoint on the triangle according to the stabbing information.
+ * \param u,v [in] IcePoint's barycentric coordinates
+ * \param pt [out] IcePoint on triangle
* \param nearvtx [out] index of nearest vertex
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void Triangle::ComputePoint(float u, float v, Point& pt, udword* nearvtx) const
+void Triangle::ComputePoint(float u, float v, IcePoint& pt, udword* nearvtx) const
{
- // Compute point coordinates
+ // Compute IcePoint coordinates
pt = (1.0f - u - v)*mVerts[0] + u*mVerts[1] + v*mVerts[2];
// Compute nearest vertex if needed
if(nearvtx)
{
// Compute distance vector
- Point d(mVerts[0].SquareDistance(pt), // Distance^2 from vertex 0 to point on the face
- mVerts[1].SquareDistance(pt), // Distance^2 from vertex 1 to point on the face
- mVerts[2].SquareDistance(pt)); // Distance^2 from vertex 2 to point on the face
+ IcePoint d(mVerts[0].SquareDistance(pt), // Distance^2 from vertex 0 to IcePoint on the face
+ mVerts[1].SquareDistance(pt), // Distance^2 from vertex 1 to IcePoint on the face
+ mVerts[2].SquareDistance(pt)); // Distance^2 from vertex 2 to IcePoint on the face
// Get smallest distance
*nearvtx = d.SmallestAxis();
@@ -269,7 +269,7 @@ void Triangle::ComputePoint(float u, float v, Point& pt, udword* nearvtx) const
void Triangle::Inflate(float fat_coeff, bool constant_border)
{
// Compute triangle center
- Point TriangleCenter;
+ IcePoint TriangleCenter;
Center(TriangleCenter);
// Don't normalize?
@@ -277,7 +277,7 @@ void Triangle::Inflate(float fat_coeff, bool constant_border)
// Don't => add more to big triangles
for(udword i=0;i<3;i++)
{
- Point v = mVerts[i] - TriangleCenter;
+ IcePoint v = mVerts[i] - TriangleCenter;
if(constant_border) v.Normalize();
diff --git a/Opcode/Ice/IceTriangle.h b/Opcode/Ice/IceTriangle.h
index 02e03ce..13eca37 100644
--- a/Opcode/Ice/IceTriangle.h
+++ b/Opcode/Ice/IceTriangle.h
@@ -33,7 +33,7 @@
//! Constructor
inline_ Triangle() {}
//! Constructor
- inline_ Triangle(const Point& p0, const Point& p1, const Point& p2) { mVerts[0]=p0; mVerts[1]=p1; mVerts[2]=p2; }
+ inline_ Triangle(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) { mVerts[0]=p0; mVerts[1]=p1; mVerts[2]=p2; }
//! Copy constructor
inline_ Triangle(const Triangle& triangle)
{
@@ -44,16 +44,16 @@
//! Destructor
inline_ ~Triangle() {}
//! Vertices
- Point mVerts[3];
+ IcePoint mVerts[3];
// Methods
void Flip();
float Area() const;
float Perimeter() const;
float Compacity() const;
- void Normal(Point& normal) const;
- void DenormalizedNormal(Point& normal) const;
- void Center(Point& center) const;
+ void Normal(IcePoint& normal) const;
+ void DenormalizedNormal(IcePoint& normal) const;
+ void Center(IcePoint& center) const;
inline_ Plane PlaneEquation() const { return Plane(mVerts[0], mVerts[1], mVerts[2]); }
PartVal TestAgainstPlane(const Plane& plane, float epsilon) const;
@@ -61,7 +61,7 @@
void ComputeMoment(Moment& m);
float MinEdgeLength() const;
float MaxEdgeLength() const;
- void ComputePoint(float u, float v, Point& pt, udword* nearvtx=null) const;
+ void ComputePoint(float u, float v, IcePoint& pt, udword* nearvtx=null) const;
void Inflate(float fat_coeff, bool constant_border);
};
diff --git a/Opcode/Ice/IceTrilist.h b/Opcode/Ice/IceTrilist.h
index 7a8d9de..d5f7c70 100644
--- a/Opcode/Ice/IceTrilist.h
+++ b/Opcode/Ice/IceTrilist.h
@@ -29,7 +29,7 @@
Add(tri.mVerts[2].x).Add(tri.mVerts[2].y).Add(tri.mVerts[2].z);
}
- void AddTri(const Point& p0, const Point& p1, const Point& p2)
+ void AddTri(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2)
{
Add(p0.x).Add(p0.y).Add(p0.z);
Add(p1.x).Add(p1.y).Add(p1.z);