Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7915 in orxonox.OLD for branches/gui/src/lib/math


Ignore:
Timestamp:
May 28, 2006, 3:36:31 AM (19 years ago)
Author:
bensch
Message:

gui: doxytags

Location:
branches/gui/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/math/rect2D.cc

    r7914 r7915  
    7272}
    7373
     74/**
     75 * @brief compares two rectanles.
     76 * @param rect the rectangle to compare
     77 * @returns true if the two rectangles are the same
     78 */
    7479bool Rect2D::operator==(const Rect2D& rect) const
    7580{
    7681  return (this->_topLeft == rect._topLeft &&
    77       this->_bottomRight == rect._bottomRight);
    78 }
    79 
     82          this->_bottomRight == rect._bottomRight);
     83}
     84
     85/**
     86 * @brief negative compares two rectanles.
     87 * @param rect the rectangle to compare
     88 * @returns true if the two rectangles are different
     89 */
    8090bool Rect2D::operator!=(const Rect2D& rect) const
    8191{
    8292  return (this->_topLeft != rect._topLeft ||
    83       this->_bottomRight != rect._bottomRight);
    84 }
    85 
    86 
     93          this->_bottomRight != rect._bottomRight);
     94}
     95
     96/**
     97 * @brief adds two rectangles together
     98 * @param rect the rectagle to be added
     99 * @returns a Rectangle, where both are added together.
     100 *
     101 * @note since adding rectangles does not make sense generally, here a description:
     102 * adds toplefts and botomrights
     103 */
    87104Rect2D Rect2D::operator+(const Rect2D& rect) const
    88   {
    89     return Rect2D(this->_topLeft + rect._topLeft,
    90                   this->_bottomRight + rect._bottomRight);
    91   }
    92 
    93 
     105{
     106  return Rect2D(this->_topLeft + rect._topLeft,
     107                this->_bottomRight + rect._bottomRight);
     108}
     109
     110
     111/**
     112 * @brief adds two rectangles together
     113 * @param rect the rectagle to be added to this one
     114 * @returns a Rectangle, where both are added together.
     115 */
    94116Rect2D& Rect2D::operator+=(const Rect2D& rect)
    95117{
     
    100122
    101123
     124/**
     125 * @brief subracts two rectangles from each other
     126 * @param rect the rectagle to be substracted from this one
     127 * @returns a Rectangle, where both are substracted from one another.
     128 */
    102129Rect2D Rect2D::operator-(const Rect2D& rect) const
    103130{
     
    106133}
    107134
     135/**
     136 * @brief subracts two rectangles from each other
     137 * @param rect the rectagle to be substracted from this one
     138 * @returns a Rectangle, where both are substracted from one another.
     139 */
    108140Rect2D& Rect2D::operator-=(const Rect2D& rect)
    109141{
     
    113145}
    114146
     147/**
     148 * @brief intersects two Rectangles.
     149 * @see intersection .
     150 * @param rect the Rectangle to intersect with this one.
     151 * @returns the intersection Region.
     152 */
    115153Rect2D Rect2D::operator&(const Rect2D& rect) const
    116   {
    117     return this->intersection(rect);
    118   }
    119 
     154{
     155  return this->intersection(rect);
     156}
     157
     158/**
     159 * @brief intersects two Rectangles and assigns result to this one.
     160 * @param rect the Rectangle to intersect with this one.
     161 * @returns the intersection Region.
     162 */
    120163Rect2D& Rect2D::operator&=(const Rect2D& rect)
    121164{
     
    123166}
    124167
     168/**
     169 * TODO coment/implement
     170 */
    125171Rect2D Rect2D::operator*(const Vector2D& scaling) const
    126172{
     
    129175}
    130176
    131 
     177/**
     178 * @brief sets the width of the Rectangle
     179 * @param width the new width of the Rectangle
     180 *
     181 * the rectangle will be resized from the top left corner out.
     182 */
    132183void Rect2D::setWidth(float width)
    133184{
     
    136187
    137188
     189/**
     190 * @brief sets the height of the Rectangle
     191 * @param height the new height of the Rectangle
     192 *
     193 * the rectangle will be resized from the top left corner out.
     194 */
    138195void Rect2D::setHeight(float height)
    139196{
     
    141198}
    142199
     200/**
     201 * @brief sets the size of the Rectangle
     202 * @param width the new width of the Rectangle.
     203 * @param height the new height of the Rectangle.
     204 * the rectangle will be resized from the top left corner out.
     205 */
    143206void Rect2D::setSize(float width, float height)
    144207{
     
    146209}
    147210
     211
     212/**
     213 * @brief sets the size of the Rectangle
     214 * @param size the new size of the Rectangle.
     215 * the rectangle will be resized from the top left corner out.
     216 */
    148217void Rect2D::setSize(const Vector2D& size)
    149218{
     
    151220}
    152221
     222/**
     223 * @brief sets the new Center
     224 * @param center the center to move the Rectangle to.
     225 * moves the Rectangle from its current center to the new Center
     226 */
    153227void Rect2D::setCenter(const Vector2D& center)
    154228{
     
    156230}
    157231
     232/**
     233 * @brief scales the Rectangle from topLeft out.
     234 * @param x: the scale factor in x direction
     235 */
    158236void Rect2D::scaleX(float x)
    159237{
     
    161239}
    162240
     241/**
     242 * @brief scales the Rectangle from topLeft out.
     243 * @param y: the scale factor in y direction
     244 */
    163245void Rect2D::scaleY(float y)
    164246{
     
    166248}
    167249
     250/**
     251 * @brief scales the Rectangle from topLeft out.
     252 * @param x: the scale factor in x direction
     253 * @param y: the scale factor in y direction
     254 */
    168255void Rect2D::scale(float x, float y)
    169256{
     
    171258}
    172259
     260/**
     261 * @brief scales the Rectangle from topLeft out.
     262 * @param v: the scale factors.
     263 */
    173264void Rect2D::scale(const Vector2D& v)
    174265{
     
    177268}
    178269
     270/**
     271 * @brief scales the Rectangle from the Center out.
     272 * @param x: the scale factor in x-direction.
     273 * @param y: the scale factor in y-direction.
     274 */
    179275void Rect2D::scaleCentered(float x, float y)
    180276{
     
    182278}
    183279
     280
     281/**
     282 * @brief scales the Rectangle from the Center out.
     283 * @param v: the scale factors.
     284 */
    184285void Rect2D::scaleCentered(const Vector2D& v)
    185286{
     
    187288}
    188289
     290/**
     291 * @brief moves the Rectangle
     292 * @param x the amount to move in x.
     293 */
    189294void Rect2D::moveX(float x)
    190295{
     
    193298}
    194299
     300/**
     301 * @brief moves the Rectangle
     302 * @param y the amount to move in y.
     303 */
    195304void Rect2D::moveY(float y)
    196305{
     
    198307  this->_bottomRight.y += y;
    199308}
     309
     310/**
     311 * @brief moves the Rectangle
     312 * @param x the amount to move in x.
     313 * @param y the amount to move in y.
     314 */
     315void Rect2D::move(float x, float y)
     316{
     317  this->move(Vector2D(x, y));
     318}
     319
     320/**
     321 * @brief moves the Rectangle
     322 * @param v the amount to move.
     323 */
    200324void Rect2D::move(const Vector2D& v)
    201325{
     
    204328}
    205329
     330/**
     331 * @brief swaps top and bottom.
     332 */
    206333void Rect2D::swapTopBottom()
    207334{
     
    211338}
    212339
     340/**
     341 * @brief swaps left and right.
     342 */
    213343void Rect2D::swapLeftRight()
    214344{
     
    218348}
    219349
    220 
     350/**
     351 * @brief normalizes the Rectangle.
     352 *
     353 * Normalizing a Rectangle means, that the top is above bottom, and left is left of right afterwards :)
     354 */
    221355void Rect2D::normalize()
    222356{
     
    227361}
    228362
     363/**
     364 * @brief normalizes the Rectangle.
     365 * @returns the normalized version of this rectangle.
     366 *
     367 * Normalizing a Rectangle means, that the top is above bottom, and left is left of right afterwards :)
     368 */
    229369Rect2D Rect2D::normalized() const
    230370{
     
    234374}
    235375
    236 
     376/**
     377 * @brief The intersection of two Rectangles is calculated and returned.
     378 * @param intersector the Rectangle to intersect with this one.
     379 * @return the intersection region.
     380 */
    237381Rect2D Rect2D::intersection(const Rect2D& intersector) const
    238382{
     
    240384}
    241385
     386/**
     387 * @brief checks if the intersection of two Rectangles is not empty.
     388 */
    242389bool Rect2D::intersects(const Rect2D& intersector) const
    243   {
     390{
    244391#warning implement
    245392
    246   }
     393}
     394
     395/**
     396 * @brief make an Extensive join of two rectangles.
     397 * @param rect the rectangle to unite with this one.
     398 * @returns the united rectangle
     399 */
    247400Rect2D Rect2D::unite(const Rect2D& rect)
    248   {
     401{
    249402#warning implement
    250   }
     403
     404}
     405
     406/**
     407 * @brief checks if rect is inside of this Rectangle.
     408 * @param rect The Rectangle that should be inside of this one.
     409 * @returns tru if it is.
     410 */
    251411bool Rect2D::contains(const Rect2D& rect) const
    252   {
    253     return (this->top() <= rect.top() &&
    254         this->bottom() >= rect.bottom() &&
    255         this->left() <= rect.left() &&
    256         this->right() >= rect.right());
    257   }
     412{
     413  return (this->top() <= rect.top() &&
     414          this->bottom() >= rect.bottom() &&
     415          this->left() <= rect.left() &&
     416          this->right() >= rect.right());
     417}
     418
     419/**
     420 * @param point the point to check if it is inside.
     421 * @returns true if the point is inside of this Rectangle.
     422 */
    258423bool Rect2D::contains(const Vector2D& point) const
    259   {
    260     return (this->top() <= point.y &&
    261         this->bottom() >= point.y &&
    262         this->left() <= point.x &&
    263         this->right() >= point.x);
    264   }
    265 
     424{
     425  return (this->top() <= point.y &&
     426          this->bottom() >= point.y &&
     427          this->left() <= point.x &&
     428          this->right() >= point.x);
     429}
     430
     431/**
     432 * @brief slerps this Rectangle to rect.
     433 * @param rect the rectangle to slerp to.
     434 * @param value how much to slerp to [0:stay, 1:go there]
     435 * @returns reference to this.
     436 */
    266437const Rect2D& Rect2D::slerp(const Rect2D& rect, float value)
    267438{
  • branches/gui/src/lib/math/rect2D.h

    r7914 r7915  
    102102  void moveX(float x);
    103103  void moveY(float y);
     104  void move(float x, float y);
    104105  void move(const Vector2D& v);
    105106
Note: See TracChangeset for help on using the changeset viewer.