The subclass of PhyObject2DWrapper wrapping a box. More...

Inheritance diagram for Box2DWrapper:

Public Member Functions

const wVector & centerOnPlane () const
 Returns the coordinates of the center of the box on the plane in the global frame of reference. More...
 
virtual bool computeDistanceAndOrientationFromRobot (const WheeledRobot2DWrapper &robot, double &distance, double &angle) const
 Computes the distance and orientation of this object respect to the given robot. More...
 
virtual void computeLinearViewFieldOccupiedRange (const wMatrix &cameraMtr, QVector< AngularRangeAndColor > &rangesAndColors, double &distance, double maxDistance) const
 Computes the portion of a linear the view field occupied by this object. More...
 
real depth () const
 Returns the depth of the box. More...
 
virtual PhyBoxphyObject ()
 Returns a pointer to the wrapped PhyObject. More...
 
virtual const PhyBoxphyObject () const
 Returns a pointer to the wrapped PhyObject (const version) More...
 
virtual void setKinematic (bool b, bool c=false)
 Sets whether the object is kinematic or not. More...
 
virtual void setPosition (real x, real y)
 Sets the position of the object in the plane. More...
 
virtual void setStatic (bool s)
 Sets whether the object is static or not. More...
 
virtual Type type () const
 Returns the type of this wrapper object. More...
 
const wVector & vertex (int i) const
 Returns the coordinates of the i-th vertex of the box on the plane in the global frame of reference. More...
 
real width () const
 Returns the width of the box. More...
 
- Public Member Functions inherited from PhyObject2DWrapper
QColor color () const
 Returns the color to use when rendering this. More...
 
bool getKinematic () const
 Returns true if the object has kinematic behaviour. More...
 
bool getStatic () const
 Returns true if the object is static. More...
 
wVector position () const
 Returns the position of the object. More...
 
const wMatrixpreviousMatrix () const
 Returns the transformation matrix of the previous time-step. More...
 
void setColor (QColor color)
 Sets the color to use when rendering this. More...
 
void setPosition (wVector pos)
 Sets the position of the object in the plane. More...
 
void setTexture (QString textureName)
 Set the texture to use when rendering this. More...
 
void setUseColorTextureOfOwner (bool b)
 Sets whether this will be rendered with the color and texture of our owner (if we have one) More...
 
void storePreviousMatrix ()
 Stores the current matrix in the previousMatrix. More...
 
QString texture () const
 Returns the name of the texture. More...
 
bool useColorTextureOfOwner () const
 Returns whether this will be rendered with the color and texture of the owner (if we have one) More...
 
virtual WObjectwObject ()
 Returns a pointer to the wrapped object. More...
 
virtual const WObjectwObject () const
 Returns a pointer to the wrapped object (const version) More...
 

Protected Member Functions

 Box2DWrapper (Arena *arena, PhyBox *box, Type type)
 Constructor. More...
 
 ~Box2DWrapper ()
 Destructor. More...
 
- Protected Member Functions inherited from PhyObject2DWrapper
 PhyObject2DWrapper (Arena *arena)
 Constructor. More...
 
virtual ~PhyObject2DWrapper ()
 Destructor. More...
 

Friends

class Arena
 The Arena class is friend to be able to instantiate and delete this class. More...
 

Additional Inherited Members

- Public Types inherited from PhyObject2DWrapper
enum  Type {
  Plane = 0, Wall, Box, RectangularTargetArea,
  Cylinder, SmallCylinder, BigCylinder, CircularTargetArea,
  LightBulb, WheeledRobot, NumberOfDifferentTypes
}
 The possible type of wrapped objects. More...
 
- Protected Attributes inherited from PhyObject2DWrapper
Arena *const m_arena
 The pointer to the arena in which this object lives. More...
 

Detailed Description

The subclass of PhyObject2DWrapper wrapping a box.

Definition at line 390 of file wheeledexperimenthelper.h.

Constructor & Destructor Documentation

Box2DWrapper ( Arena arena,
PhyBox box,
Type  type 
)
protected

Constructor.

Parameters
arenathe arena in which this object lives
boxthe box to wrap
typethe type of box. This can only be one of Plane, Wall, Box, RectangularTargetArea. This can only be made non-static if the type is Box. This can only be moved if the type is Box or RectangularTargetArea

Definition at line 486 of file wheeledexperimenthelper.cpp.

References PhyObject::setKinematic(), and PhyObject::setStatic().

~Box2DWrapper ( )
protected

Destructor.

Definition at line 500 of file wheeledexperimenthelper.cpp.

Member Function Documentation

const wVector& centerOnPlane ( ) const
inline

Returns the coordinates of the center of the box on the plane in the global frame of reference.

Returns
the coordinates of the center of the box on the plane in the global frame of reference

Definition at line 509 of file wheeledexperimenthelper.h.

bool computeDistanceAndOrientationFromRobot ( const WheeledRobot2DWrapper robot,
double &  distance,
double &  angle 
) const
virtual

Computes the distance and orientation of this object respect to the given robot.

This function computes the distance of this object from the given robot. The distance is computed between the nearest points of the two objects. The robot is always modelled as a vertical cylindrical object. The function returns false if it makes no sense to compute the distance

