template<typename T>
werkzeugkiste::geometry::Circle_ class

Represents a circle.

Public types

using vec_type = Vec<T, 2>

Constructors, destructors, conversion operators

Circle_() defaulted
Constructs an invalid circle.
Circle_(vec_type center, T radius)
Circle from center and radius.
Circle_(const vec_type& p, const vec_type& q, const vec_type& r)
Circle from 3 points.

Public functions

auto IsValid() const -> bool
Returns true if this is a valid circle.
auto Center() const -> vec_type
Returns the center point as 2d vector.
auto CenterX() const -> T
Returns the x-coordinate of the center point.
auto CenterY() const -> T
Returns the y-coordinate of the center point.
auto Radius() const -> T
Returns the radius.
auto Area() const -> T
Returns the area.
auto IsPointInCircle(const vec_type& pt, bool* is_on_circle = nullptr) const -> bool
Returns true if the point is inside the circle. If you need to distinguish inside and exactly on the circle, pass a valid is_on_circle pointer.
auto PointsOfTangency(const vec_type& pt, vec_type* pot1 = nullptr, vec_type* pot2 = nullptr) const -> int
Returns the number of points of tangency (i.e. 0, 1, or 2) between this circle and the given point. Optionally sets the points of tangency.
auto DirectCommonTangents(const Circle_<T>& other, Line2d_<T>* tangent1 = nullptr, Line2d_<T>* tangent2 = nullptr) const -> int
Returns the number of direct common tangents (German "aeussere Tangenten") between the two circles. Optionally sets the tangent lines.
auto TransverseCommonTangents(const Circle_<T>& other, Line2d_<T>* tangent1 = nullptr, Line2d_<T>* tangent2 = nullptr) const -> int
Returns the number of transverse common tangents (German "innere Tangenten") between the two circles. These are 0 if the circles overlap, 1 if they intersect in exactly one point, and 2 if the circles do not touch. Optionally sets the tangent lines.
auto IntersectionCircleCircle(const Circle_<T>& other, vec_type* intersection1 = nullptr, vec_type* intersection2 = nullptr) const -> int
Returns the number of intersections (0, 1, or 2) of the two circles. Returns -1 if the circles are equal and thus every point on the circles is an intersection point. Optionally sets the intersection points.
auto IntersectionCircleLine(const Line2d_<T>& line, vec_type* intersection1 = nullptr, vec_type* intersection2 = nullptr) const -> int
Returns the number of intersections (0, 1, or 2) of this circle and the line. Optionally sets the intersection points.
auto IntersectionCircleLineSegment(const Line2d_<T>& segment, vec_type* intersection1 = nullptr, vec_type* intersection2 = nullptr) const -> int
Returns the number of intersections (0, 1, or 2) of this circle and the line segment(!). Optionally sets the intersection points.

Function documentation

template<typename T>
werkzeugkiste::geometry::Circle_<T>::Circle_(const vec_type& p, const vec_type& q, const vec_type& r)

Circle from 3 points.

If they are collinear, the circle will be invalid. Check via IsValid() afterwards.