Core 1.0
Sector Class Reference

Intersection between a cone and a sphere. More...

#include <sector.h>

Public Member Functions

 Sector ()
 Empty.
 Sector (const double &, const double &=Math::HalfPi)
 Creates a sector.
 Sector (const Vector &, const Vector &, const double &, const double &=Math::HalfPi)
 Creates a sector.
 ~Sector ()
 Empty.
double Signed (const Vector &) const
 Compute the signed Euclidean distance between a point and a sector.
void Rotate (const Matrix &)
 Rotates a sector.
void Translate (const Vector &)
 Translates a sector.
void Scale (const double &)
 Uniformly scales a sector.
Box GetBox () const
 Compute the axis aligned bounding box of a sector.

Protected Attributes

Vector c = Vector::Null
 Center of the sector.
Vector axis = Vector::Z
 Axis.
double a = Math::Pi / 4.0
 Angle.
Vector2 s = Vector2(Math::InvSqrt2, Math::InvSqrt2)
 Sine and cosine of the sector angle.
double r = 1.0
 Radius.

Friends

std::ostream & operator<< (std::ostream &s, const Sector &sector)
 Overloaded.

Detailed Description

Intersection between a cone and a sphere.

Constructor & Destructor Documentation

◆ Sector() [1/2]

Sector::Sector ( const double & r,
const double & a = Math::HalfPi )
explicit

Creates a sector.

Parameters
rRadius.
aAngle.

◆ Sector() [2/2]

Sector::Sector ( const Vector & c,
const Vector & axis,
const double & r,
const double & a = Math::HalfPi )
explicit

Creates a sector.

Parameters
cCenter.
axisAxis, which should be normalized.
rRadius.
aAngle.

Member Function Documentation

◆ GetBox()

Box Sector::GetBox ( ) const

Compute the axis aligned bounding box of a sector.

The box is the one of a cylinder of axis the axis of the sector. The sector is inside the half space in front of the plane through the center if the angle is not larger than \( \pi/2 \), otherwise it extends behind this plane down to the distance \( r \cos a \) along the axis. The radius of the cylinder is the largest distance to the axis, which is r for an angle larger than \( \pi/2 \) and \( r \sin a \) otherwise.

◆ Rotate()

void Sector::Rotate ( const Matrix & r)

Rotates a sector.

Parameters
rRotation matrix.

◆ Scale()

void Sector::Scale ( const double & s)

Uniformly scales a sector.

Parameters
sScaling factor.

◆ Signed()

double Sector::Signed ( const Vector & p) const

Compute the signed Euclidean distance between a point and a sector.

Parameters
pPoint.

◆ Translate()

void Sector::Translate ( const Vector & t)

Translates a sector.

Parameters
tTranslation vector.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Sector & sector )
friend

Overloaded.

Parameters
sStream.
sectorThe sector.