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

Core class for stepping along a ray. More...

#include <raystep.h>

Inheritance diagram for RayStep:
Segment

Public Member Functions

 RayStep (const Vector &, const Vector &)
 Create a ray stepping structure. More...
 
 RayStep (const Ray &, const double &, const double &)
 Create a ray stepping structure. More...
 
Vector Vertex (int) const
 Return one of the end vertex of the axis.
 
Vector VertexAt (const double &) const
 Compute a point on the segment. More...
 
Segment GetSegment () const
 Get the segment.
 
Sphere GetSphere () const
 Return the embedding sphere.
 
Vector Center () const
 Get the center.
 
double Radius () const
 Return the segment radius.
 
double GetLength () const
 Return the length of the segment.
 
Vector GetAxis () const
 Return the unit vector.
 
Box GetBox () const
 Return the bounding box.
 
 ~RayStep ()
 Empty.
 
void Step (const double &, const double &)
 Compute the next step forward. More...
 
RayStep Translated (const Vector &) const
 Translates a segment. More...
 
RayStep Scaled (const Vector &) const
 Scales a segment. More...
 
RayStep Rotated (const Matrix &) const
 Rotates a segment. More...
 
bool Intersect (const Box &) const
 Compute the intersection between the segment and a box. More...
 
RayStep InverseTransformed (const Frame &) const
 Inverse transformation. More...
 

Static Public Attributes

static const double epsilon = 1.0e-8
  ε for intersection tests.
 

Protected Attributes

Vector u
 Unit direction vector.
 
double length
 Length.
 
Vector c
 Center.
 
double r
 Radius.
 
Box box
 Bounding box.
 
- Protected Attributes inherited from Segment
Vector b = Vector::Z
 End vertices of the segment.
 

Additional Inherited Members

- Protected Member Functions inherited from Segment
 Segment ()
 Empty.
 
 Segment (const Vector &, const Vector &)
 Creates a segment given its end vertices. More...
 
 ~Segment ()
 Empty.
 
void Rotate (const Matrix &)
 Rotates a segment. More...
 
void Translate (const Vector &)
 Translates a segment. More...
 
void Scale (const double &)
 Uniformly scales a segment. More...
 
Segment Translated (const Vector &) const
 Translates a segment. More...
 
Segment Scaled (const Vector &) const
 Scales a segment. More...
 
Segment Scaled (const double &) const
 Uniformly scales a segment. More...
 
Segment Rotated (const Matrix &) const
 Rotates a segment. More...
 
Segment InverseTransformed (const Frame &) const
 Inverse transformation. More...
 
Quadric Equation (const Ray &) const
 Computes the polynomial equation of the Euclidean distance between a ray and the line corresponding to the segment. More...
 
Vector Vertex (int) const
 Return one of the end vertex of the axis.
 
VectorVertex (int)
 Return one of the end vertex of the axis.
 
Vector VertexAt (const double &) const
 Compute a point on the segment. More...
 
Vector Center () const
 Compute the center of the segment.
 
bool Intersect (const Box &) const
 Check if a segment intersects a box. More...
 
Vector GetAxis () const
 Returns the normalized axis vector.
 
Box GetBox () const
 Compute the bounding box of the segment.
 
double Length () const
 Return axis length.
 
double R (const Vector &) const
 Compute the squared distance to the segment. More...
 
double R (const Vector &, double &) const
 Compute the squared distance to the segment. More...
 
double R (const Segment &) const
 Compute the squared distance between two segments. More...
 
Vector Normal (const Vector &) const
 Compute the normal vector between a point and its projection onto the segment. More...
 
bool Equal (const Segment &, const double &) const
 Test if two segments are almost equal. More...
 
- Static Protected Member Functions inherited from Segment
static Quadric EdgeEquation (const Ray &, const Vector &, const Vector &, const Vector &)
 Compute the polynomial equation of the distance function along the ray. More...
 
static Vector Intersect (const Vector &, const Vector &, const double, const double, double=0.0)
 Compute the intersection between the line f(x)=y and a line such that f(a)=va and f(b)=vb, on the segment ab. More...
 

Detailed Description

Core class for stepping along a ray.

The class stores the end points of the line segment, its length and unit direction.

Constructor & Destructor Documentation

◆ RayStep() [1/2]

RayStep::RayStep ( const Vector a,
const Vector b 
)
explicit

Create a ray stepping structure.

Parameters
a,bSegment points.

◆ RayStep() [2/2]

RayStep::RayStep ( const Ray ray,
const double &  t,
const double &  s 
)
explicit

Create a ray stepping structure.

Parameters
rayThe ray.
tPosition on the ray.
sStepping length.

Member Function Documentation

◆ Intersect()

bool RayStep::Intersect ( const Box box) const

Compute the intersection between the segment and a box.

Parameters
boxThe box.
See also
Segment::Intersect(const Box&) const

◆ InverseTransformed()

RayStep RayStep::InverseTransformed ( const Frame frame) const

Inverse transformation.

Parameters
frameThe frame.

◆ Rotated()

RayStep RayStep::Rotated ( const Matrix r) const

Rotates a segment.

Parameters
rRotation matrix.

◆ Scaled()

RayStep RayStep::Scaled ( const Vector s) const

Scales a segment.

Parameters
sScaling vector.

◆ Step()

void RayStep::Step ( const double &  s,
const double &  l 
)

Compute the next step forward.

Start form the first vertex of the segment, step in the same direction by a given distance, with a new stepping distance.

Avoids the re-computation of the unit direction vector, and testing segment vertexes for computing the bounding box.

Parameters
sStepping distance.
lNext segment length.

◆ Translated()

RayStep RayStep::Translated ( const Vector t) const

Translates a segment.

Parameters
tTranslation vector.

◆ VertexAt()

Vector RayStep::VertexAt ( const double &  t) const
inline

Compute a point on the segment.

Parameters
tInterpolation parameter.