#include <Triangle.h>
Public Member Functions | |
Triangle (const Point3D &a, const Point3D &b, const Point3D &c, const Vec3D &fNo, SolidObject *parent=0) | |
Triangle (Vertex *av, Vertex *bv, Vertex *cv, SolidObject *parent=0, bool smooth=false) | |
virtual | ~Triangle () |
Vertex * | operator[] (int i) const |
Vertex *& | operator[] (int i) |
virtual Intersection | intersect (Ray &ray) const |
virtual const AABB & | getBoundingBox () const |
virtual const Point3D & | getCentroid () const |
virtual Vec3D | getSNormal (float beta, float gamma) const |
virtual Vec3D | getGNormal (float beta, float gamma) const |
virtual Point2D | getUV (float beta, float gamma) const |
virtual Point3D | getPoint (float beta, float gamma) const |
virtual Point2D | getUV (const Point2D &p) const |
virtual Point3D | getPoint (const Point2D &p) const |
virtual Vec3D | getTangent (float beta, float gamma) const |
virtual bool | isSmooth () const |
void | updateBox () |
void | clipPlane (Axis axis, float plane, AABB &lBox, AABB &rBox) const |
Protected Member Functions | |
float | volume (const Point3D &o, const Point3D &e, const Point3D &a, const Point3D &b) const |
bool | sameSign (const float &a, const float &b) const |
Protected Attributes | |
Vertex * | a |
Vertex * | b |
Vertex * | c |
AABB | box |
Point3D | center |
Vec3D | faceNormal |
Vec3D | tangent |
bool | ownVertices |
bool | smooth |
Definition at line 18 of file Triangle.h.
rcrt::Triangle::Triangle | ( | const Point3D & | a, | |
const Point3D & | b, | |||
const Point3D & | c, | |||
const Vec3D & | fNo, | |||
SolidObject * | parent = 0 | |||
) |
Creates a triangle without Vertex data. Triangles created this way are never smooth.
a | ||
b | ||
c | ||
fNo | The normal of the triangle. | |
parent |
Definition at line 21 of file Triangle.cpp.
References a, b, c, faceNormal, ownVertices, and updateBox().
Referenced by rcrt::DisplacedTriangle::DisplacedTriangle(), and rcrt::DisplacedTriangle::intersect().
rcrt::Triangle::Triangle | ( | Vertex * | av, | |
Vertex * | bv, | |||
Vertex * | cv, | |||
SolidObject * | parent = 0 , |
|||
bool | smooth = false | |||
) |
Creates a triangle wit Vertex data.
av | ||
bv | ||
cv | ||
parent | ||
smooth | Whether this Triangle should use interpolated normals. |
Definition at line 33 of file Triangle.cpp.
References a, b, c, rcrt::Vec2D::det(), faceNormal, rcrt::Vec3D::normalize(), ownVertices, rcrt::Vertex::pos(), tangent, updateBox(), and rcrt::Vertex::uv().
rcrt::Triangle::~Triangle | ( | ) | [virtual] |
float rcrt::Triangle::volume | ( | const Point3D & | o, | |
const Point3D & | e, | |||
const Point3D & | a, | |||
const Point3D & | b | |||
) | const [protected] |
Definition at line 9 of file Triangle.cpp.
bool rcrt::Triangle::sameSign | ( | const float & | a, | |
const float & | b | |||
) | const [protected] |
Definition at line 16 of file Triangle.cpp.
Vertex * rcrt::Triangle::operator[] | ( | int | i | ) | const |
Vertex *& rcrt::Triangle::operator[] | ( | int | i | ) |
Intersection rcrt::Triangle::intersect | ( | Ray & | r | ) | const [virtual] |
The | ray that will be tested against. |
Implements rcrt::Traceable.
Reimplemented in rcrt::DisplacedTriangle.
Definition at line 156 of file Triangle.cpp.
References a, rcrt::Ray::atDistance(), b, c, rcrt::Vec3D::crossP(), rcrt::Ray::dir(), faceNormal, rcrt::Ray::maxDist(), rcrt::Ray::org(), rcrt::Vertex::pos(), rcrt::Intersection::setUV(), and rcrt::Ray::tris.
Referenced by rcrt::DisplacedTriangle::intersect().
const AABB & rcrt::Triangle::getBoundingBox | ( | ) | const [virtual] |
Implements rcrt::Traceable.
Definition at line 197 of file Triangle.cpp.
References box.
const Point3D & rcrt::Triangle::getCentroid | ( | ) | const [virtual] |
Implements rcrt::Traceable.
Definition at line 202 of file Triangle.cpp.
References center.
Vec3D rcrt::Triangle::getSNormal | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
Definition at line 207 of file Triangle.cpp.
References a, b, c, faceNormal, rcrt::Vertex::normal(), and smooth.
Vec3D rcrt::Triangle::getGNormal | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
Definition at line 215 of file Triangle.cpp.
References faceNormal.
Point2D rcrt::Triangle::getUV | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
Definition at line 220 of file Triangle.cpp.
References a, b, c, rcrt::Vertex::uv(), rcrt::Point2D::x(), and rcrt::Point2D::y().
Referenced by rcrt::DisplacedTriangle::getDispPoint(), and getUV().
Point3D rcrt::Triangle::getPoint | ( | float | beta, | |
float | gamma | |||
) | const [virtual] |
Definition at line 227 of file Triangle.cpp.
References a, b, c, and rcrt::Vertex::pos().
Referenced by rcrt::DisplacedTriangle::getDispNormal(), rcrt::DisplacedTriangle::getDispPoint(), getPoint(), and rcrt::DisplacedTriangle::intersect().
Vec3D rcrt::Triangle::getTangent | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Reimplemented from rcrt::Primitive.
Definition at line 247 of file Triangle.cpp.
References tangent.
bool rcrt::Triangle::isSmooth | ( | ) | const [virtual] |
void rcrt::Triangle::updateBox | ( | ) |
Definition at line 252 of file Triangle.cpp.
References a, b, box, c, rcrt::AABB::extend(), rcrt::Vertex::pos(), rcrt::Point3D::x(), rcrt::Point3D::y(), and rcrt::Point3D::z().
Referenced by Triangle().
axis | The Axis of the plane with which to clip. | |
plane | The value along the axis which describes the plane. | |
lBox | An AABB that should contain the left part (with respect to the clipping plane) of the object after calling this method. | |
rBox | An AABB that should contain the right part of the object after this method. |
Reimplemented from rcrt::Traceable.
Definition at line 279 of file Triangle.cpp.
References a, b, c, rcrt::AABB::extend(), and rcrt::Vertex::pos().
Vertex* rcrt::Triangle::a [protected] |
Definition at line 21 of file Triangle.h.
Referenced by rcrt::DisplacedTriangle::baseIntersect(), clipPlane(), rcrt::DisplacedTriangle::DisplacedTriangle(), getPoint(), getSNormal(), getUV(), intersect(), rcrt::DisplacedTriangle::intersect(), operator[](), Triangle(), updateBox(), and ~Triangle().
Vertex* rcrt::Triangle::b [protected] |
Definition at line 22 of file Triangle.h.
Referenced by rcrt::DisplacedTriangle::baseIntersect(), clipPlane(), rcrt::DisplacedTriangle::DisplacedTriangle(), getPoint(), getSNormal(), getUV(), intersect(), rcrt::DisplacedTriangle::intersect(), operator[](), Triangle(), updateBox(), and ~Triangle().
Vertex* rcrt::Triangle::c [protected] |
Definition at line 23 of file Triangle.h.
Referenced by rcrt::DisplacedTriangle::baseIntersect(), clipPlane(), rcrt::DisplacedTriangle::DisplacedTriangle(), getPoint(), getSNormal(), getUV(), intersect(), rcrt::DisplacedTriangle::intersect(), operator[](), Triangle(), updateBox(), and ~Triangle().
AABB rcrt::Triangle::box [protected] |
Definition at line 24 of file Triangle.h.
Referenced by rcrt::DisplacedTriangle::DisplacedTriangle(), getBoundingBox(), rcrt::DisplacedTriangle::intersect(), and updateBox().
Point3D rcrt::Triangle::center [protected] |
Vec3D rcrt::Triangle::faceNormal [protected] |
Definition at line 27 of file Triangle.h.
Referenced by rcrt::DisplacedTriangle::baseIntersect(), rcrt::DisplacedTriangle::DisplacedTriangle(), getGNormal(), getSNormal(), intersect(), rcrt::DisplacedTriangle::intersect(), and Triangle().
Vec3D rcrt::Triangle::tangent [protected] |
bool rcrt::Triangle::ownVertices [protected] |
bool rcrt::Triangle::smooth [protected] |