|
Core 1.0
|
Circles. More...
#include <circle.h>
Public Member Functions | |
| Circle () | |
| Empty. | |
| Circle (const double &) | |
| Creates a circle. | |
| Circle (const Vector &, const Vector &, const double &) | |
| Creates a circle. | |
| Circle (const Vector &, const Vector &, const Vector &) | |
| Creates a circle given three vertices. | |
| ~Circle () | |
| Empty. | |
| bool | Intersect (const Ray &, double &) const |
| Compute the ray-disc intersection. | |
| Vector | Center () const |
| Gets the center of a circle. | |
| Vector | Axis () const |
| Axis of the circle. | |
| double | Radius () const |
| Radius of the circle. | |
| double | R (const Vector &) const |
| Compute the distance between a point and a circle. | |
| Vector | Normal (const Vector &) const |
| Computes the distance vector between a circle and a point. | |
| void | Rotate (const Matrix &) |
| Rotates a circle. | |
| void | Translate (const Vector &) |
| Translates a circle. | |
| void | Scale (const double &) |
| Uniformly scales a circle. | |
| Box | GetBox () const |
| Compute the axis aligned bounding box of a circle. | |
| double | Area () const |
| Area of a circle. | |
| Vector | RandomInside (Random &=Random::R239) const |
| Generate a random vector inside the circle. | |
| Vector | RandomOn (Random &=Random::R239) const |
| Generate a random vector on the circle. | |
| Vector | Vogel (int, int) const |
| Generate a spiraling vector in the disc. | |
Static Public Member Functions | |
| static double | Area (const double &) |
| Area of a circle given its radius. | |
Protected Attributes | |
| Vector | c = Vector::Null |
| Center of the circle. | |
| Vector | axis = Vector::Z |
| Axis. | |
| double | r = 1.0 |
| Radius. | |
Static Protected Attributes | |
| static constexpr const double | epsilon = 1.0e-10 |
| Internal epsilon constant. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Circle &circle) |
| Overloaded. | |
Circles.
Circles are characterized by their center, axis and radius. They are sometimes interpreted as discs, as for ray intersection.
|
explicit |
Creates a circle.
| r | Radius. |
Creates a circle.
| c | Center. |
| axis | Axis, which should be normalized. |
| r | Radius. |
Creates a circle given three vertices.
Basically set the center to the center of the triangle, and compute the radius.
| x,y,z | Argument vertices |
|
inline |
Area of a circle.
|
inlinestatic |
Area of a circle given its radius.
This static function avoids the creation of an instance of a circle.
| r | Radius. |
| Box Circle::GetBox | ( | ) | const |
Compute the axis aligned bounding box of a circle.
Some math will demonstrate that the box can be computed easily directly from the axis of the circle. Computations involve three square roots. For a larger but even faster bounding box, use the bounding box of the corresponding sphere:
| bool Circle::Intersect | ( | const Ray & | ray, |
| double & | t ) const |
Compute the ray-disc intersection.
| ray | The ray. |
| t | Intersection depth. |
Computes the distance vector between a circle and a point.
This function projects the point in the plane of the circle and computes the distance to the circle in its plane, before adding the extra term along the normal.
| p | Point. |
| double Circle::R | ( | const Vector & | p | ) | const |
Compute the distance between a point and a circle.
Cost: 10+, 8*, 1sqrt
| p | Point. |
| Vector Circle::RandomInside | ( | Random & | random = Random::R239 | ) | const |
Generate a random vector inside the circle.
| random | Random number generator. |
| Vector Circle::RandomOn | ( | Random & | random = Random::R239 | ) | const |
Generate a random vector on the circle.
| random | Random number generator. |
| void Circle::Rotate | ( | const Matrix & | r | ) |
Rotates a circle.
| r | Rotation matrix. |
| void Circle::Scale | ( | const double & | s | ) |
Uniformly scales a circle.
| s | Scaling factor. |
| void Circle::Translate | ( | const Vector & | t | ) |
Translates a circle.
| t | Translation vector. |
| Vector Circle::Vogel | ( | int | i, |
| int | n ) const |
Generate a spiraling vector in the disc.
| i | Integer, should be <n. |
| n | Number of points. |
|
friend |
Overloaded.
| s | Stream. |
| circle | The circle. |