C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
RectF class defines rectangle in the plane using float-precision. More...
#include <vsn_rect.h>
Public Member Functions | |
RectF () | |
Default constructor for creating empty rectangle. | |
void | Init (float x, float y, float w, float h) |
Initializes the rectangle with setting top-left angle coordinates and rectangle size. | |
void | InitCoords (float x1, float y1, float x2, float y2) |
Initializes the rectangle with setting top-left angle coordinates and rectangle size. | |
bool | IsNull () const |
True if rectangle is empty. More... | |
RectF | Normalized () const |
Returns normalized rectangle, i.e. the rectangle has no negative width and height. More... | |
PointF | GetTopLeft () const |
Returns position of the top-left rectangle angle. More... | |
void | SetTopLeft (const PointF &p) |
Sets the top-left rectangle angle to the given position. Changes size, but it does not change the bottom-right rectangle angle. | |
void | SetBottomRight (const PointF &p) |
Sets the bottom-right rectangle angle to the given position. Changes size, but it does not change the top-left rectangle angle. | |
void | Offset (float dx, float dy) |
Moves the rectangle on "dx" value along X-axis and "dy" value along Y-axis. It is all about the current position. | |
void | Offset (const PointF &p) |
Overloaded function. It moves the rectangle p.GetX() along X-axis and p.GetY() along Y-axis, all about the current position. | |
RectF | Offseted (float dx, float dy) const |
Returns copy of the rectangle that is moved on "dx" value along X-axis and "dy" value along Y-axis, all about the current position. All positive values move the rectangle to right and down. More... | |
RectF | Offseted (const PointF &p) const |
Overloaded function. It returns copy of the rectangle that is moved p.GetX() along X-axis and p.GetY() along Y-axis, all about the current position. Positive values move the rectangle to right and down. More... | |
void | MoveToXY (float x, float y) |
Moves the rectangle by shifting the top-left angle at the defined position (х, у). Rectangle size is not changed. | |
void | MoveToXY (const PointF &p) |
Moves the rectangle by shifting the top-left angle at the defined position. | |
void | Inflate (float x1, float y1, float x2, float y2) |
Adds x1, y1, x2, and y2 values to existing rectangle coordinates. | |
RectF | Inflated (float x1, float y1, float x2, float y2) const |
Returns new rectangle with x1, y1, x2, and y2 values, added to existing rectangle coordinates. More... | |
bool | RectInRect (const RectF &other) const |
Overloaded function. True if the defined rectangle is inside the given rectangle. True if the defined rectangle is wholly inside the given rectangle, not on the edge. More... | |
bool | PntInRect (const PointF &p) const |
True if the given point is inside the rectangle or on the edge. True if the given point is inside the rectangle, i.e. not on the edge. More... | |
bool | PntInRect (float x, float y) const |
Overloaded function. True if point (х, у) is inside the rectangle. More... | |
RectF | United (const RectF &other) const |
Returns bounding rectangle of the given rectangle and the defined rectangle. More... | |
RectF | Intersected (const RectF &other) const |
Returns intersection of the given rectangle and the defined rectangle. More... | |
bool | Intersects (const RectF &other) const |
True if the given rectangle intersects with the defined rectangle. It means that at least one pixel, inside both rectangles, exists. More... | |
RectF class defines rectangle in the plane using float-precision.
Rectangle is typically expressed as top-left angle and size. Rectangle can be constructed with integer coordinates of left, top, width and height, or with PointF and SizeI classes. RectI class provides a set of functions that return necessary coordinates of the rectangle and allow initializing them. RectI class also provides functions for moving the rectangle about its coordinates, etc.
|
inline |
True if rectangle is empty.
Null rectangle has width and height that equal 0, i.e. GetRight() == GetLeft() - 1 и GetBottom() == GetTop() - 1. Null rectangle is also empty and hence not valid.
RectF VSN::RectF::Normalized | ( | ) | const |
Returns normalized rectangle, i.e. the rectangle has no negative width and height.
|
inline |
Returns position of the top-left rectangle angle.
|
inline |
Returns copy of the rectangle that is moved on "dx" value along X-axis and "dy" value along Y-axis, all about the current position. All positive values move the rectangle to right and down.
Overloaded function. It returns copy of the rectangle that is moved p.GetX() along X-axis and p.GetY() along Y-axis, all about the current position. Positive values move the rectangle to right and down.
|
inline |
Returns new rectangle with x1, y1, x2, and y2 values, added to existing rectangle coordinates.
bool VSN::RectF::RectInRect | ( | const RectF & | other | ) | const |
Overloaded function. True if the defined rectangle is inside the given rectangle. True if the defined rectangle is wholly inside the given rectangle, not on the edge.
bool VSN::RectF::PntInRect | ( | const PointF & | p | ) | const |
True if the given point is inside the rectangle or on the edge. True if the given point is inside the rectangle, i.e. not on the edge.
bool VSN::RectF::PntInRect | ( | float | x, |
float | y | ||
) | const |
Overloaded function. True if point (х, у) is inside the rectangle.
Returns bounding rectangle of the given rectangle and the defined rectangle.
Returns intersection of the given rectangle and the defined rectangle.
bool VSN::RectF::Intersects | ( | const RectF & | other | ) | const |
True if the given rectangle intersects with the defined rectangle. It means that at least one pixel, inside both rectangles, exists.