Parameters
robotthe robot from which the distance should be computed
distancethe computed distance
anglethe computed orientation
Returns
false if the distance couldn't be computed

Implements PhyObject2DWrapper.

Definition at line 662 of file wheeledexperimenthelper.cpp.

References Arena::getPlane(), WheeledRobot2DWrapper::getRadius(), PhyObject2DWrapper::m_arena, WObject::matrix(), PhyObject2DWrapper::position(), PhyBox::sideX(), PhyBox::sideY(), wMatrix::transformVector(), wMatrix::untransformVector(), and WheeledRobot2DWrapper::wObject().

void computeLinearViewFieldOccupiedRange ( const wMatrix cameraMtr,
QVector< AngularRangeAndColor > &  rangesAndColors,
double &  distance,
double  maxDistance 
) const
virtual

Computes the portion of a linear the view field occupied by this object.

This function returns the angular range occupied by this object on a linear camera described by the given matrix. The Z axis of the matrix is the upvector, the camera lies on the XY plane and points towars the X axis (i.e. angles start from the X axis). If the object is not visible by the camera, this function returns a negative distance. The min angle can be greater than the max angle if the object is behind the camera. Here we make the assumption that the camera is outside the box (otherwise the algorithm gives wrong results). The matrix representing the camera is translated so that it is on the same plane as the vertexes of the box before doing computations

Parameters
cameraMtrthe matrix describing the camera (see function description)
rangesAndColorsthe list of occupied ranges and their color
distancethis is set to the distance of the object from the camera. It is negative if the object is not visible by the camera
maxDistancethis is the maximum distance the camera can see. If the object is farther than this distance the function can safely return a negative distance (i.e. the object is not seen) and stop any other computation

Implements PhyObject2DWrapper.

Definition at line 558 of file wheeledexperimenthelper.cpp.

References PhyObject2DWrapper::color(), and WObject::matrix().

real depth ( ) const
inline

Returns the depth of the box.

Returns
the depth of the box

Definition at line 529 of file wheeledexperimenthelper.h.

PhyBox * phyObject ( )
virtual

Returns a pointer to the wrapped PhyObject.

You should avoid changing the PhyObject directly, use the methods of this class, instead

Returns
a pointer to the wrapped PhyObject

Implements PhyObject2DWrapper.

Definition at line 505 of file wheeledexperimenthelper.cpp.

Referenced by Arena::createRectangularTargetArea(), Arena::createWall(), MarXbot::orientation(), Epuck::orientation(), Khepera::orientation(), Box2DWrapper::setPosition(), and Box2DWrapper::setStatic().

const PhyBox * phyObject ( ) const
virtual

Returns a pointer to the wrapped PhyObject (const version)

Returns
a const pointer to the wrapped PhyObject

Implements PhyObject2DWrapper.

Definition at line 510 of file wheeledexperimenthelper.cpp.

void setKinematic ( bool  b,
bool  c = false 
)
virtual

Sets whether the object is kinematic or not.

Whether this can be made kinematic or not depends on the type of box

Parameters
bif true the object is set to kinematic behaviour
cif true the object collides with other objects even in kinematic mode, influencing them without being influenced (technically, we set its mass to 0 in Newton Game Dynamics engine)

Reimplemented from PhyObject2DWrapper.

Definition at line 530 of file wheeledexperimenthelper.cpp.

References PhyObject2DWrapper::setKinematic().

void setPosition ( real  x,
real  y 
)
virtual

Sets the position of the object in the plane.

Whether this can be moved or not depends on the type of box

Parameters
xthe new x coordinate
ythe new y coordinate

Implements PhyObject2DWrapper.

Definition at line 537 of file wheeledexperimenthelper.cpp.

References WObject::matrix(), Box2DWrapper::phyObject(), WObject::setPosition(), and PhyBox::sideZ().

void setStatic ( bool  s)
virtual

Sets whether the object is static or not.

Whether this can be made static or not depends on the type of box

Parameters
sif true the object will be static

Reimplemented from PhyObject2DWrapper.

Definition at line 520 of file wheeledexperimenthelper.cpp.

References Box2DWrapper::phyObject(), and PhyObject::setStatic().

Box2DWrapper::Type type ( ) const
virtual

Returns the type of this wrapper object.

Returns
the type of this wrapper object

Implements PhyObject2DWrapper.

Definition at line 515 of file wheeledexperimenthelper.cpp.

const wVector& vertex ( int  i) const
inline

Returns the coordinates of the i-th vertex of the box on the plane in the global frame of reference.

Parameters
ithe index of the vertex, between 0 and 3
Returns
the coordinates of the i-th vertex of the box on the plane in the global frame of reference.

Definition at line 497 of file wheeledexperimenthelper.h.

real width ( ) const
inline

Returns the width of the box.

Returns
the width of the box

Definition at line 519 of file wheeledexperimenthelper.h.

Friends And Related Function Documentation

friend class Arena
friend

The Arena class is friend to be able to instantiate and delete this class.

Definition at line 586 of file wheeledexperimenthelper.h.


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