summaryrefslogtreecommitdiffhomepage
path: root/Opcode/Ice/IceTriangle.h
diff options
context:
space:
mode:
Diffstat (limited to 'Opcode/Ice/IceTriangle.h')
-rw-r--r--Opcode/Ice/IceTriangle.h136
1 files changed, 68 insertions, 68 deletions
diff --git a/Opcode/Ice/IceTriangle.h b/Opcode/Ice/IceTriangle.h
index c5c1fde..e5c8426 100644
--- a/Opcode/Ice/IceTriangle.h
+++ b/Opcode/Ice/IceTriangle.h
@@ -1,68 +1,68 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Contains a handy triangle class.
- * \file IceTriangle.h
- * \author Pierre Terdiman
- * \date January, 17, 2000
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Guard
-#ifndef __ICETRIANGLE_H__
-#define __ICETRIANGLE_H__
-
- // Forward declarations
- class Moment;
-
- // Partitioning values
- enum PartVal
- {
- TRI_MINUS_SPACE = 0, //!< Triangle is in the negative space
- TRI_PLUS_SPACE = 1, //!< Triangle is in the positive space
- TRI_INTERSECT = 2, //!< Triangle intersects plane
- TRI_ON_PLANE = 3, //!< Triangle and plane are coplanar
-
- TRI_FORCEDWORD = 0x7fffffff
- };
-
- // A triangle class.
- class ICEMATHS_API Triangle
- {
- public:
- //! Constructor
- inline_ Triangle() {}
- //! Constructor
- 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)
- {
- mVerts[0] = triangle.mVerts[0];
- mVerts[1] = triangle.mVerts[1];
- mVerts[2] = triangle.mVerts[2];
- }
- //! Destructor
- inline_ ~Triangle() {}
- //! Vertices
- IcePoint mVerts[3];
-
- // Methods
- void Flip();
- float Area() const;
- float Perimeter() const;
- float Compacity() const;
- void Normal(IcePoint& normal) const;
- void DenormalizedNormal(IcePoint& normal) const;
- void Center(IcePoint& center) const;
- inline_ IcePlane PlaneEquation() const { return IcePlane(mVerts[0], mVerts[1], mVerts[2]); }
-
- PartVal TestAgainstPlane(const IcePlane& plane, float epsilon) const;
-// float Distance(Point& cp, Point& cq, Tri& tri);
- void ComputeMoment(Moment& m);
- float MinEdgeLength() const;
- float MaxEdgeLength() const;
- void ComputePoint(float u, float v, IcePoint& pt, udword* nearvtx=null) const;
- void Inflate(float fat_coeff, bool constant_border);
- };
-
-#endif // __ICETRIANGLE_H__
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Contains a handy triangle class.
+ * \file IceTriangle.h
+ * \author Pierre Terdiman
+ * \date January, 17, 2000
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Guard
+#ifndef __ICETRIANGLE_H__
+#define __ICETRIANGLE_H__
+
+ // Forward declarations
+ class Moment;
+
+ // Partitioning values
+ enum PartVal
+ {
+ TRI_MINUS_SPACE = 0, //!< Triangle is in the negative space
+ TRI_PLUS_SPACE = 1, //!< Triangle is in the positive space
+ TRI_INTERSECT = 2, //!< Triangle intersects plane
+ TRI_ON_PLANE = 3, //!< Triangle and plane are coplanar
+
+ TRI_FORCEDWORD = 0x7fffffff
+ };
+
+ // A triangle class.
+ class ICEMATHS_API Triangle
+ {
+ public:
+ //! Constructor
+ inline_ Triangle() {}
+ //! Constructor
+ 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)
+ {
+ mVerts[0] = triangle.mVerts[0];
+ mVerts[1] = triangle.mVerts[1];
+ mVerts[2] = triangle.mVerts[2];
+ }
+ //! Destructor
+ inline_ ~Triangle() {}
+ //! Vertices
+ IcePoint mVerts[3];
+
+ // Methods
+ void Flip();
+ float Area() const;
+ float Perimeter() const;
+ float Compacity() const;
+ void Normal(IcePoint& normal) const;
+ void DenormalizedNormal(IcePoint& normal) const;
+ void Center(IcePoint& center) const;
+ inline_ IcePlane PlaneEquation() const { return IcePlane(mVerts[0], mVerts[1], mVerts[2]); }
+
+ PartVal TestAgainstPlane(const IcePlane& plane, float epsilon) const;
+// float Distance(Point& cp, Point& cq, Tri& tri);
+ void ComputeMoment(Moment& m);
+ float MinEdgeLength() const;
+ float MaxEdgeLength() const;
+ void ComputePoint(float u, float v, IcePoint& pt, udword* nearvtx=null) const;
+ void Inflate(float fat_coeff, bool constant_border);
+ };
+
+#endif // __ICETRIANGLE_H__