Oolite
Loading...
Searching...
No Matches
OOTriangle.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Triangle

Functions

OOINLINE Vector calculateNormalForTriangle (Triangle *ioTriangle) NONNULL_FUNC
OOINLINE Triangle make_triangle (Vector v0, Vector v1, Vector v2) CONST_FUNC
OOINLINE Vector resolveVectorInIJK (Vector v0, Triangle ijk)
OOINLINE bool OOTriangleIsDegenerate (Triangle tri) CONST_FUNC

Function Documentation

◆ calculateNormalForTriangle()

OOINLINE Vector calculateNormalForTriangle ( Triangle * ioTriangle)

Definition at line 51 of file OOTriangle.h.

52{
53 Vector v01 = vector_subtract(tri->v[1], tri->v[0]);
54 Vector v12 = vector_subtract(tri->v[2], tri->v[1]);
55 return cross_product(v01, v12);
56}
OOINLINE Vector vector_subtract(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:218
OOINLINE Vector cross_product(Vector first, Vector second) INLINE_CONST_FUNC
Definition OOVector.h:294

References cross_product(), OOINLINE, Triangle::v, and vector_subtract().

Here is the call graph for this function:

◆ make_triangle()

OOINLINE Triangle make_triangle ( Vector v0,
Vector v1,
Vector v2 )

Definition at line 46 of file OOTriangle.h.

47{
48 return (Triangle) { { v0, v1, v2 } };
49}

References OOINLINE.

Referenced by SplitGeometryX(), SplitGeometryY(), and SplitGeometryZ().

Here is the caller graph for this function:

◆ OOTriangleIsDegenerate()

OOINLINE bool OOTriangleIsDegenerate ( Triangle tri)

Definition at line 67 of file OOTriangle.h.

68{
69 return vector_equal(tri.v[0], tri.v[1]) || vector_equal(tri.v[1], tri.v[2]) || vector_equal(tri.v[2], tri.v[0]);
70}
OOINLINE bool vector_equal(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:232
Vector v[3]
Definition OOTriangle.h:29

References OOINLINE, Triangle::v, and vector_equal().

Referenced by OOMeshToOctreeConverter::addTriangle:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolveVectorInIJK()

OOINLINE Vector resolveVectorInIJK ( Vector v0,
Triangle ijk )

Definition at line 58 of file OOTriangle.h.

59{
60 Vector result;
61 result.x = dot_product(v0, ijk.v[0]);
62 result.y = dot_product(v0, ijk.v[1]);
63 result.z = dot_product(v0, ijk.v[2]);
64 return result;
65}
OOINLINE OOScalar dot_product(Vector first, Vector second) INLINE_CONST_FUNC
Definition OOVector.h:299
OOScalar x
Definition OOVector.h:32
OOScalar y
Definition OOVector.h:33
OOScalar z
Definition OOVector.h:34

References dot_product(), OOINLINE, Triangle::v, Vector::x, Vector::y, and Vector::z.

Referenced by PlayerEntity::doesHitLine:v1:hitEntity:, ShipEntity::doesHitLine:v1:hitEntity:, ShipEntity::doOctreesCollide, and Octree::isHitByOctree.

Here is the call graph for this function:
Here is the caller graph for this function: