Bratmobile
Classes | Public Types | Public Member Functions | Friends | List of all members
WorldBuilder Class Reference

Classes

struct  CompareCluster
 

Public Types

enum  CLUSTERING { BOX =0 , KMEANS =1 , PARTITION =2 }
 

Public Member Functions

std::pair< CoordinateContainer, bool > salientPoints (b2Transform, const CoordinateContainer &, std::pair< Pointf, Pointf >)
 
b2Body * makeBody (b2World &, BodyFeatures)
 
std::vector< BodyFeaturesprocessData (const CoordinateContainer &, const b2Transform &)
 returns a bounding box encompassing all points provided More...
 
std::vector< BodyFeaturescluster_data (const CoordinateContainer &, const b2Transform &, CLUSTERING clustering=PARTITION)
 
bool checkDisturbance (Pointf, bool &, Task *curr=NULL, float range=0.025)
 
std::vector< BodyFeaturesgetFeatures (const CoordinateContainer &, b2Transform, CLUSTERING clustering=PARTITION)
 
void buildWorld (b2World &, b2Transform, Direction, Disturbance disturbance=Disturbance(), float halfWindowWidth=0.15, CLUSTERING clustering=CLUSTERING::PARTITION, Task *task=NULL)
 Creates bodies (objects) in the box2d world. More...
 
std::pair< Pointf, Pointfbounds (Direction, b2Transform t, float boxLength, float halfWindowWidth, std::vector< Pointf > *_bounds=NULL)
 
b2PolygonShape object_filtering_box (float halfWindowWidth, float boxLength, b2Transform start, Direction d)
 Makes a box. More...
 
std::pair< bool, BodyFeaturesbounding_approx_poly (std::vector< cv::Point2f >nb)
 
std::vector< std::vector< cv::Point2f > > kmeans_clusters (std::vector< cv::Point2f >, std::vector< cv::Point2f > &)
 Clusters points using k-means algorithm. More...
 
std::vector< std::vector< cv::Point2f > > partition_clusters (std::vector< cv::Point2f >)
 Clusters points using the partition algorithm. More...
 
b2Vec2 averagePoint (const CoordinateContainer &, Disturbance &, float rad=0.025)
 
int getBodies ()
 
int add_body_count ()
 
void resetBodies ()
 
void add_iteration (int i=1)
 
b2Body * get_robot (b2World *)
 
b2Fixture * get_chassis (b2Body *)
 
b2AABB makeRobotSensor (b2Body *, Disturbance *goal)
 
std::vector< BodyFeatures > & get_world_objects ()
 
void set_world_objects (const std::vector< BodyFeatures > &wo)
 

Friends

class Configurator
 

Member Function Documentation

◆ buildWorld()

void WorldBuilder::buildWorld ( b2World &  world,
b2Transform  start,
Direction  d,
Disturbance  disturbance = Disturbance(),
float  halfWindowWidth = 0.15,
CLUSTERING  clustering = CLUSTERING::PARTITION,
Task task = NULL 
)

Creates bodies (objects) in the box2d world.

Parameters
disturbance
halfWindowWidth
clustering
task

◆ kmeans_clusters()

std::vector< std::vector< cv::Point2f > > WorldBuilder::kmeans_clusters ( std::vector< cv::Point2f >  points,
std::vector< cv::Point2f > &  centers 
)

Clusters points using k-means algorithm.

Returns
std::vector <std::vector<cv::Point2f>>

◆ object_filtering_box()

b2PolygonShape WorldBuilder::object_filtering_box ( float  halfWindowWidth,
float  boxLength,
b2Transform  start,
Direction  d 
)

Makes a box.

Parameters
halfWindowWidth
boxLength
start
d
Returns
b2PolygonShape

◆ partition_clusters()

std::vector< std::vector< cv::Point2f > > WorldBuilder::partition_clusters ( std::vector< cv::Point2f >  points)

Clusters points using the partition algorithm.

Returns
std::vector <std::vector<cv::Point2f>>

◆ processData()

std::vector< BodyFeatures > WorldBuilder::processData ( const CoordinateContainer &  points,
const b2Transform &  start 
)

returns a bounding box encompassing all points provided

Returns
std::vector <BodyFeatures>

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