#include <mesh.h>
Public Member Functions | |
MeshQuadrilateral (const Mesh *m, int n) | |
virtual | ~MeshQuadrilateral () |
virtual BBox | ObjectBound () const |
virtual BBox | WorldBound () const |
virtual bool | CanIntersect () const |
virtual bool | Intersect (const Ray &ray, Intersection *isect) const |
virtual bool | IntersectP (const Ray &ray) const |
virtual void | GetShadingGeometry (const Transform &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) const |
virtual bool | CanSample () const |
virtual float | Area () const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
bool | isDegenerate () const |
Static Public Member Functions | |
static bool | IsPlanar (const Point &p0, const Point &p1, const Point &p2, const Point &p3) |
static bool | IsDegenerate (const Point &p0, const Point &p1, const Point &p2, const Point &p3) |
static bool | IsConvex (const Point &p0, const Point &p1, const Point &p2, const Point &p3) |
Private Member Functions | |
void | GetUVs (float uv[4][2]) const |
Static Private Member Functions | |
static int | MajorAxis (const Vector &v) |
static void | ComputeV11BarycentricCoords (const Vector &e01, const Vector &e02, const Vector &e03, float *a11, float *b11) |
Private Attributes | |
const Mesh * | mesh |
const int * | idx |
Definition at line 201 of file mesh.h.
Definition at line 180 of file meshquadrilateral.cpp.
References ComputeV11BarycentricCoords(), lux::Cross(), idx, IsConvex(), IsDegenerate(), IsPlanar(), LUX_CONSISTENCY, LUX_ERROR, luxError, mesh, lux::Mesh::p, and lux::Shape::WorldToObject.
virtual lux::MeshQuadrilateral::~MeshQuadrilateral | ( | ) | [inline, virtual] |
float MeshQuadrilateral::Area | ( | ) | const [virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 435 of file meshquadrilateral.cpp.
References lux::Cross(), idx, lux::Vector::Length(), mesh, and lux::Mesh::p.
virtual bool lux::MeshQuadrilateral::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
virtual bool lux::MeshQuadrilateral::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
void MeshQuadrilateral::ComputeV11BarycentricCoords | ( | const Vector & | e01, | |
const Vector & | e02, | |||
const Vector & | e03, | |||
float * | a11, | |||
float * | b11 | |||
) | [static, private] |
Definition at line 146 of file meshquadrilateral.cpp.
References lux::Cross(), MajorAxis(), lux::Vector::x, lux::Vector::y, and lux::Vector::z.
Referenced by Intersect(), and MeshQuadrilateral().
void MeshQuadrilateral::GetShadingGeometry | ( | const Transform & | obj2world, | |
const DifferentialGeometry & | dg, | |||
DifferentialGeometry * | dgShading | |||
) | const [virtual] |
Calculates the shading geometry from the given intersection geometry.
obj2world | The object to world transformation to use. | |
dg | The intersection geometry. | |
dgShading | The destination for the shading geometry. |
Reimplemented from lux::Primitive.
Definition at line 453 of file meshquadrilateral.cpp.
References lux::Cross(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::dpdx, lux::DifferentialGeometry::dpdy, lux::DifferentialGeometry::dudx, lux::DifferentialGeometry::dudy, lux::DifferentialGeometry::dvdx, lux::DifferentialGeometry::dvdy, GetUVs(), idx, lux::Invert3x3(), lux::Vector::Length(), lux::BBox::MaximumExtent(), mesh, lux::Mesh::n, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::BBox::pMax, lux::BBox::pMin, lux::DifferentialGeometry::u, lux::Mesh::uvs, lux::DifferentialGeometry::v, WorldBound(), lux::Normal::x, lux::Normal::y, and lux::Normal::z.
void lux::MeshQuadrilateral::GetUVs | ( | float | uv[4][2] | ) | const [inline, private] |
Definition at line 260 of file mesh.h.
References idx, mesh, lux::Mesh::p, lux::Mesh::uvs, lux::Point::x, and lux::Point::y.
Referenced by GetShadingGeometry(), Intersect(), and Sample().
bool MeshQuadrilateral::Intersect | ( | const Ray & | r, | |
Intersection * | in | |||
) | const [virtual] |
Intersects this primitive with the given ray. If an intersection is found, the ray will (i.e. r.tmax) and all fields in the intersection info will be updated.
r | The ray to intersect with this primitive. | |
in | The destination of the intersection information. |
Reimplemented from lux::Primitive.
Definition at line 271 of file meshquadrilateral.cpp.
References lux::DifferentialGeometry::AdjustNormal(), ComputeV11BarycentricCoords(), lux::CoordinateSystem(), lux::Cross(), lux::Ray::d, lux::Intersection::dg, lux::Dot(), lux::Shape::GetMaterial(), GetUVs(), idx, lux::Invert3x3(), lux::Ray::maxt, mesh, lux::Mesh::n, lux::Normalize(), lux::Ray::o, lux::Shape::ObjectToWorld, lux::Mesh::p, Quadratic(), lux::Shape::reverseOrientation, lux::Intersection::Set(), lux::Shape::transformSwapsHandedness, lux::Shape::WorldToObject, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
Referenced by IntersectP().
bool MeshQuadrilateral::IntersectP | ( | const Ray & | r | ) | const [virtual] |
Tests for intersection of this primitive with the given ray.
r | The ray to intersect with this primitive. |
Reimplemented from lux::Primitive.
Definition at line 431 of file meshquadrilateral.cpp.
References Intersect().
bool MeshQuadrilateral::IsConvex | ( | const Point & | p0, | |
const Point & | p1, | |||
const Point & | p2, | |||
const Point & | p3 | |||
) | [static] |
Definition at line 73 of file meshquadrilateral.cpp.
References lux::Cross(), lux::Dot(), lux::Normalize(), lux::Vector::x, and lux::Vector::z.
Referenced by MeshQuadrilateral().
bool MeshQuadrilateral::IsDegenerate | ( | const Point & | p0, | |
const Point & | p1, | |||
const Point & | p2, | |||
const Point & | p3 | |||
) | [static] |
Definition at line 29 of file meshquadrilateral.cpp.
References lux::Vector::Length().
Referenced by MeshQuadrilateral().
bool lux::MeshQuadrilateral::isDegenerate | ( | ) | const [inline] |
Definition at line 247 of file mesh.h.
Referenced by lux::Mesh::Refine().
bool MeshQuadrilateral::IsPlanar | ( | const Point & | p0, | |
const Point & | p1, | |||
const Point & | p2, | |||
const Point & | p3 | |||
) | [static] |
Definition at line 46 of file meshquadrilateral.cpp.
References lux::Cross(), lux::Dot(), lux::Vector::Length(), and p.
Referenced by lux::Mesh::Mesh(), and MeshQuadrilateral().
Definition at line 136 of file meshquadrilateral.cpp.
References lux::Vector::x, lux::Vector::y, and lux::Vector::z.
Referenced by ComputeV11BarycentricCoords().
BBox MeshQuadrilateral::ObjectBound | ( | ) | const [virtual] |
Definition at line 242 of file meshquadrilateral.cpp.
References idx, mesh, lux::Mesh::p, lux::Union(), and lux::Shape::WorldToObject.
virtual void lux::MeshQuadrilateral::Sample | ( | float | u1, | |
float | u2, | |||
float | u3, | |||
DifferentialGeometry * | dg | |||
) | const [inline, virtual] |
Samples a point on this primitive. Only the p, nn, dpdu, dpdv, u and v need to be calculated.
u1 | The point coordinate in the first dimension. | |
u2 | The point coordinate in the second dimension. | |
u3 | The subprimitive to sample. | |
dg | The destination to store the sampled point in. |
Reimplemented from lux::Primitive.
Definition at line 220 of file mesh.h.
References lux::CoordinateSystem(), lux::Cross(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, GetUVs(), idx, mesh, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::Mesh::p, lux::Shape::reverseOrientation, lux::Shape::transformSwapsHandedness, lux::DifferentialGeometry::u, and lux::DifferentialGeometry::v.
BBox MeshQuadrilateral::WorldBound | ( | ) | const [virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 257 of file meshquadrilateral.cpp.
References idx, mesh, lux::Mesh::p, and lux::Union().
Referenced by GetShadingGeometry().
const int* lux::MeshQuadrilateral::idx [private] |
Definition at line 284 of file mesh.h.
Referenced by Area(), GetShadingGeometry(), GetUVs(), Intersect(), MeshQuadrilateral(), ObjectBound(), Sample(), and WorldBound().
const Mesh* lux::MeshQuadrilateral::mesh [private] |
Definition at line 283 of file mesh.h.
Referenced by Area(), GetShadingGeometry(), GetUVs(), Intersect(), MeshQuadrilateral(), ObjectBound(), Sample(), and WorldBound().