UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pyramidworks::geometry::ConvexPolygon Class Reference

A convex polygon, one type of GeometricShape. This determines a polygon conposed by at least 3 vertices. More...

#include <pyramidworks/geometry/convexpolygon.h>

Inheritance diagram for pyramidworks::geometry::ConvexPolygon:
Collaboration diagram for pyramidworks::geometry::ConvexPolygon:

Public Member Functions

 ConvexPolygon (const std::vector< ugdk::math::Vector2D > &vertices)
 
void set_vertices (const std::vector< ugdk::math::Vector2D > &vertices)
 
bool Intersects (const ugdk::math::Vector2D &this_pos, const GeometricShape *obj, const ugdk::math::Vector2D &that_pos) const
 Checks if this shape intersects another shape. More...
 
bool Intersects (const ugdk::math::Vector2D &this_pos, const Rect *obj, const ugdk::math::Vector2D &that_pos) const
 Checks if there's an intersection with a Rect. More...
 
bool Intersects (const ugdk::math::Vector2D &this_pos, const Circle *obj, const ugdk::math::Vector2D &that_pos) const
 Checks if there's an intersection with a Circle. More...
 
bool Intersects (const ugdk::math::Vector2D &this_pos, const ConvexPolygon *obj, const ugdk::math::Vector2D &that_pos) const
 Checks if there's an intersection with a Convex Polygon. More...
 
ugdk::structure::Box< 2 > GetBoundingBox (const ugdk::math::Vector2D &position) const
 Returns a bounding box for this shape. More...
 
double bbox_width ()
 
double bbox_height ()
 
- Public Member Functions inherited from pyramidworks::geometry::GeometricShape
virtual ~GeometricShape ()
 

Additional Inherited Members

- Protected Member Functions inherited from pyramidworks::geometry::GeometricShape
 GeometricShape ()
 

Detailed Description

A convex polygon, one type of GeometricShape. This determines a polygon conposed by at least 3 vertices.

Constructor & Destructor Documentation

pyramidworks::geometry::ConvexPolygon::ConvexPolygon ( const std::vector< ugdk::math::Vector2D > &  vertices)
Parameters
verticesThe list of vertices of the polygon, in local coordinates (0,0 is the "center", where this polygon is positioned). vertices[i] and vertices[i+1] form a edge, and vertices[n]-vertices[0] is the closing edge.

Member Function Documentation

double pyramidworks::geometry::ConvexPolygon::bbox_height ( )
inline
double pyramidworks::geometry::ConvexPolygon::bbox_width ( )
inline
ugdk::structure::Box<2> pyramidworks::geometry::ConvexPolygon::GetBoundingBox ( const ugdk::math::Vector2D position) const
virtual

Returns a bounding box for this shape.

The box is at the shape's position and offset

Parameters
positionThe absolute position for this shape.
Returns
A 2D Box around this shape

Implements pyramidworks::geometry::GeometricShape.

bool pyramidworks::geometry::ConvexPolygon::Intersects ( const ugdk::math::Vector2D this_pos,
const GeometricShape obj,
const ugdk::math::Vector2D that_pos 
) const
virtual

Checks if this shape intersects another shape.

Parameters
this_posThe absolute position for this shape.
objThe shape to compare with.
that_posThe absolute position of the other shape.
Returns
True if there's an intersection.

Implements pyramidworks::geometry::GeometricShape.

bool pyramidworks::geometry::ConvexPolygon::Intersects ( const ugdk::math::Vector2D this_pos,
const Rect obj,
const ugdk::math::Vector2D that_pos 
) const
virtual

Checks if there's an intersection with a Rect.

Parameters
this_posThe absolute position for this shape.
objThe shape to compare with.
that_posThe absolute position of the other shape.
Returns
True if there's an intersection.

Implements pyramidworks::geometry::GeometricShape.

bool pyramidworks::geometry::ConvexPolygon::Intersects ( const ugdk::math::Vector2D this_pos,
const Circle obj,
const ugdk::math::Vector2D that_pos 
) const
virtual

Checks if there's an intersection with a Circle.

Parameters
this_posThe absolute position for this shape.
objThe shape to compare with.
that_posThe absolute position of the other shape.
Returns
True if there's an intersection.

Implements pyramidworks::geometry::GeometricShape.

bool pyramidworks::geometry::ConvexPolygon::Intersects ( const ugdk::math::Vector2D this_pos,
const ConvexPolygon obj,
const ugdk::math::Vector2D that_pos 
) const
virtual

Checks if there's an intersection with a Convex Polygon.

Parameters
this_posThe absolute position for this shape.
objThe shape to compare with.
that_posThe absolute position of the other shape.
Returns
True if there's an intersection.

Implements pyramidworks::geometry::GeometricShape.

void pyramidworks::geometry::ConvexPolygon::set_vertices ( const std::vector< ugdk::math::Vector2D > &  vertices)
inline

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