Struct jalansim::collision::PolygonCollision

template <typename T>

ClassList > jalansim > collision > PolygonCollision

Polygon-based collision detection model. More...

  • #include <polygon.hpp>

Public Attributes

Type Name
T poly_x
X coordinates of polygon vertices (local frame)
T poly_y
Y coordinates of polygon vertices (local frame)
std::size_t verts = 4
Number of vertices in the polygon.

Public Functions

Type Name
JALANSIM_HOST_DEVICE bool check (const jalansim::map::Map< T > * map, T cx, T cy, T theta) const
Check for collision at specified position and orientation.
JALANSIM_HOST_DEVICE std::size_t get_num_verts () const
Get the number of vertices in the polygon.
JALANSIM_HOST_DEVICE void get_polygon (T * x, T * y) const
Get the polygon vertices.
JALANSIM_HOST_DEVICE void set_polygon (const T * x, const T * y, std::size_t n)
Set the polygon vertices defining the collision footprint.

Detailed Description

Uses a polygonal footprint to check for collisions with obstacles in the map. Checks collision at polygon vertices and edge midpoints by comparing distance field values with a safety margin. Supports up to 16 vertices with at least 3 vertices required.

Template parameters:

  • T Numeric type (float, double)

Public Attributes Documentation

variable poly_x

X coordinates of polygon vertices (local frame)

T jalansim::collision::PolygonCollision< T >::poly_x[16];

variable poly_y

Y coordinates of polygon vertices (local frame)

T jalansim::collision::PolygonCollision< T >::poly_y[16];

variable verts

Number of vertices in the polygon.

std::size_t jalansim::collision::PolygonCollision< T >::verts;

Public Functions Documentation

function check

Check for collision at specified position and orientation.

inline JALANSIM_HOST_DEVICE bool jalansim::collision::PolygonCollision::check (
    const jalansim::map::Map < T > * map,
    T cx,
    T cy,
    T theta
) const

Parameters:

  • map Pointer to the map containing distance field
  • cx Center X coordinate of the agent
  • cy Center Y coordinate of the agent
  • theta Orientation angle of the agent

Returns:

True if collision detected, false otherwise


function get_num_verts

Get the number of vertices in the polygon.

inline JALANSIM_HOST_DEVICE std::size_t jalansim::collision::PolygonCollision::get_num_verts () const

Returns:

Number of vertices


function get_polygon

Get the polygon vertices.

inline JALANSIM_HOST_DEVICE void jalansim::collision::PolygonCollision::get_polygon (
    T * x,
    T * y
) const

Parameters:

  • x Output array for X coordinates (must have space for at least verts elements)
  • y Output array for Y coordinates (must have space for at least verts elements)

function set_polygon

Set the polygon vertices defining the collision footprint.

inline JALANSIM_HOST_DEVICE void jalansim::collision::PolygonCollision::set_polygon (
    const T * x,
    const T * y,
    std::size_t n
) 

Parameters:

  • x Array of X coordinates for vertices (local frame)
  • y Array of Y coordinates for vertices (local frame)
  • n Number of vertices (must be between 3 and 16)


The documentation for this class was generated from the following file include/jalansim/collision/polygon.hpp