#include <rect_2d.h>
Public メソッド | |
Rect2D () | |
default constructor creates a zero area rectanble at (0,0) | |
Rect2D (const double &left_x, const double &top_y, const double &length, const double &width) | |
constructor | |
Rect2D (const Vector2D &top_left, const double &length, const double &width) | |
constructor with variables | |
Rect2D (const Vector2D &top_left, const Size2D &size) | |
constructor with variables | |
Rect2D (const Vector2D &top_left, const Vector2D &bottom_right) | |
constructor with 2 points. | |
const Rect2D & | assign (const double &left_x, const double &top_y, const double &length, const double &width) |
assign new values | |
const Rect2D & | assign (const Vector2D &top_left, const double &length, const double &width) |
assign new values | |
const Rect2D & | assign (const Vector2D &top_left, const Size2D &size) |
assign new values | |
const Rect2D & | setTopLeft (const double &x, const double &y) |
set a new top left corner point | |
const Rect2D & | setTopLeft (const Vector2D &point) |
set a new top left corner point | |
const Rect2D & | setCenter (const Vector2D &point) |
set a new center point. only top left corner is moved. size is not changed. | |
const Rect2D & | setLength (const double &length) |
set a new x-range | |
const Rect2D & | setWidth (const double &width) |
set a new y-range | |
const Rect2D & | setSize (const double &length, const double &width) |
set a new size | |
const Rect2D & | setSize (const Size2D &size) |
set a new size | |
bool | contains (const Vector2D &point) const |
check if point is within this region. | |
const double & | left () const |
get the left x coordinate of this rectangle. | |
double | right () const |
get the right x coordinate of this rectangle. | |
const double & | top () const |
get the top y coordinate of this rectangle. | |
double | bottom () const |
get the bottom y coordinate of this rectangle. | |
double | minX () const |
get minimum value of x coordinate of this rectangle | |
double | maxX () const |
get maximum value of x coordinate of this rectangle | |
double | minY () const |
get minimum value of y coordinate of this rectangle | |
double | maxY () const |
get maximum value of y coordinate of this rectangle | |
const Size2D & | size () const |
get the XY range of this rectangle | |
Vector2D | center () const |
get center point | |
const Vector2D & | topLeft () const |
get the top-left corner point | |
Vector2D | topRight () const |
get the top-right corner point | |
Vector2D | bottomLeft () const |
get the bottom-left corner point | |
Vector2D | bottomRight () const |
get the bottom-right corner point | |
Line2D | leftEdge () const |
get the left edge line | |
Line2D | rightEdge () const |
get the right edge line | |
Line2D | topEdge () const |
get the top edge line | |
Line2D | bottomEdge () const |
get the bottom edge line | |
int | intersection (const Line2D &line, Vector2D *sol1, Vector2D *sol2) const |
calculate intersection point with line. | |
int | intersection (const Ray2D &ray, Vector2D *sol1, Vector2D *sol2) const |
calculate intersection point with ray. | |
int | intersection (const Segment2D &segment, Vector2D *sol1, Vector2D *sol2) const |
calculate intersection point with line segment. | |
Static Public メソッド | |
static Rect2D | from_center (const Vector2D ¢er, const double &length, const double &width) |
create rectangle with center point and size. | |
static Rect2D | from_center (const double ¢er_x, const double ¢er_y, const double &length, const double &width) |
create rectangle with center point and size. | |
static Rect2D | from_corners (const Vector2D &top_left, const Vector2D &bottom_right) |
create rectangle with 2 corner points. just call one of constructor. |
The model and naming rules are depend on soccer simulator environment -34.0 | | -52.5 ------+------- 52.5 | | 34.0
rcsc::Rect2D::Rect2D | ( | const double & | left_x, | |
const double & | top_y, | |||
const double & | length, | |||
const double & | width | |||
) | [inline] |
constructor
left_x | left x | |
top_y | top y | |
length | length (x-range) | |
width | width (y-range) |
rcsc::Rect2D::Rect2D | ( | const Vector2D & | top_left, | |
const double & | length, | |||
const double & | width | |||
) | [inline] |
constructor with variables
top_left | top left point | |
length | X range | |
width | Y range |
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 |
static Rect2D rcsc::Rect2D::from_center | ( | const Vector2D & | center, | |
const double & | length, | |||
const double & | width | |||
) | [inline, static] |
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. |
static Rect2D rcsc::Rect2D::from_center | ( | const double & | center_x, | |
const double & | center_y, | |||
const double & | length, | |||
const double & | width | |||
) | [inline, static] |
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. |
static Rect2D rcsc::Rect2D::from_corners | ( | const Vector2D & | top_left, | |
const Vector2D & | bottom_right | |||
) | [inline, static] |
create rectangle with 2 corner points. just call one of constructor.
top_left | top left vertex | |
bottom_right | bottom right vertex |
const Rect2D& rcsc::Rect2D::assign | ( | const double & | left_x, | |
const double & | top_y, | |||
const double & | length, | |||
const double & | width | |||
) | [inline] |
assign new values
left_x | left x | |
top_y | top y | |
length | X range | |
width | Y range |
const Rect2D& rcsc::Rect2D::assign | ( | const Vector2D & | top_left, | |
const double & | length, | |||
const double & | width | |||
) | [inline] |
assign new values
top_left | top left point | |
length | X range | |
width | Y range |
assign new values
top_left | top left | |
size | XY range |
const Rect2D& rcsc::Rect2D::setTopLeft | ( | const double & | x, | |
const double & | y | |||
) | [inline] |
set a new top left corner point
x | new x coordinate | |
y | new y coordinate |
set a new top left corner point
point | new coordinate |
set a new center point. only top left corner is moved. size is not changed.
point | new center coordinate |
const Rect2D& rcsc::Rect2D::setLength | ( | const double & | length | ) | [inline] |
set a new x-range
length | new range |
const Rect2D& rcsc::Rect2D::setWidth | ( | const double & | width | ) | [inline] |
set a new y-range
width | new range |
const Rect2D& rcsc::Rect2D::setSize | ( | const double & | length, | |
const double & | width | |||
) | [inline] |
set a new size
length | new range | |
width | new range |
set a new size
size | new range |
bool rcsc::Rect2D::contains | ( | const Vector2D & | point | ) | const [inline] |
check if point is within this region.
point | considered point |
const double& rcsc::Rect2D::left | ( | ) | const [inline] |
get the left x coordinate of this rectangle.
double rcsc::Rect2D::right | ( | ) | const [inline] |
get the right x coordinate of this rectangle.
const double& rcsc::Rect2D::top | ( | ) | const [inline] |
get the top y coordinate of this rectangle.
double rcsc::Rect2D::bottom | ( | ) | const [inline] |
get the bottom y coordinate of this rectangle.
double rcsc::Rect2D::minX | ( | ) | const [inline] |
double rcsc::Rect2D::maxX | ( | ) | const [inline] |
double rcsc::Rect2D::minY | ( | ) | const [inline] |
double rcsc::Rect2D::maxY | ( | ) | const [inline] |
const Size2D& rcsc::Rect2D::size | ( | ) | const [inline] |
get the XY range of this rectangle
Vector2D rcsc::Rect2D::center | ( | ) | const [inline] |
get center point
const Vector2D& rcsc::Rect2D::topLeft | ( | ) | const [inline] |
get the top-left corner point
Vector2D rcsc::Rect2D::topRight | ( | ) | const [inline] |
get the top-right corner point
Vector2D rcsc::Rect2D::bottomLeft | ( | ) | const [inline] |
get the bottom-left corner point
Vector2D rcsc::Rect2D::bottomRight | ( | ) | const [inline] |
get the bottom-right corner point
Line2D rcsc::Rect2D::leftEdge | ( | ) | const [inline] |
get the left edge line
Line2D rcsc::Rect2D::rightEdge | ( | ) | const [inline] |
get the right edge line
Line2D rcsc::Rect2D::topEdge | ( | ) | const [inline] |
get the top edge line
Line2D rcsc::Rect2D::bottomEdge | ( | ) | const [inline] |
get the bottom edge line
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 |