Jet
v1.3.3
|
3-D triangle geometry. More...
#include <jet/triangle3.h>
Classes | |
class | Builder |
Front-end to create Triangle3 objects step by step. More... | |
Public Member Functions | |
Triangle3 (const Transform3 &transform=Transform3(), bool isNormalFlipped=false) | |
Constructs an empty triangle. More... | |
Triangle3 (const std::array< Vector3D, 3 > &points, const std::array< Vector3D, 3 > &normals, const std::array< Vector2D, 3 > &uvs, const Transform3 &transform=Transform3(), bool isNormalFlipped=false) | |
Constructs a triangle with given points , normals , and uvs . More... | |
Triangle3 (const Triangle3 &other) | |
Copy constructor. More... | |
double | area () const |
Returns the area of this triangle. More... | |
void | getBarycentricCoords (const Vector3D &pt, double *b0, double *b1, double *b2) const |
Returns barycentric coordinates for the given point pt . More... | |
Vector3D | faceNormal () const |
Returns the face normal of the triangle. More... | |
void | setNormalsToFaceNormal () |
Set Triangle3::normals to the face normal. More... | |
![]() | |
Surface3 (const Transform3 &transform=Transform3(), bool isNormalFlipped=false) | |
Constructs a surface with normal direction. More... | |
Surface3 (const Surface3 &other) | |
Copy constructor. More... | |
virtual | ~Surface3 () |
Default destructor. More... | |
Vector3D | closestPoint (const Vector3D &otherPoint) const |
BoundingBox3D | boundingBox () const |
Returns the bounding box of this surface object. More... | |
bool | intersects (const Ray3D &ray) const |
Returns true if the given ray intersects with this surface object. More... | |
double | closestDistance (const Vector3D &otherPoint) const |
SurfaceRayIntersection3 | closestIntersection (const Ray3D &ray) const |
Returns the closest intersection point for given ray . More... | |
Vector3D | closestNormal (const Vector3D &otherPoint) const |
virtual void | updateQueryEngine () |
Updates internal spatial query engine. More... | |
virtual bool | isBounded () const |
Returns true if bounding box can be defined. More... | |
virtual bool | isValidGeometry () const |
Returns true if the surface is a valid geometry. More... | |
bool | isInside (const Vector3D &otherPoint) const |
Static Public Member Functions | |
static Builder | builder () |
Returns builder fox Triangle3. More... | |
Public Attributes | |
std::array< Vector3D, 3 > | points |
Three points. More... | |
std::array< Vector3D, 3 > | normals |
Three normals. More... | |
std::array< Vector2D, 3 > | uvs |
Three UV coordinates. More... | |
![]() | |
Transform3 | transform |
Local-to-world transform. More... | |
bool | isNormalFlipped = false |
Flips normal when calling Surface3::closestNormal(...). More... | |
Protected Member Functions | |
Vector3D | closestPointLocal (const Vector3D &otherPoint) const override |
bool | intersectsLocal (const Ray3D &ray) const override |
BoundingBox3D | boundingBoxLocal () const override |
Returns the bounding box of this surface object in local frame. More... | |
Vector3D | closestNormalLocal (const Vector3D &otherPoint) const override |
SurfaceRayIntersection3 | closestIntersectionLocal (const Ray3D &ray) const override |
Returns the closest intersection point for given ray in local frame. More... | |
![]() | |
virtual double | closestDistanceLocal (const Vector3D &otherPoint) const |
virtual bool | isInsideLocal (const Vector3D &otherPoint) const |
3-D triangle geometry.
This class represents 3-D triangle geometry which extends Surface3 by overriding surface-related queries.
jet::Triangle3::Triangle3 | ( | const Transform3 & | transform = Transform3() , |
bool | isNormalFlipped = false |
||
) |
Constructs an empty triangle.
jet::Triangle3::Triangle3 | ( | const std::array< Vector3D, 3 > & | points, |
const std::array< Vector3D, 3 > & | normals, | ||
const std::array< Vector2D, 3 > & | uvs, | ||
const Transform3 & | transform = Transform3() , |
||
bool | isNormalFlipped = false |
||
) |
Constructs a triangle with given points
, normals
, and uvs
.
jet::Triangle3::Triangle3 | ( | const Triangle3 & | other | ) |
Copy constructor.
double jet::Triangle3::area | ( | ) | const |
Returns the area of this triangle.
|
overrideprotectedvirtual |
Returns the bounding box of this surface object in local frame.
Implements jet::Surface3.
|
overrideprotectedvirtual |
Returns the closest intersection point for given ray
in local frame.
Implements jet::Surface3.
|
overrideprotectedvirtual |
Returns the normal to the closest point on the surface from the given point otherPoint
in local frame.
Implements jet::Surface3.
|
overrideprotectedvirtual |
Returns the closest point from the given point otherPoint
to the surface in local frame.
Implements jet::Surface3.
Vector3D jet::Triangle3::faceNormal | ( | ) | const |
Returns the face normal of the triangle.
void jet::Triangle3::getBarycentricCoords | ( | const Vector3D & | pt, |
double * | b0, | ||
double * | b1, | ||
double * | b2 | ||
) | const |
Returns barycentric coordinates for the given point pt
.
|
overrideprotectedvirtual |
Returns true if the given ray
intersects with this surface object in local frame.
Reimplemented from jet::Surface3.
void jet::Triangle3::setNormalsToFaceNormal | ( | ) |
Set Triangle3::normals to the face normal.
std::array<Vector3D, 3> jet::Triangle3::normals |
Three normals.
std::array<Vector3D, 3> jet::Triangle3::points |
Three points.
std::array<Vector2D, 3> jet::Triangle3::uvs |
Three UV coordinates.