LARS
LARS (Light Augmented Reality System) is an open-source framework for light-based interaction and real-time tracking in multi-robot experiments. Inspired by ARK, LARS extends the augmented reality paradigm to robotic collectives by projecting dynamic visual cues and environments onto the arena, enabling new experimental possibilities for collective robotics research, education, and outreach. LARS features integrated tracking, light projection, and modular experiment control with a user-friendly Qt GUI.
Loading...
Searching...
No Matches
rcsc::Triangle2D Class Reference

2D triangle class More...

#include <triangle_2d.h>

Inheritance diagram for rcsc::Triangle2D:
rcsc::Region2D

Public Member Functions

 Triangle2D (const Vector2D &v1, const Vector2D &v2, const Vector2D &v3)
 constructor with variables
 Triangle2D (const Segment2D &seg, const Vector2D &v)
 constructor with a segment and a point
const Triangle2Dassign (const Vector2D &v1, const Vector2D &v2, const Vector2D &v3)
 assign new vertex points
bool isValid () const
 check if this triangle is valid or not.
const Triangle2Dassign (const Segment2D &seg, const Vector2D &v)
 assign new segment and vertex point
const Vector2Da () const
 get 1st point
const Vector2Db () const
 get 2nd point
const Vector2Dc () const
 get 3rd point
virtual double area () const
 get the area of this region
double signedArea () const
 get a signed area. this method is equivalent to signed_area().
double doubleSignedArea () const
 get a double of signed area value. this method is equivalent to double_signed_area().
bool ccw () const
 check if this triangle's vertices are placed counterclockwise order.
virtual bool contains (const Vector2D &point) const
 check if this triangle contains 'point'.
Vector2D centroid () const
 get the center of gravity(centroid, JUU-SIN)
Vector2D incenter () const
 get the center of inscribed circle(NAI-SIN)
Vector2D circumcenter () const
 get the center of circumscribed circle(GAI-SIN)
Vector2D orthocenter () const
 get the orthocenter(SUI-SIN)
int intersection (const Line2D &line, Vector2D *sol1, Vector2D *sol2) const
 calculate intersection point with line.
int intersection (const Ray2D &ray, Vector2D *sol1, Vector2D *sol2) const
 calculate intersection point with ray.
int intersection (const Segment2D &segment, Vector2D *sol1, Vector2D *sol2) const
 calculate intersection point with line segment.
Public Member Functions inherited from rcsc::Region2D
virtual ~Region2D ()
 virtual destructor.

Static Public Member Functions

