5#ifndef NIRT_TRIANGLE_3D_HPP_INCLUDED
6#define NIRT_TRIANGLE_3D_HPP_INCLUDED
8#include <nirtcpp/core/engine/vector3d.hpp>
9#include <nirtcpp/core/engine/line3d.hpp>
10#include <nirtcpp/core/engine/plane3d.hpp>
11#include <nirtcpp/core/engine/aabbox3d.hpp>
38 return !(*
this==
other);
74 const T d1 =
rab.getDistanceFrom(
p);
75 const T d2 =
rbc.getDistanceFrom(
p);
76 const T d3 =
rca.getDistanceFrom(
p);
127 return (u > -ROUNDING_ERROR_f32) && (v >= 0) && (u + v < 1+ROUNDING_ERROR_f32);
214 return F32_LOWER_EQUAL_0(
d);
226 return (pointB -
pointA).crossProduct(pointC -
pointA).getLength() * 0.5f;
264 return (
res >= 0.0f);
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
bool isPointInside(const vector3d< T > &p) const
Determines if a point is within this box.
Definition aabbox3d.hpp:219
vector3d< T > MinEdge
The near edge.
Definition aabbox3d.hpp:354
vector3d< T > MaxEdge
The far edge.
Definition aabbox3d.hpp:357
3d triangle template class for doing collision detection and other things.
Definition triangle3d.hpp:21
T getArea() const
Get the area of the triangle.
Definition triangle3d.hpp:224
vector3d< T > getNormal() const
Get the normal of the triangle.
Definition triangle3d.hpp:199
void set(const core::vector3d< T > &a, const core::vector3d< T > &b, const core::vector3d< T > &c)
sets the triangle's points
Definition triangle3d.hpp:231
bool isFrontFacing(const vector3d< T > &lookDirection) const
Test if the triangle would be front or backfacing from any point.
Definition triangle3d.hpp:210
core::vector3d< T > closestPointOnTriangle(const core::vector3d< T > &p) const
Get the closest point on a triangle to a point on the same plane.
Definition triangle3d.hpp:68
bool isTotalOutsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally outside a bounding box.
Definition triangle3d.hpp:54
bool getIntersectionWithLimitedLine(const line3d< T > &line, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
Definition triangle3d.hpp:136
bool isTotalInsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally inside a bounding box.
Definition triangle3d.hpp:44
bool getIntersectionOfPlaneWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Calculates the intersection between a 3d line and the plane the triangle is on.
Definition triangle3d.hpp:169
bool operator==(const triangle3d< T > &other) const
Equality operator.
Definition triangle3d.hpp:30
vector3d< T > pointA
the three points of the triangle
Definition triangle3d.hpp:239
triangle3d(const vector3d< T > &v1, const vector3d< T > &v2, const vector3d< T > &v3)
Constructor for triangle with given three vertices.
Definition triangle3d.hpp:27
triangle3d()
Constructor for an all 0 triangle.
Definition triangle3d.hpp:25
bool getIntersectionWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
Definition triangle3d.hpp:154
plane3d< T > getPlane() const
Get the plane of this triangle.
Definition triangle3d.hpp:218
bool isPointInsideFast(const vector3d< T > &p) const
Check if a point is inside the triangle (border-points count also as inside)
Definition triangle3d.hpp:108
bool isPointInside(const vector3d< T > &p) const
Check if a point is inside the triangle (border-points count also as inside)
Definition triangle3d.hpp:89
bool operator!=(const triangle3d< T > &other) const
Inequality operator.
Definition triangle3d.hpp:36
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Definition irrMath.hpp:304
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
double f64
64 bit floating point variable.
Definition irrTypes.hpp:114
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110