bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::geometry::GenericLine< dim > Class Template Reference

class GenericLine. Represents a generic line with vertex VertexType The equation of a linein l=Ax + By + C More...

#include <generic_line.h>

Inheritance diagram for bitsim::geometry::GenericLine< dim >:

Public Types

using vertex_type = GeomPoint<dim>

Public Member Functions

 GenericLine ()
 Constructor.
 GenericLine (const vertex_type &p1, const vertex_type &p2)
 Constructor.
 GenericLine (const vertex_type &p1, const vertex_type &p2, uint_t id)
 Constructor.
const vertex_type & get_vertex (uint_t v) const
 Returns the v-th vertex of the segment.
vertex_type & get_vertex (uint_t v)
 Returns the v-th vertex of the segment.
bool has_valid_id () const noexcept
 Returns true iff id_ != rlenvscpp::consts::INVALID_ID.
uint_t get_id () const noexcept
 Returns the id of the line.
void set_id (uint_t id) noexcept
 Set the id of the line.
real_t slope () const
 The slope of the line; infinite for a vertical line.
real_t factor () const
 Returns the constant factor.
real_t distance (const vertex_type &n) const
 The perpendicular distance of the point from the infinite line through the two vertices; the distance to the first vertex if the two are the same.
real_t segment_distance (const vertex_type &n) const
 The distance of the point from the segment between the two vertices.
real_t length () const
 Calculate the length of the line.
real_t distance (const GenericLine< 2 >::vertex_type &n) const
real_t segment_distance (const GenericLine< 2 >::vertex_type &n) const

Static Public Attributes

static const int dimension = dim

Detailed Description

template<int dim>
class bitsim::geometry::GenericLine< dim >

class GenericLine. Represents a generic line with vertex VertexType The equation of a linein l=Ax + By + C

Member Typedef Documentation

◆ vertex_type

template<int dim>
using bitsim::geometry::GenericLine< dim >::vertex_type = GeomPoint<dim>

Constructor & Destructor Documentation

◆ GenericLine() [1/3]

template<int dim>
bitsim::geometry::GenericLine< dim >::GenericLine ( )

Constructor.

◆ GenericLine() [2/3]

template<int dim>
bitsim::geometry::GenericLine< dim >::GenericLine ( const vertex_type & p1,
const vertex_type & p2 )

Constructor.

◆ GenericLine() [3/3]

template<int dim>
bitsim::geometry::GenericLine< dim >::GenericLine ( const vertex_type & p1,
const vertex_type & p2,
uint_t id )

Constructor.

Member Function Documentation

◆ distance() [1/2]

real_t bitsim::geometry::GenericLine< 2 >::distance ( const GenericLine< 2 >::vertex_type & n) const
inline

◆ distance() [2/2]

template<int dim>
real_t bitsim::geometry::GenericLine< dim >::distance ( const vertex_type & n) const

The perpendicular distance of the point from the infinite line through the two vertices; the distance to the first vertex if the two are the same.

◆ factor()

template<int dim>
real_t bitsim::geometry::GenericLine< dim >::factor ( ) const

Returns the constant factor.

◆ get_id()

template<int dim>
uint_t bitsim::geometry::GenericLine< dim >::get_id ( ) const
inlinenoexcept

Returns the id of the line.

◆ get_vertex() [1/2]

template<int dim>
GenericLine< dim >::vertex_type & bitsim::geometry::GenericLine< dim >::get_vertex ( uint_t v)

Returns the v-th vertex of the segment.

◆ get_vertex() [2/2]

template<int dim>
const GenericLine< dim >::vertex_type & bitsim::geometry::GenericLine< dim >::get_vertex ( uint_t v) const

Returns the v-th vertex of the segment.

◆ has_valid_id()

template<int dim>
bool bitsim::geometry::GenericLine< dim >::has_valid_id ( ) const
inlinenoexcept

Returns true iff id_ != rlenvscpp::consts::INVALID_ID.

◆ length()

template<int dim>
real_t bitsim::geometry::GenericLine< dim >::length ( ) const
inline

Calculate the length of the line.

◆ segment_distance() [1/2]

real_t bitsim::geometry::GenericLine< 2 >::segment_distance ( const GenericLine< 2 >::vertex_type & n) const
inline

◆ segment_distance() [2/2]

template<int dim>
real_t bitsim::geometry::GenericLine< dim >::segment_distance ( const vertex_type & n) const

The distance of the point from the segment between the two vertices.

◆ set_id()

template<int dim>
void bitsim::geometry::GenericLine< dim >::set_id ( uint_t id)
inlinenoexcept

Set the id of the line.

◆ slope()

template<int dim>
real_t bitsim::geometry::GenericLine< dim >::slope ( ) const

The slope of the line; infinite for a vertical line.

Member Data Documentation

◆ dimension

template<int dim>
const int bitsim::geometry::GenericLine< dim >::dimension = dim
static

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