Go to the documentation of this file.
7 #ifndef INCLUDE_JET_TRIANGLE3_H_
8 #define INCLUDE_JET_TRIANGLE3_H_
31 std::array<Vector2D, 3>
uvs;
40 const std::array<Vector3D, 3>&
points,
41 const std::array<Vector3D, 3>&
normals,
42 const std::array<Vector2D, 3>&
uvs,
76 const Vector3D& otherPoint)
const override;
79 const Ray3D& ray)
const override;
108 std::array<Vector3D, 3> _points;
109 std::array<Vector3D, 3> _normals;
110 std::array<Vector2D, 3> _uvs;
115 #endif // INCLUDE_JET_TRIANGLE3_H_
Builder & withPoints(const std::array< Vector3D, 3 > &points)
Returns builder with points.
double area() const
Returns the area of this triangle.
BoundingBox3D boundingBoxLocal() const override
Returns the bounding box of this surface object in local frame.
Vector3D closestNormalLocal(const Vector3D &otherPoint) const override
void getBarycentricCoords(const Vector3D &pt, double *b0, double *b1, double *b2) const
Returns barycentric coordinates for the given point pt.
SurfaceRayIntersection3 closestIntersectionLocal(const Ray3D &ray) const override
Returns the closest intersection point for given ray in local frame.
Front-end to create Triangle3 objects step by step.
Definition: triangle3.h:90
3-D axis-aligned bounding box class.
Definition: bounding_box3.h:41
static Builder builder()
Returns builder fox Triangle3.
Base class for 3-D surface builder.
Definition: surface3.h:115
std::array< Vector3D, 3 > points
Three points.
Definition: triangle3.h:22
bool isNormalFlipped
Flips normal when calling Surface3::closestNormal(...).
Definition: surface3.h:33
Definition: advection_solver2.h:18
void setNormalsToFaceNormal()
Set Triangle3::normals to the face normal.
Vector3D closestPointLocal(const Vector3D &otherPoint) const override
bool intersectsLocal(const Ray3D &ray) const override
std::array< Vector2D, 3 > uvs
Three UV coordinates.
Definition: triangle3.h:31
Transform3 transform
Local-to-world transform.
Definition: surface3.h:30
Class for 2-D ray.
Definition: ray3.h:21
Triangle3Ptr makeShared() const
Builds shared pointer of Triangle3 instance.
Struct that represents ray-surface intersection point.
Definition: surface3.h:19
3-D vector class.
Definition: vector3.h:25
Builder & withNormals(const std::array< Vector3D, 3 > &normals)
Returns builder with normals.
3-D triangle geometry.
Definition: triangle3.h:20
Triangle3(const Transform3 &transform=Transform3(), bool isNormalFlipped=false)
Constructs an empty triangle.
std::array< Vector3D, 3 > normals
Three normals.
Definition: triangle3.h:28
Triangle3(const Triangle3 &other)
Copy constructor.
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.
std::shared_ptr< Triangle3 > Triangle3Ptr
Shared pointer for the Triangle3 type.
Definition: triangle3.h:83
Abstract base class for 3-D surface.
Definition: surface3.h:27
Vector3D faceNormal() const
Returns the face normal of the triangle.
Builder & withUvs(const std::array< Vector2D, 3 > &uvs)
Returns builder with uvs.
Triangle3 build() const
Builds Triangle3.