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

Cone. More...

#include <cone.h>

Inheritance diagram for NewCone:
Axis

Public Member Functions

 NewCone ()
 Vector representing the side. More...
 
 NewCone (const Vector &, const Vector &, const double &)
 Creates a cone characterized by its end-vertices and radii. More...
 
 NewCone (const double &, const double &)
 Creates a vertical cone characterized height and radii. More...
 
 ~NewCone ()
 Empty.
 
Vector operator() (int) const
 Gets either end vertex of the cone.
 
constexpr double Radius () const
 Radius of the cone.
 
int Intersect (const Ray &, double &, double &) const
 Compute the intersections between the cone and a ray. More...
 
int Intersect (const Ray &, double &, double &, Vector &, Vector &) const
 Compute the intersections between the cone and a ray. More...
 
int Intersect (const Ray &, double &, Vector &) const
 Compute the first positive intersection between the cone and a ray. More...
 
bool Inside (const Vector &) const
 Check if a point is inside or outside the cone. More...
 
double R (const Vector &) const
 Compute the distance between a point and the cone. More...
 
double Signed (const Vector &) const
 Compute the signed distance between a point and the cone. More...
 
Vector Normal (const Vector &) const
 Computes the vector distance between the cone and a point. More...
 
void Rotate (const Matrix &)
 Rotates the cone. More...
 
void Translate (const Vector &)
 Translates the cone. More...
 
void Scale (const double &)
 Uniformly scales the cone. More...
 
double Area () const
 Compute the total surface area of the cone. More...
 
double Volume () const
 Compute the volume of the cone.
 
Vector RandomInside (Random &=Random::R239) const
 Generate a random vector inside the cone. More...
 
Box GetBox () const
 Compute the axis-aligned bounding box of the cone.
 
- Public Member Functions inherited from Axis
 Axis ()
 Empty.
 
 Axis (const Vector &, const Vector &)
 Creates an axis given end vertices. More...
 
 ~Axis ()
 Empty.
 
void Rotate (const Matrix &)
 Rotates an axis. More...
 
void Translate (const Vector &)
 Translates an axis. More...
 
void Scale (const double &)
 Uniformly scales an axis. More...
 
void Scale (const Vector &)
 Scales an axis. More...
 
Quadric Equation (const Ray &) const
 Compute the polynomial equation of the Euclidean distance between a ray and the axis. More...
 
Vector Vertex (int) const
 Return one of the end vertexes of the axis.
 
Vector Point (const double &) const
 Compute a point on the axis.
 
Vector GetAxis () const
 Returns the normalized axis vector.
 
double Length () const
 Return the axis length.
 
Vector Symmetric (const Vector &) const
 Symmetric point. More...
 
Sphere Symmetric (const Sphere &) const
 Symmetric sphere. More...
 
Vector Normal (const Vector &) const
 Compute the normal vector between a point and its projection onto the edge. More...
 
double R (const Vector &) const
 Compute the squared distance to the segment. More...
 
double R (const Axis &) const
 Compute the squared distance between two axes. More...
 
double R (const Vector &, double &) const
 Compute the squared distance to the axis. More...
 
Matrix GetFrame () const
 Compute an orthonormal frame attached to the axis. More...
 

Static Public Member Functions

static Vector RandomDirection (const Vector &, const double &, Random &=Random::R239)
 Generate a random direction. More...
 
- Static Public Member Functions inherited from Axis
static Matrix GetFrame (const Vector &)
 Compute an orthonormal frame attached to the axis. More...
 
static Vector BoxVector (const Vector &)
 Compute the box vector extent of a unit circle with a given axis. More...
 

Static Public Attributes

static const double epsilon = 1.0e-4
 Epsilon value.
 
static const NewCone Unit
 Unit vertical cone.
 

Protected Attributes

double ra = 1.0
 Base radius of the cone.
 
double conelength = Math::Sqrt2
 Side length of the cone.
 
- Protected Attributes inherited from Axis
Vector b = Vector::Z
 End vertices of the axis.
 
Vector axis = Vector::Z
 Normalized axis vector.
 
double length = 1.0
 Length of the axis.
 

Friends

std::ostream & operator<< (std::ostream &, const NewCone &)
 Overloaded. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Axis
double Radial (const Vector &, Vector &, Vector &) const
 Compute the radial coordinates of a point. More...
 
Vector2 Radial (const Vector &) const
 Compute the radial coordinates of a point. More...
 

Detailed Description

Cone.

See also
Cone

Constructor & Destructor Documentation

◆ NewCone() [1/3]

NewCone::NewCone ( )
inline

Vector representing the side.

Empty.

◆ NewCone() [2/3]

NewCone::NewCone ( const Vector a,
const Vector b,
const double &  ra 
)
explicit

Creates a cone characterized by its end-vertices and radii.

Parameters
a,bEnd vertices of the axis.
raRadius.

◆ NewCone() [3/3]

NewCone::NewCone ( const double &  ab,
const double &  ra 
)
explicit

Creates a vertical cone characterized height and radii.

Parameters
abHeight.
raRadii.

Member Function Documentation

◆ Area()

double NewCone::Area ( ) const

Compute the total surface area of the cone.

The total surface area is the sum of the area of the cap discs, and the lateral surface area.

◆ Inside()

bool NewCone::Inside ( const Vector p) const

Check if a point is inside or outside the cone.

Parameters
pPoint.

◆ Intersect() [1/3]

int NewCone::Intersect ( const Ray ray,
double &  ta,
double &  tb 
) const

Compute the intersections between the cone and a ray.

Parameters
rayThe ray.
ta,tbIntersection depths.

◆ Intersect() [2/3]

int NewCone::Intersect ( const Ray ray,
double &  ta,
double &  tb,
Vector na,
Vector nb 
) const

Compute the intersections between the cone and a ray.

Parameters
rayThe ray.
ta,tbIntersection depths.
na,nbNormals at intersection points.

◆ Intersect() [3/3]

int NewCone::Intersect ( const Ray ray,
double &  t,
Vector n 
) const

Compute the first positive intersection between the cone and a ray.

Parameters
rayThe ray.
tIntersection depth.
nNormal at intersection point.

◆ Normal()

Vector NewCone::Normal ( const Vector p) const

Computes the vector distance between the cone and a point.

Parameters
pPoint.

◆ R()

double NewCone::R ( const Vector p) const

Compute the distance between a point and the cone.

Details appear in A. Barbier and E. Galin. Fast distance Computation between a Point and Cylinders, Cones, Line-swept-Spheres and Cone-Spheres. Journal of Graphics Tools. 9(2), 11-19 (2004).

Parameters
pPoint.

◆ RandomDirection()

Vector NewCone::RandomDirection ( const Vector axis,
const double &  alpha,
Random random = Random::R239 
)
static

Generate a random direction.

Parameters
axisAxis.
alphaAngle.
randomRandom number generator.

◆ RandomInside()

Vector NewCone::RandomInside ( Random random = Random::R239) const

Generate a random vector inside the cone.

Parameters
randomRandom number generator.

◆ Rotate()

void NewCone::Rotate ( const Matrix r)

Rotates the cone.

Parameters
rRotation matrix.

◆ Scale()

void NewCone::Scale ( const double &  s)

Uniformly scales the cone.

Parameters
sScaling factor.

◆ Signed()

double NewCone::Signed ( const Vector p) const

Compute the signed distance between a point and the cone.

Parameters
pPoint.

◆ Translate()

void NewCone::Translate ( const Vector t)

Translates the cone.

Parameters
tTranslation vector.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const NewCone cone 
)
friend

Overloaded.

Parameters
sStream.
coneThe cone.