Dmitrijs Griskovs / Mbed 2 deprecated el17dg

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

CircleBounds Class Reference

CircleBounds Class Reference

CicleBounds Class. More...

#include <collision_lib.h>

Public Member Functions

 CircleBounds ()
 Default constructor.
 CircleBounds (Point _center, float _radius)
 Constructor with center and radius parameters.
bool circleCollideTwoObjects (const Point &pos_a, const CircleBounds &bounds_a, const Point &pos_b, const CircleBounds &bounds_b)
 Determines whether the two circles collide.

Detailed Description

CicleBounds Class.

Class to define object's bounds as a circle with center(e.g. offset).

Author:
Dmitrijs Griskovs
Date:
15/04/2019

Definition at line 49 of file collision_lib.h.


Constructor & Destructor Documentation

CircleBounds (  )

Default constructor.

Definition at line 52 of file collision_lib.h.

CircleBounds ( Point  _center,
float  _radius 
)

Constructor with center and radius parameters.

Definition at line 54 of file collision_lib.h.


Member Function Documentation

bool circleCollideTwoObjects ( const Point pos_a,
const CircleBounds bounds_a,
const Point pos_b,
const CircleBounds bounds_b 
)

Determines whether the two circles collide.

the function takes in position and circle bounds (center and radius) of two objects and returns wether they collided.

Parameters:
pos_apositon of x and y of the first object. (const Point&).
bounds_acenter point and radius of the first object. (const CircleBounds&).
pos_bpositon of x and y of the second object. (const Point&).
bounds_bcenter point and radius of the second object. (const CircleBounds&).
Returns:
true if the two circles overlap.

Definition at line 69 of file collision_lib.h.