RobWorkProject  24.5.15-
Public Types | Public Member Functions | Protected Attributes | List of all members
Polygon< T > Class Template Reference

indexed polygon class that saves N indices to the N vertices of the polygon More...

#include <Polygon.hpp>

Public Types

typedef rw::core::Ptr< Polygon< T > > Ptr
 Smart pointer to Polygon.
 
typedef T value_type
 value type of the index pointer
 

Public Member Functions

void addVertex (const T &p)
 Adds a vertex to the polygon. More...
 
void removeVertex (size_t idx)
 Removes vertex from the polygon. More...
 
T & getVertex (size_t idx)
 returns the index of vertex i of the triangle
 
const T & getVertex (size_t idx) const
 returns the index of vertex i of the triangle
 
T & operator[] (size_t i)
 get vertex at index i
 
const T & operator[] (size_t i) const
 get vertex at index i
 
size_t size () const
 Number of vertices of this polygon. More...
 
computeCenter ()
 Computes the center of the polygon as the average of all coordinates. More...
 

Protected Attributes

std::vector< T > _vertices
 Vertices making up the polygon.
 

Detailed Description

template<class T = rw::math::Vector3D<double>>
class rw::geometry::Polygon< T >

indexed polygon class that saves N indices to the N vertices of the polygon

Member Function Documentation

◆ addVertex()

void addVertex ( const T &  p)
inline

Adds a vertex to the polygon.

The point will be added to the end of the list of points

Parameters
p[in] The point to add

◆ computeCenter()

T computeCenter ( )
inline

Computes the center of the polygon as the average of all coordinates.

Returns
Center of the polygon

◆ removeVertex()

void removeVertex ( size_t  idx)
inline

Removes vertex from the polygon.

Parameters
idx[in] Index of the vertex to remove

◆ size()

size_t size ( ) const
inline

Number of vertices of this polygon.

Returns
Number of vertices

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