Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Circle Class Reference

#include <Circle.h>

Inheritance diagram for Circle:

PhysicalObject GraphicalObject List of all members.

Public Member Functions

Public Attributes


Detailed Description

A circle. It has radius R.

Definition at line 15 of file Circle.h.


Constructor & Destructor Documentation

Circle::Circle real  R,
real  x = 0,
real  y = 0,
std::string  label = "",
int  nSensors = 0,
real  sensorsStartAngle = 0,
real  saturationForce = 0.5,
Color  outlineColor = GUI::colorBlack,
Color  fillColor = GUI::colorTransparent
 

Constructor, sets the position and radius, the tactile sensors (if any), computes the mass and inertia based on default density.

Definition at line 7 of file Circle.cpp.

References computeBox(), computeInertia(), computeMass(), Vector2::x, and Vector2::y.

Circle::~Circle  )  [virtual]
 

Destructor, does nothing.

Definition at line 22 of file Circle.cpp.


Member Function Documentation

virtual void Circle::computeBox  )  [inline, virtual]
 

Computes the bounding box.

Reimplemented from PhysicalObject.

Definition at line 62 of file Circle.h.

References real.

Referenced by Circle(), and setRadius().

void Circle::computeInertia  )  [virtual]
 

Computes the moment of inertia around the z axis that passes through the center, based on the mass and the radius.

Reimplemented from PhysicalObject.

Definition at line 38 of file Circle.cpp.

References R.

Referenced by Circle(), and setRadius().

void Circle::computeMass real  density = ThyrixParameters::defaultDensity  )  [virtual]
 

Sets the mass based on the radius and the density.

Reimplemented from PhysicalObject.

Definition at line 34 of file Circle.cpp.

References R.

Referenced by Circle(), and setRadius().

bool Circle::detectContacts Circle circle,
GlobalContactInfoVector contacts
[virtual]
 

Tests for contacts between this object and a circle.

Reimplemented from PhysicalObject.

Definition at line 81 of file Circle.cpp.

References getISensor(), M_PI, Vector2::normalize(), R, PhysicalObject::r, real, sqr(), Vector2::x, and Vector2::y.

bool Circle::detectContacts Border border,
GlobalContactInfoVector contacts
[virtual]
 

Tests for contacts between this object and a border.

Reimplemented from PhysicalObject.

Definition at line 43 of file Circle.cpp.

References getISensor(), Border::normal, PhysicalObject::r, real, Vector2::setToZero(), Vector2::x, and Vector2::y.

virtual bool Circle::detectContacts PhysicalObject object,
GlobalContactInfoVector contacts
[inline, virtual]
 

Redirects contact detection.

Implements PhysicalObject.

Definition at line 45 of file Circle.h.

References PhysicalObject::detectContacts().

Referenced by Spherus::detectContacts(), and Spherus::detectInternalContacts().

bool Circle::detectMouseContact const Vector2 rMouse,
Vector2 p,
PhysicalObject *&  object
[virtual]
 

Detects whether a click of the mouse at rMouse has touched the object. In case of contact, returns true and sets p to the relative vector between the center of the object and the contact point; p is expressed in the object reference frame because it rotates with the object while the object is dragged.

Reimplemented from PhysicalObject.

Definition at line 121 of file Circle.cpp.

References Vector2::getSquaredModule(), R, and Vector2::rotate().

Referenced by Spherus::detectMouseContact().

void Circle::draw GUI gui  )  [virtual]
 

Draws the circle on the user interface.

Implements GraphicalObject.

Definition at line 160 of file Circle.cpp.

References GUI::drawCircle(), R, GUI::setBrushColor(), GUI::setPenColor(), Vector2::x, and Vector2::y.

Referenced by Spherus::draw().

void Circle::drawSensors GUI gui  ) 
 

Draws the activation of the circle's contact sensors.

Definition at line 170 of file Circle.cpp.

References GUI::drawLine(), M_PI, R, real, sensorsStartAngle, Vector2::x, and Vector2::y.

int Circle::getISensor Vector2 p  ) 
 

Returns the index of the tactile sensor activated by a contact at relative position p.

Definition at line 137 of file Circle.cpp.

References real, Vector2::x, and Vector2::y.

Referenced by detectContacts(), and CappedRectangle::detectContacts().

virtual int Circle::isCircle  )  [inline, virtual]
 

Tells that this object has circular symmetry.

Reimplemented from PhysicalObject.

Definition at line 42 of file Circle.h.

void Circle::setRadius real  R  ) 
 

Sets the radius of the circle, computes the mass and inertia based on default density.

Definition at line 27 of file Circle.cpp.

References computeBox(), computeInertia(), and computeMass().

void Circle::setSensor ContactInfo contact  )  [virtual]
 

Sets the activation of a tactile sensor, corresponding to the given contact. To be overridden.

Reimplemented from PhysicalObject.

Definition at line 151 of file Circle.cpp.

References ContactInfo::force, ContactInfo::iSensor, and real.


Member Data Documentation

real Circle::R
 

Radius of the circle

Definition at line 29 of file Circle.h.

Referenced by computeInertia(), computeMass(), Iunctus::controll(), VisualSensor::detectContacts(), detectContacts(), CappedRectangle::detectContacts(), detectMouseContact(), Iunctus::draw(), draw(), and drawSensors().

real Circle::sensorsStartAngle
 

The start angle for the contact sensors; 0..2Pi

Definition at line 69 of file Circle.h.

Referenced by drawSensors().


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

Thyrix homepageUsers' guide

(C) Arxia 2004-2005