Core 1.0
Public Member Functions | Friends | List of all members
Disc2 Class Reference

A disc in two dimensions. More...

#include <circle.h>

Inheritance diagram for Disc2:
Circle2 SmoothDisc2

Public Member Functions

 Disc2 ()
 Empty.
 
 Disc2 (const double &)
 Creates a disc. More...
 
 Disc2 (const Circle2 &)
 Creates a disc. More...
 
 Disc2 (const Vector2 &, const double &)
 Creates a disc. More...
 
 Disc2 (const Vector2 &, const Vector2 &, const Vector2 &)
 Creates a disc given three vertices. More...
 
 ~Disc2 ()
 Empty.
 
double R (const Vector2 &) const
 Computes the distance between a point and the disc. More...
 
double Signed (const Vector2 &) const
 Computes the signed distance between a point and the disc. More...
 
Vector2 Normal (const Vector2 &) const
 Computes the distance vector between a disc and a point. More...
 
- Public Member Functions inherited from Circle2
 Circle2 ()
 Empty.
 
 Circle2 (const double &)
 Create a circle centered at origin. More...
 
 Circle2 (const Vector2 &, const double &)
 Create a circle. More...
 
 Circle2 (const Vector2 &, const Vector2 &, const Vector2 &)
 Create the circle passing through 3 points. More...
 
 Circle2 (Vector2 *, int)
 Creates a circle enclosing a set of points. More...
 
bool Inside (const Vector2 &) const
 Check if a point is inside the circle. More...
 
bool Inside (const Circle2 &) const
 Test if a circle is entirely embedded in another one. More...
 
bool Inside (const Box2 &) const
 Test if a box is inside the circle. More...
 
bool InsideRange (const Vector2 &, const double &) const
 Check if a point is within a given range of the circle. More...
 
Vector2 Center () const
 Center of the circle.
 
Vector2 Vertex (const double &) const
 Vertex on the circle. More...
 
double Radius () const
 Radius of the circle.
 
void Extend (const Vector2 &)
 Extend the circle so that the argument point should be embedded in the new circle. More...
 
Circle2 Extended (const double &) const
 Extend the radius of the circle. More...
 
bool Intersect (const Box2 &) const
 Check intersection with a box. More...
 
bool Intersect (const Circle2 &) const
 Check if two circles intersect each other. More...
 
bool Intersect (const Ray2 &, double &, double &) const
 Check the intersection between a circle and a ray. More...
 
bool Intersect (const Ray2 &) const
 Check the intersection between a circle and a ray. More...
 
bool Intersect (const Segment2 &) const
 Check the intersection between a circle and a segment. More...
 
Vector2 Normal (const Vector2 &) const
 Compute the distance vector between a ciecle. More...
 
double R (const Vector2 &) const
 Compute the squared distance between a point and the circle. More...
 
Box2 GetBox () const
 Compute the axis aligned bounding box of a circle.
 
Circle2 Translated (const Vector &) const
 Translate a circle. More...
 
Circle2 Rotated (const Matrix2 &) const
 Rotates a circle. More...
 
void Translate (const Vector2 &)
 Translate a circle. More...
 
void Rotate (const Matrix2 &)
 Rotates a circle. More...
 
void Scale (const double &)
 Scales a circle. More...
 
double Area () const
 Area of the circle.
 
double Area (const Circle2 &) const
 Compute the area of the surface between two circles. More...
 
Vector2 RandomInside (Random &=Random::R239) const
 Generate a random vector inside the circle. More...
 
Vector2 RandomOn (Random &=Random::R239) const
 Generate a random vector on the circle. More...
 
QVector< Vector2Poisson (const double &, int, bool=false, Random &=Random::R239) const
 Compute a Poisson sphere distribution inside a circle. More...
 
QuadricCurve2 QuadricBezierArc (const double &) const
 Compute the quadratic Bézier approximation of a circle arc. More...
 
CubicCurve2 CubicBezierArc (const double &) const
 Compute the cubic Bézier approximation of a circle arc. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a circle. More...
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from Circle2
static Vector2 RandomUnit (Random &=Random::R239)
 Compute a random vertex inside a unit disc. More...
 
- Static Public Attributes inherited from Circle2
static const Circle2 Unit
 Unit circle.
 
static const Circle2 Infinite
 Infinite circle.
 
- Protected Attributes inherited from Circle2
Vector2 c = Vector2::Null
 Center.
 
double r = 1.0
 Radius.
 
- Static Protected Attributes inherited from Circle2
static constexpr const double Epsilon = 1.e-6
 Epslion for intersection tests
 

Detailed Description

A disc in two dimensions.

Discs in the plane derive from Circle2, and only reimplement a few functions, such as Disc2::R() and Disc2::Normal().

Constructor & Destructor Documentation

◆ Disc2() [1/4]

Disc2::Disc2 ( const double &  r)
explicit

Creates a disc.

Parameters
rRadius.

◆ Disc2() [2/4]

Disc2::Disc2 ( const Circle2 circle)
explicit

Creates a disc.

Parameters
circleCircle.

◆ Disc2() [3/4]

Disc2::Disc2 ( const Vector2 c,
const double &  r 
)
explicit

Creates a disc.

Parameters
cCenter.
rRadius.

◆ Disc2() [4/4]

Disc2::Disc2 ( const Vector2 x,
const Vector2 y,
const Vector2 z 
)
explicit

Creates a disc given three vertices.

Basically set the center to the center of the triangle, and compute the radius.

Parameters
x,y,zArgument vertices

Member Function Documentation

◆ Normal()

Vector2 Disc2::Normal ( const Vector2 p) const

Computes the distance vector between a disc and a point.

Parameters
pPoint.

◆ R()

double Disc2::R ( const Vector2 p) const

Computes the distance between a point and the disc.

Parameters
pPoint.

◆ Signed()

double Disc2::Signed ( const Vector2 p) const

Computes the signed distance between a point and the disc.

Parameters
pPoint.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Disc2 disc 
)
friend

Overloaded.

Parameters
sStream.
discThe disc.