|
LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
|
2D rectangle regin class. More...
#include <rect_2d.h>


Public Member Functions | |
| Rect2D () | |
| default constructor creates a zero area rectanble at (0,0) | |
| Rect2D (const Vector2D &top_left, const Size2D &size) | |
| constructor with variables More... | |
| Rect2D (const Vector2D &top_left, const Vector2D &bottom_right) | |
| constructor with 2 points. More... | |
| const Rect2D & | assign (const Vector2D &top_left, const Size2D &size) |
| assign new values More... | |
| const Rect2D & | moveCenter (const Vector2D &point) |
| move the rectangle. the center point is set to the given position. the size is unchanged. More... | |
| const Rect2D & | moveTopLeft (const Vector2D &point) |
| move the rectangle. the top-left coner is set to the given position. the size is unchanged. More... | |
| const Rect2D & | moveBottomRight (const Vector2D &point) |
| move the rectangle. the bottom-right coner is set to the given position. the size is unchanged. More... | |
| const Rect2D & | moveLeft (const double x) |
| move the rectangle. the left line is set to the given position. the size is unchanged. More... | |
| const Rect2D & | moveMinX (const double x) |
| alias of moveLeft. More... | |
| const Rect2D & | moveRight (const double x) |
| move the rectangle. the right line is set to the given value. the size is unchanged. More... | |
| const Rect2D & | moveMaxX (const double x) |
| alias of moveRight. More... | |
| const Rect2D & | moveTop (const double y) |
| move the rectangle. the top line is set to the given value. the size is unchanged. More... | |
| const Rect2D & | moveMinY (const double y) |
| alias of moveTop. More... | |
| const Rect2D & | moveBottom (const double y) |
| move the rectangle. the top line is set to the given value. the size is unchanged. More... | |
| const Rect2D & | moveMaxY (const double y) |
| alias of moveTop. More... | |
| const Rect2D & | setTopLeft (const double x, const double y) |
| set the top-left corner of the rectangle. the size may be changed, but the bottom-right corner will never be changed. More... | |
| const Rect2D & | setTopLeft (const Vector2D &point) |
| set the top-left corner of the rectangle. the size may be changed, but the bottom-right corner will never be changed. More... | |
| const Rect2D & | setBottomRight (const double x, const double y) |
| set the bottom-right corner of the rectangle. the size may be changed, but the top-left corner will never be changed. More... | |
| const Rect2D & | setBottomRight (const Vector2D &point) |
| set the bottom-right corner of the rectangle. the size may be changed, but the top-left corner will never be changed. More... | |
| const Rect2D & | setLeft (const double x) |
| set the left of rectangle. the size may be changed, but the right will never be changed. More... | |
| const Rect2D & | setMinX (const double x) |
| alias of setLeft. More... | |
| const Rect2D & | setRight (const double x) |
| set the right of rectangle. the size may be changed, but the left will never be changed. More... | |
| const Rect2D & | setMaxX (const double x) |
| alias of setRight. More... | |
| const Rect2D & | setTop (const double y) |
| set the top of rectangle. the size may be changed, but the bottom will never be changed. More... | |
| const Rect2D & | setMinY (const double y) |
| alias of setTop. More... | |
| const Rect2D & | setBottom (const double y) |
| set the bottom of rectangle. the size may be changed, but the top will never be changed. More... | |
| const Rect2D & | setMaxY (const double y) |
| alias of setBottom. More... | |
| const Rect2D & | setLength (const double length) |
| set a new x-range More... | |
| const Rect2D & | setWidth (const double width) |
| set a new y-range More... | |
| const Rect2D & | setSize (const double length, const double width) |
| set a new size More... | |
| const Rect2D & | setSize (const Size2D &size) |
| set a new size More... | |
| bool | isValid () const |
| check if this rectangle is valid or not. More... | |
| virtual double | area () const |
| get the area value of this rectangle. More... | |
| virtual bool | contains (const Vector2D &point) const |
| check if point is within this region. More... | |
| bool | contains (const Vector2D &point, const double error_thr) const |
| check if point is within this region with error threshold. More... | |
| double | left () const |
| get the left x coordinate of this rectangle. More... | |
| double | right () const |
| get the right x coordinate of this rectangle. More... | |
| double | top () const |
| get the top y coordinate of this rectangle. More... | |
| double | bottom () const |
| get the bottom y coordinate of this rectangle. More... | |
| double | minX () const |
| get minimum value of x coordinate of this rectangle More... | |
| double | maxX () const |
| get maximum value of x coordinate of this rectangle More... | |
| double | minY () const |
| get minimum value of y coordinate of this rectangle More... | |
| double | maxY () const |
| get maximum value of y coordinate of this rectangle More... | |
| const Size2D & | size () const |
| get the XY range of this rectangle More... | |
| Vector2D | center () const |
| get center point More... | |
| const Vector2D & | topLeft () const |
| get the top-left corner point More... | |
| Vector2D | topRight () const |
| get the top-right corner point More... | |
| Vector2D | bottomLeft () const |
| get the bottom-left corner point More... | |
| Vector2D | bottomRight () const |
| get the bottom-right corner point More... | |
| Line2D | leftEdge () const |
| get the left edge line More... | |
| Line2D | rightEdge () const |
| get the right edge line More... | |
| Line2D | topEdge () const |
| get the top edge line More... | |
| Line2D | bottomEdge () const |
| get the bottom edge line More... | |
| int | intersection (const Line2D &line, Vector2D *sol1, Vector2D *sol2) const |
| calculate intersection point with line. More... | |
| int | intersection (const Ray2D &ray, Vector2D *sol1, Vector2D *sol2) const |
| calculate intersection point with ray. More... | |
| int | intersection (const Segment2D &segment, Vector2D *sol1, Vector2D *sol2) const |
| calculate intersection point with line segment. More... | |
| const Rect2D & | operator&= (const Rect2D &other) |
| convert this rectangle to the intersection rectangle with other. If no intersection between rectangles, this rectangle becomes empty. More... | |
| Rect2D | intersected (const Rect2D &other) const |
| get the intersected rectangle of this rectangle and the other rectangle. This method is equivalent to operator '&'. If no intersection between rectangles, empty rectangle is returned. More... | |
| const Rect2D & | operator|= (const Rect2D &other) |
| convert this rectangle to the united rectangle with other. More... | |
| Rect2D | united (const Rect2D &other) const |
| get the united rectangle of this rectangle and the other rectangle. This method is equivalent to operator '|'. More... | |
Public Member Functions inherited from rcsc::Region2D | |
| virtual | ~Region2D () |
| virtual destructor. | |
| virtual double | area () const =0 |
| get the area of this region More... | |
| virtual bool | contains (const Vector2D &point) const =0 |
| check if this region contains 'point'. More... | |
Static Public Member Functions | |
| static Rect2D | from_center (const Vector2D ¢er, const double length, const double width) |
| create rectangle with center point and size. More... | |
| static Rect2D | from_center (const double center_x, const double center_y, const double length, const double width) |
| create rectangle with center point and size. More... | |
| static Rect2D | from_corners (const Vector2D &top_left, const Vector2D &bottom_right) |
| create rectangle with 2 corner points. just call one of constructor. More... | |
| static Rect2D | from_corners (const double l, const double t, const double r, const double b) |
| create rectangle with 2 corner points. just call one of constructor. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from rcsc::Region2D | |
| Region2D () | |
| accessible only from derived classes | |
2D rectangle regin class.
The model and naming rules are depend on soccer simulator environment -34.0 | | -52.5 ---—+----— 52.5 | | 34.0
constructor with variables
| top_left | top left point |
| size | XY range |
constructor with 2 points.
| top_left | top left vertex |
| bottom_right | bottom right vertex |
Even if argument point has incorrect values, the assigned values are normalized automatically.
|
inlinevirtual |
assign new values
| top_left | top left |
| size | XY range |
|
inline |
get the bottom y coordinate of this rectangle.
|
inline |
get the bottom edge line
|
inline |
get the bottom-left corner point
|
inline |
get the bottom-right corner point
|
inline |
get center point
|
inlinevirtual |
check if point is within this region.
| point | considered point |
Implements rcsc::Region2D.
|
inline |
check if point is within this region with error threshold.
| point | considered point |
| error_thr | error threshold |
|
inlinestatic |
create rectangle with center point and size.
| center_x | x value of center point of new rectangle. |
| center_y | y value of center point of new rectangle. |
| length | length(x-range) of new rectangle. |
| width | width(y-range) of new rectangle. |
|
inlinestatic |
create rectangle with center point and size.
| center | center point of new rectangle. |
| length | length(x-range) of new rectangle. |
| width | width(y-range) of new rectangle. |
|
inlinestatic |
create rectangle with 2 corner points. just call one of constructor.
| l | left x |
| t | top y |
| r | right x |
| b | bottom y |
|
inlinestatic |
create rectangle with 2 corner points. just call one of constructor.
| top_left | top left vertex |
| bottom_right | bottom right vertex |
get the intersected rectangle of this rectangle and the other rectangle. This method is equivalent to operator '&'. If no intersection between rectangles, empty rectangle is returned.
| other | other rectangle |
calculate intersection point with line.
| line | considerd line. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
calculate intersection point with ray.
| ray | considerd ray line. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
| int rcsc::Rect2D::intersection | ( | const Segment2D & | segment, |
| Vector2D * | sol1, | ||
| Vector2D * | sol2 | ||
| ) | const |
calculate intersection point with line segment.
| segment | considerd line segment. |
| sol1 | pointer to the 1st solution variable |
| sol2 | pointer to the 2nd solution variable |
|
inline |
check if this rectangle is valid or not.
|
inline |
get the left x coordinate of this rectangle.
|
inline |
get the left edge line
|
inline |
get maximum value of x coordinate of this rectangle
|
inline |
get maximum value of y coordinate of this rectangle
|
inline |
get minimum value of x coordinate of this rectangle
|
inline |
get minimum value of y coordinate of this rectangle
|
inline |
move the rectangle. the top line is set to the given value. the size is unchanged.
| y | new top value |
move the rectangle. the bottom-right coner is set to the given position. the size is unchanged.
| point | new bottom-right conrer |
move the rectangle. the center point is set to the given position. the size is unchanged.
| point | new center coordinates |
|
inline |
move the rectangle. the left line is set to the given position. the size is unchanged.
| x | new left value |
|
inline |
alias of moveRight.
| x | new right value |
|
inline |
alias of moveTop.
| y | new top value |
|
inline |
alias of moveLeft.
| x | new left value |
|
inline |
alias of moveTop.
| y | new top value |
|
inline |
move the rectangle. the right line is set to the given value. the size is unchanged.
| x | new right value |
|
inline |
move the rectangle. the top line is set to the given value. the size is unchanged.
| y | new top value |
move the rectangle. the top-left coner is set to the given position. the size is unchanged.
| point | new top-left corner |
convert this rectangle to the intersection rectangle with other. If no intersection between rectangles, this rectangle becomes empty.
| other | other rectangle. |
convert this rectangle to the united rectangle with other.
| other | other rectangle. |
|
inline |
get the right x coordinate of this rectangle.
|
inline |
get the right edge line
| const Rect2D & rcsc::Rect2D::setBottom | ( | const double | y | ) |
set the bottom of rectangle. the size may be changed, but the top will never be changed.
| y | new bottom value |
| const Rect2D & rcsc::Rect2D::setBottomRight | ( | const double | x, |
| const double | y | ||
| ) |
set the bottom-right corner of the rectangle. the size may be changed, but the top-left corner will never be changed.
| x | new x coordinate |
| y | new y coordinate |
set the bottom-right corner of the rectangle. the size may be changed, but the top-left corner will never be changed.
| point | new coordinate |
| const Rect2D & rcsc::Rect2D::setLeft | ( | const double | x | ) |
set the left of rectangle. the size may be changed, but the right will never be changed.
| x | new left value |
|
inline |
set a new x-range
| length | new range |
|
inline |
alias of setRight.
| x | new right value |
|
inline |
alias of setBottom.
| y | new top value |
|
inline |
alias of setLeft.
| x | new left value |
|
inline |
alias of setTop.
| y | new top value |
| const Rect2D & rcsc::Rect2D::setRight | ( | const double | x | ) |
set the right of rectangle. the size may be changed, but the left will never be changed.
| x | new right value |
|
inline |
set a new size
| length | new range |
| width | new range |
set a new size
| size | new range |
| const Rect2D & rcsc::Rect2D::setTop | ( | const double | y | ) |
set the top of rectangle. the size may be changed, but the bottom will never be changed.
| y | new top value |
| const Rect2D & rcsc::Rect2D::setTopLeft | ( | const double | x, |
| const double | y | ||
| ) |
set the top-left corner of the rectangle. the size may be changed, but the bottom-right corner will never be changed.
| x | new x coordinate |
| y | new y coordinate |
set the top-left corner of the rectangle. the size may be changed, but the bottom-right corner will never be changed.
| point | new coordinate |
|
inline |
set a new y-range
| width | new range |
|
inline |
get the XY range of this rectangle
|
inline |
get the top y coordinate of this rectangle.
|
inline |
get the top edge line
|
inline |
get the top-left corner point
|
inline |
get the top-right corner point
get the united rectangle of this rectangle and the other rectangle. This method is equivalent to operator '|'.
| other | other rectangle |