static double double_signed_area (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get a double signed area value (== area of parallelogram)
static double signed_area (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get a signed area value
static bool ccw (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 check if input vertices are placed counterclockwise order.
static Vector2D centroid (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get the center of gravity(JUU-SIN)
static Vector2D incenter (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get the incenter point(NAI-SIN)
static Vector2D circumcenter (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get the circumcenter point(GAI-SIN)
static Vector2D orthocenter (const Vector2D &a, const Vector2D &b, const Vector2D &c)
 get the orthomcenter point(SUI-SIN)
static bool contains (const Vector2D &a, const Vector2D &b, const Vector2D &c, const Vector2D &point)
 check if triangle(a,b,c) contains the point 'p'.

Additional Inherited Members

Protected Member Functions inherited from rcsc::Region2D
 Region2D ()
 accessible only from derived classes

Detailed Description

2D triangle class

Constructor & Destructor Documentation

◆ Triangle2D() [1/2]

rcsc::Triangle2D::Triangle2D ( const Vector2D & v1,
const Vector2D & v2,
const Vector2D & v3 )
inline

constructor with variables

Parameters
v1first vertex point
v2second vertex point
v3third vertex point

◆ Triangle2D() [2/2]

rcsc::Triangle2D::Triangle2D ( const Segment2D & seg,
const Vector2D & v )
inline

constructor with a segment and a point

Parameters
segsegment consist of triangle, first and second vertex points
vthird vertex point

Member Function Documentation

◆ a()

const Vector2D & rcsc::Triangle2D::a ( ) const
inline

get 1st point

Returns
const reference to the member variable

◆ area()

virtual double rcsc::Triangle2D::area ( ) const
inlinevirtual

get the area of this region

Returns
value of the area

Implements rcsc::Region2D.

◆ assign() [1/2]

const Triangle2D & rcsc::Triangle2D::assign ( const Segment2D & seg,
const Vector2D & v )
inline

assign new segment and vertex point

Parameters
segsegment consist of triangle, first and second vertex points
vthird vertex point
Returns
const reference to itself

◆ assign() [2/2]

const Triangle2D & rcsc::Triangle2D::assign ( const Vector2D & v1,
const Vector2D & v2,
const Vector2D & v3 )
inline

assign new vertex points

Parameters
v1first vertex point
v2second vertex point
v3third vertex point
Returns
const reference to itself

◆ b()

const Vector2D & rcsc::Triangle2D::b ( ) const
inline

get 2nd point

Returns
const reference to the member variable

◆ c()

const Vector2D & rcsc::Triangle2D::c ( ) const
inline

get 3rd point

Returns
const reference to the member variable

◆ ccw() [1/2]

bool rcsc::Triangle2D::ccw ( ) const
inline

check if this triangle's vertices are placed counterclockwise order.

Returns
checked result

◆ ccw() [2/2]

bool rcsc::Triangle2D::ccw ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
inlinestatic

check if input vertices are placed counterclockwise order.

Parameters
a1st input point
b2nd input point
c3rd input point
Returns
checked result

◆ centroid() [1/2]

Vector2D rcsc::Triangle2D::centroid ( ) const
inline

get the center of gravity(centroid, JUU-SIN)

Returns
coordinates of gravity center

◆ centroid() [2/2]

Vector2D rcsc::Triangle2D::centroid ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
inlinestatic

get the center of gravity(JUU-SIN)

Parameters
atriangle's 1st vertex
btriangle's 2nd vertex
ctriangle's 3rd vertex
Returns
coordinates of gravity center

centroid = (a + b + c) / 3

◆ circumcenter() [1/2]

Vector2D rcsc::Triangle2D::circumcenter ( ) const
inline

get the center of circumscribed circle(GAI-SIN)

Returns
coordinates of outer center

◆ circumcenter() [2/2]

Vector2D rcsc::Triangle2D::circumcenter ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
static

get the circumcenter point(GAI-SIN)

Parameters
atriangle's 1st vertex
btriangle's 2nd vertex
ctriangle's 3rd vertex
Returns
coordinates of circumcenter

◆ contains() [1/2]

bool rcsc::Triangle2D::contains ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c,
const Vector2D & point )
static

check if triangle(a,b,c) contains the point 'p'.

Parameters
avertex1
bvertex2
cvertex3
pointchecked point
Returns
checked result

◆ contains() [2/2]

bool rcsc::Triangle2D::contains ( const Vector2D & point) const
virtual

check if this triangle contains 'point'.

Parameters
pointconsiderd point
Returns
true or false

Implements rcsc::Region2D.

◆ double_signed_area()

double rcsc::Triangle2D::double_signed_area ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
inlinestatic

get a double signed area value (== area of parallelogram)

Parameters
a1st input point
b2nd input point
c3rd input point
Returns
double sined area value. If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.

◆ doubleSignedArea()

double rcsc::Triangle2D::doubleSignedArea ( ) const
inline

get a double of signed area value. this method is equivalent to double_signed_area().

Returns
double of signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.

◆ incenter() [1/2]

Vector2D rcsc::Triangle2D::incenter ( ) const
inline

get the center of inscribed circle(NAI-SIN)

Returns
coordinates of inner center

◆ incenter() [2/2]

Vector2D rcsc::Triangle2D::incenter ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
static

get the incenter point(NAI-SIN)

Parameters
atriangle's 1st vertex
btriangle's 2nd vertex
ctriangle's 3rd vertex
Returns
coordinates of incenter

◆ intersection() [1/3]

int rcsc::Triangle2D::intersection ( const Line2D & line,
Vector2D * sol1,
Vector2D * sol2 ) const

calculate intersection point with line.

Parameters
lineconsiderd line.
sol1pointer to the 1st solution variable
sol2pointer to the 2nd solution variable
Returns
number of intersection

◆ intersection() [2/3]

int rcsc::Triangle2D::intersection ( const Ray2D & ray,
Vector2D * sol1,
Vector2D * sol2 ) const

calculate intersection point with ray.

Parameters
rayconsiderd ray line.
sol1pointer to the 1st solution variable
sol2pointer to the 2nd solution variable
Returns
number of intersection

◆ intersection() [3/3]

int rcsc::Triangle2D::intersection ( const Segment2D & segment,
Vector2D * sol1,
Vector2D * sol2 ) const

calculate intersection point with line segment.

Parameters
segmentconsiderd line segment.
sol1pointer to the 1st solution variable
sol2pointer to the 2nd solution variable
Returns
number of intersection

◆ isValid()

bool rcsc::Triangle2D::isValid ( ) const
inline

check if this triangle is valid or not.

Returns
true if triangle is valid.

◆ orthocenter() [1/2]

Vector2D rcsc::Triangle2D::orthocenter ( ) const
inline

get the orthocenter(SUI-SIN)

Returns
coordinates of ortho center

◆ orthocenter() [2/2]

Vector2D rcsc::Triangle2D::orthocenter ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
static

get the orthomcenter point(SUI-SIN)

Parameters
atriangle's 1st vertex
btriangle's 2nd vertex
ctriangle's 3rd vertex
Returns
coordinates of orthocenter

orthocenter = a + b + c - 2 * circumcenter

◆ signed_area()

double rcsc::Triangle2D::signed_area ( const Vector2D & a,
const Vector2D & b,
const Vector2D & c )
inlinestatic

get a signed area value

Parameters
a1st input point
b2nd input point
c3rd input point
Returns
signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.

◆ signedArea()

double rcsc::Triangle2D::signedArea ( ) const
inline

get a signed area. this method is equivalent to signed_area().

Returns
signed area value If points a, b, c are placed counterclockwise order, returns positive number. If points a, b, c are placed clockwise order, returns negative number. If points a, b, c are placed on a line, returns 0.

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