numeric
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
numeric::Circle Class Reference

#include <Circle.hpp>

Public Member Functions

 Circle (const base::Vector2d &center, double radius)
 
 Circle (double centerX, double centerY, double radius)
 
std::vector< base::Vector2d > intersect (const Circle &other) const
 
std::vector< base::Vector2d > intersect (const Eigen::ParametrizedLine< double, 2 > &line) const
 
std::vector< base::Vector2d > samplePoints (double start, double end, size_t num) const
 
double getRadius () const
 
void setRadius (double radius)
 
base::Vector2d getCenter () const
 
void setCenter (const base::Vector2d &c)
 

Static Public Member Functions

static Circle Unit ()
 

Public Attributes

base::Vector2d center
 
double r
 

Constructor & Destructor Documentation

◆ Circle() [1/2]

Circle::Circle ( const base::Vector2d &  center,
double  radius 
)

◆ Circle() [2/2]

Circle::Circle ( double  centerX,
double  centerY,
double  radius 
)

Member Function Documentation

◆ getCenter()

base::Vector2d Circle::getCenter ( ) const

◆ getRadius()

double Circle::getRadius ( ) const

◆ intersect() [1/2]

std::vector< base::Vector2d > Circle::intersect ( const Circle other) const

Calculate intersection points of this and other.

Returns
a vector containing the intersections or an empty vector if the circles do not intersect or are identical

◆ intersect() [2/2]

std::vector< base::Vector2d > Circle::intersect ( const Eigen::ParametrizedLine< double, 2 > &  line) const

Calculate intersection points of this and line.

Returns
a vector containing the intersections or an empty vector if the line does not intersect the circle.
Exceptions
std::runtime_errorIf the line is invalid

◆ samplePoints()

std::vector<base::Vector2d> numeric::Circle::samplePoints ( double  start,
double  end,
size_t  num 
) const

Sample points on the circle

Parameters
startAngle of the first sample (in rad)
endAngle of the last sample (in rad)
numTotal number of samples (including start and end)
Note
If num == 1, start is returned
Exceptions
std::runtime_errorif num == 0
std::runtime_errorif start == end

◆ setCenter()

void Circle::setCenter ( const base::Vector2d &  c)

◆ setRadius()

void Circle::setRadius ( double  radius)

◆ Unit()

Circle Circle::Unit ( )
static

Create circle with center at 0/0 and radius 1

Member Data Documentation

◆ center

base::Vector2d numeric::Circle::center

◆ r

double numeric::Circle::r

The documentation for this class was generated from the following files: