Skip to main content

BoundCircle

The BoundCircle type defines a bounding circle for 2D space, providing efficient spatial containment, expansion, and intersection logic. It supports initialization from points, bounding rectangles, and other circles, and offers utilities for validation, distance computation, radius growth, and spatial queries. The implementation prioritizes performance, precision, and flexibility with support for custom vector types.

#include <geometry/TellusimBounds.h>

BoundCirclef

Represents a BoundCircle using 32-bit floating-point precision.

BoundCircled

Represents a BoundCircle using 64-bit floating-point precision.

Variables

TypeNameDescription
Vector2centerCenter.
TyperadiusRadius.

Constructors

BoundCircle()
BoundCircle(const BoundCircle &bc)
BoundCircle(const Vector2 &br_min, const Vector2 &br_max)
BoundCircle(const Vector2 &bc_center, Type bc_radius)
explicit BoundCircle(const BoundRect &br)
explicit BoundCircle(const BoundRect<CType, CVector> &br)
explicit BoundCircle(const BoundCircle<CType, CVector> &bc)
BoundCircle(const Vector2 *points, uint32_t num_points)

Methods

Clear bound circle.

void clear()

Check bound circle.

bool isValid() const
operator bool() const

Set bound rect.

void set(const Vector2 &br_min, const Vector2 &br_max)
void set(const BoundRect &br)

Set bound circle.

void set(const Vector2 &bc_center, Type bc_radius)
void set(const BoundCircle &bc)

Set bound circle.

void set(const Vector2 *points, uint32_t num_points)

Expand by point.

void expand(const Vector2 &point)

Expand by bound rect.

void expand(const Vector2 &br_min, const Vector2 &br_max)
void expand(const BoundRect &br)

Expand by bound circle.

void expand(const Vector2 &bc_center, Type bc_radius)
void expand(const BoundCircle &bc)

Expand by minimal bounds.

void expand(const Vector2 &br_min, const Vector2 &br_max, const Vector2 &bc_center, Type bc_radius)
void expand(const BoundRect &br, const BoundCircle &bc)

Expand radius by point.

void expandRadius(const Vector2 &point)

Expand radius by bound rect.

void expandRadius(const Vector2 &br_min, const Vector2 &br_max)
void expandRadius(const BoundRect &br)

Expand radius by bound circle.

void expandRadius(const Vector2 &bc_center, Type bc_radius)
void expandRadius(const BoundCircle &bc)

Inside point.

bool inside(const Vector2 &point) const

Inside bound rect.

bool inside(const Vector2 &br_min, const Vector2 &br_max) const
bool inside(const BoundRect &br) const

Inside bound circle.

bool inside(const Vector2 &bc_center, Type bc_radius) const
bool inside(const BoundCircle &bc) const

Signed distance to bound circle.

Type distance(const Vector2 &point) const

To bound rect.

Vector2 getMin() const
Vector2 getMax() const

Bound circle parameters.

const Vector2 &getCenter() const
Type getRadius() const
Type getArea() const

Operators

Matrix to bound circle multiplication.

BoundCircle operator*(const Matrix4x3 &m, const BoundCircle &bc)
BoundCircle operator*(const Matrix4x4 &m, const BoundCircle &bc)

Comparison operators.

bool operator==(const BoundCircle &bc0, const BoundCircle &bc1)
bool operator!=(const BoundCircle &bc0, const BoundCircle &bc1)