Core 1.0
Sector2 Class Reference

Intersection between a cone and a circle in the plane. More...

#include <sector.h>

Public Member Functions

 Sector2 ()
 Empty.
 
 Sector2 (const double &, const double &=Math::HalfPi)
 Creates a sector.
 
 Sector2 (const Vector2 &, const Vector2 &, const double &, const double &=Math::HalfPi)
 Creates a sector.
 
 ~Sector2 ()
 Empty.
 
double Signed (const Vector2 &) const
 Compute the signed Euclidean distance between a point and a sector.
 
void Rotate (const Matrix2 &)
 Rotates a sector.
 
void Translate (const Vector2 &)
 Translates a circle.
 
void Scale (const double &)
 Uniformly scales a circle.
 
Box2 GetBox () const
 Compute the axis aligned bounding box.
 
OrientedBox2 GetOrientedBox () const
 Compute the oriented bounding box.
 
void Draw (QGraphicsScene &, const QPen &, const QBrush &) const
 Draw the sector.
 

Protected Attributes

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

Friends

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

Detailed Description

Intersection between a cone and a circle in the plane.

Constructor & Destructor Documentation

◆ Sector2() [1/2]

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

Creates a sector.

Parameters
rRadius.
aAngle.

◆ Sector2() [2/2]

Sector2::Sector2 ( const Vector2 & c,
const Vector2 & 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

◆ Draw()

void Sector2::Draw ( QGraphicsScene & scene,
const QPen & pen,
const QBrush & brush ) const

Draw the sector.

The arc is approximated by line segments, with an π/64 angle accuracy.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush.

◆ Rotate()

void Sector2::Rotate ( const Matrix2 & r)

Rotates a sector.

Parameters
rRotation matrix.

◆ Scale()

void Sector2::Scale ( const double & s)

Uniformly scales a circle.

Parameters
sScaling factor.

◆ Signed()

double Sector2::Signed ( const Vector2 & p) const

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

Parameters
pPoint.

◆ Translate()

void Sector2::Translate ( const Vector2 & t)

Translates a circle.

Parameters
tTranslation vector.

Friends And Related Symbol Documentation

◆ operator<<

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

Overloaded.

Parameters
sStream.
sectorThe sector.