bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::trajectory::RoundedRectangle Class Reference

A closed track in the plane: a rectangle centred on the origin with its sides along x and y, and its corners rounded with quarter circles. More...

#include <rounded_rectangle.h>

Public Member Functions

 RoundedRectangle (real_t half_length, real_t half_width, real_t corner_radius)
real_t half_length () const noexcept
real_t half_width () const noexcept
real_t corner_radius () const noexcept
real_t distance (real_t x, real_t y) const
 The distance from (x, y) to the track [m], from inside or outside.
real_t signed_distance (real_t x, real_t y) const
 The signed distance from (x, y) to the track [m]: negative inside the shape, positive outside. Its gradient is the outward normal of the track, of length 1.
real_t perimeter () const
 The length of the track [m].

Detailed Description

A closed track in the plane: a rectangle centred on the origin with its sides along x and y, and its corners rounded with quarter circles.

The track is the boundary of the shape, the line a robot follows. With a corner radius of half the width it is a stadium; with a radius of zero, a rectangle.

Constructor & Destructor Documentation

◆ RoundedRectangle()

bitsim::trajectory::RoundedRectangle::RoundedRectangle ( real_t half_length,
real_t half_width,
real_t corner_radius )
Parameters
half_lengthHalf the length along x, to the line [m]
half_widthHalf the width along y [m]
corner_radiusThe radius of the corners [m], at most the smaller half side

Member Function Documentation

◆ corner_radius()

real_t bitsim::trajectory::RoundedRectangle::corner_radius ( ) const
inlinenoexcept

◆ distance()

real_t bitsim::trajectory::RoundedRectangle::distance ( real_t x,
real_t y ) const

The distance from (x, y) to the track [m], from inside or outside.

◆ half_length()

real_t bitsim::trajectory::RoundedRectangle::half_length ( ) const
inlinenoexcept

◆ half_width()

real_t bitsim::trajectory::RoundedRectangle::half_width ( ) const
inlinenoexcept

◆ perimeter()

real_t bitsim::trajectory::RoundedRectangle::perimeter ( ) const

The length of the track [m].

◆ signed_distance()

real_t bitsim::trajectory::RoundedRectangle::signed_distance ( real_t x,
real_t y ) const

The signed distance from (x, y) to the track [m]: negative inside the shape, positive outside. Its gradient is the outward normal of the track, of length 1.


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