Core 1.0
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
Slab Class Reference

A simple slab class. More...

#include <slab.h>

Inheritance diagram for Slab:
Plane

Public Member Functions

 Slab (const Plane &, const double &)
 Create a slab given a normal direction and two points to define the plane coefficients. More...
 
 Slab ()
 Empty.
 
 ~Slab ()
 Empty.
 
Vector Normal () const
 Return the normal direction of the slab.
 
double R (const Vector &) const
 Compute the squared distance to the slab. More...
 
double Signed (const Vector &) const
 Compute the signed distance to the slab. More...
 
bool Intersect (const Ray &, double &, double &) const
 Compute the intersection between a slab and a ray. More...
 
bool Inside (const Vector &) const
 Check if a point is inside the slab. More...
 
void Rotate (const Matrix &)
 Rotate a plane. More...
 
void Translate (const double &)
 Translates a plane in the direction of its normal. More...
 

Static Public Attributes

static double epsilon = 1.0e-5
 Internal epsilon constant.
 

Protected Attributes

double e = 0.0
 Thickness.
 
- Protected Attributes inherited from Plane
Vector n = Vector::Z
 Plane normal.
 
double c = 0.0
 Plane coefficient.
 

Additional Inherited Members

- Protected Member Functions inherited from Plane
 Plane ()
 Empty.
 
 Plane (const double &, const double &, const double &, const double &)
 Creates a plane given its analytic equation. More...
 
 Plane (const Vector &, const double &)
 Creates a plane given normal and distance. More...
 
 Plane (const Vector &, const Vector &)
 Creates a plane given normal and vertex. More...
 
 Plane (const Vector &)
 Creates a plane given normal passing through the origin. More...
 
 ~Plane ()
 Empty.
 
bool Intersect (const Ray &, double &) const
 Compute the intersection between a plane and a ray. More...
 
bool Inside (const Vector &) const
 Check if a point is inside or outside the plane. More...
 
int Side (const Vector &) const
 Check if a point lies inside, outside or even on the plane. More...
 
Vector Normal () const
 Returns the normal to the plane.
 
Vector Vertex () const
 Finds a vertex on the plane. More...
 
double R (const Vector &) const
 Compute the squared distance to the half space delimited by the plane. More...
 
double Signed (const Vector &) const
 Compute the signed distance between a point and the plane. More...
 
double Eval (const Vector &) const
 Evaluates the equation of the plane. More...
 
void Transform (const Matrix4 &)
 Transforms a plane given a homogeneous transformation matrix. More...
 
void Translate (const double &)
 Translates a plane in the direction of its normal. More...
 
void Rotate (const Matrix &)
 Rotate a plane. More...
 
Vector Symmetry (const Vector &) const
 Compute the point symmetric to the argument point. More...
 
Box Symmetric (const Box &) const
 Compute the boundix box of the symmetric argument box. More...
 
Segment Symmetric (const Segment &) const
 Compute the symmetric segment. More...
 
Sphere Symmetric (const Sphere &) const
 Compute the symmetric sphere. More...
 
Vector Reflect (const Vector &) const
 Compute the reflected direction. More...
 
bool Refract (const Vector &, const double &, Vector &) const
 Compute the refracted direction. More...
 
Vector Intersect (const Line &) const
 Compute the intersection between a plane and a line. More...
 
bool Intersect (const Segment &, double &) const
 Compute the intersection between a plane and a segment. More...
 
Quadric Equation (const Ray &) const
 Compute the quadric equation of the Euclidean distance to the plane. More...
 
Frame GetFrame () const
 Return a Frame attached to the plane. More...
 
Axis Intersect (const Plane &) const
 Compute the intesection between two planes. More...
 
- Static Protected Member Functions inherited from Plane
static void Cast (const Vector &, double &, double &)
 Compute the inverse mapping coordinates of a point. More...
 
static Vector Intersection (const Plane &, const Plane &, const Plane &)
 Compute the intersection between three planes. More...
 
static QVector< VectorConvexPoints (const QVector< Plane > &)
 Compute the intersection of a set of half spaces. More...
 
static Vector Reflect (const Vector &, const Vector &)
 Given an input (normalized) normal, compute a reflected direction. The code is the same as: More...
 
static bool Refract (const Vector &, const Vector &, const double &, Vector &)
 Compute the refracted direction. More...
 
- Static Protected Attributes inherited from Plane
static const double epsilon = 1e-06
 Small value for checking intersection with a ray.
 
static const Plane Horizontal
 Reference horizontal plane.
 

Detailed Description

A simple slab class.

The class stores the normal and the constant coefficient of the plane equations.

This class implements some optimized functions, such as the intersection with a ray.

Constructor & Destructor Documentation

◆ Slab()

Slab::Slab ( const Plane plane,
const double &  t 
)

Create a slab given a normal direction and two points to define the plane coefficients.

Parameters
planePlane.
tThickness.

Member Function Documentation

◆ Inside()

bool Slab::Inside ( const Vector p) const

Check if a point is inside the slab.

Parameters
pPoint.

◆ Intersect()

bool Slab::Intersect ( const Ray ray,
double &  tmin,
double &  tmax 
) const

Compute the intersection between a slab and a ray.

Sorted intersection depths are returned if intersection occurs.

Parameters
rayThe ray.
tmin,tmaxIntersection depths.

◆ R()

double Slab::R ( const Vector p) const

Compute the squared distance to the slab.

Parameters
pPoint.

◆ Rotate()

void Plane::Rotate ( const Matrix r)

Rotate a plane.

Parameters
rRotation matrix.

◆ Signed()

double Slab::Signed ( const Vector p) const

Compute the signed distance to the slab.

Parameters
pPoint.

◆ Translate()

void Plane::Translate ( const double &  t)

Translates a plane in the direction of its normal.

Parameters
tTranslation distance.