last update 20 Sep 2009 |
#include <cvrRectLocation.h>
Public Member Functions | |
rectLocation () | |
rectLocation (const ipoint &pos, const float &ang, const float &maxLength, const float &minLength) | |
rectLocation (const fpoint &pos, const float &ang, const float &maxLength, const float &minLength) | |
rectLocation (const location &loc) | |
rectLocation (const rectLocation &other) | |
rectLocation & | copy (const rectLocation &other) |
rectLocation & | castFrom (const location &other) |
rectLocation & | operator= (const rectLocation &other) |
bool | operator== (const rectLocation &p) const |
bool | operator!= (const rectLocation &p) const |
bool | operator< (const rectLocation &other) |
bool | operator> (const rectLocation &other) |
rectLocation & | scale (const float &factor) |
rectLocation & | scale (const rectLocation &other, const float &factor) |
rectLocation & | shift (const ipoint &shft) |
rectLocation & | shift (const fpoint &shft) |
rectLocation & | shift (const rectLocation &other, const ipoint &shft) |
rectLocation & | shift (const rectLocation &other, const fpoint &shft) |
rectLocation & | rotate (const float &factor) |
rectLocation & | rotate (const rectLocation &other, const float &factor) |
bool | contains (const ipoint &p) const |
bool | contains (const fpoint &p) const |
float | distanceSqr (const rectLocation &other) |
float | distanceSqr (const rectLocation &other, fpoint &pt, fpoint &po) |
float | calculateArea () const |
Public Attributes | |
fpoint | position |
float | angle |
float | maxLength |
float | minLength |
The rectangular location is represented by its position in an image or channel, an orientation, the length at the orientation direction (maxLenght), and the length at the perpendicular direction (minLength).
The difference to cvr::location is that the regions are considered rectangular. Two lengths are needed, where the orientation angle is always given for the maxLength.
You can get rectangular locations with the cvr::boundingBox functor, and use them to check if objects overlap or not.
cvr::rectLocation::rectLocation | ( | ) |
Default constructor.
cvr::rectLocation::rectLocation | ( | const ipoint & | pos, | |
const float & | ang, | |||
const float & | maxLength, | |||
const float & | minLength | |||
) |
Constructor.
pos | position of the center point of the rectLocation | |
ang | angle of the rectLocation (in radians) | |
maxLength | length in pixels of the principal axis | |
minLength | length in pixels of the second axis |
cvr::rectLocation::rectLocation | ( | const fpoint & | pos, | |
const float & | ang, | |||
const float & | maxLength, | |||
const float & | minLength | |||
) |
Constructor.
pos | position of the center point of the rectLocation | |
ang | angle of the rectLocation (in radians) | |
maxLength | length in pixels of the principal axis | |
minLength | length in pixels of the second axis |
cvr::rectLocation::rectLocation | ( | const rectLocation & | other | ) |
Copy constructor.
float cvr::rectLocation::calculateArea | ( | ) | const |
Get the area of this location (maxLength*minLength).
rectLocation& cvr::rectLocation::castFrom | ( | const location & | other | ) |
Copy the other location into this rectLocation.
The radius of the location will be assumed as the maxLength and minLength.
bool cvr::rectLocation::contains | ( | const fpoint & | p | ) | const |
Check if the given point can be considered within the rectLocation.
bool cvr::rectLocation::contains | ( | const ipoint & | p | ) | const |
Check if the given point can be considered within the rectLocation.
rectLocation& cvr::rectLocation::copy | ( | const rectLocation & | other | ) |
Copy operator.
float cvr::rectLocation::distanceSqr | ( | const rectLocation & | other, | |
fpoint & | pt, | |||
fpoint & | po | |||
) |
Returns the square of the distance between the borders of two locations or zero if they overlap or if one of the locations lies inside the other one.
other | the other rectLocation to be compared with | |
pt | point in the border of this location with the smallest distance. | |
po | point in the border of the other location with the smallest distance. |
float cvr::rectLocation::distanceSqr | ( | const rectLocation & | other | ) |
Returns the square of the distance between the borders of two locations or zero if they overlap or if one of the locations lies inside the other one.
other | the other rectLocation to be compared with |
bool cvr::rectLocation::operator!= | ( | const rectLocation & | p | ) | const |
Operator !=.
bool cvr::rectLocation::operator< | ( | const rectLocation & | other | ) |
Comparition operator.
A rectLocation is smaller than another one if its area is smaller, or in case of equal areas, if the position is smaller, i.e. if it has smaller y-coordinate, or in case of equal y-position, if it has smaller x-coordinate.
rectLocation& cvr::rectLocation::operator= | ( | const rectLocation & | other | ) |
Alias for copy operator.
bool cvr::rectLocation::operator== | ( | const rectLocation & | p | ) | const |
Operator ==.
bool cvr::rectLocation::operator> | ( | const rectLocation & | other | ) |
Comparition operator.
A rectLocation is greater than another one if its area is greater, or in case of equal radii, if the position is greater, i.e. if it has greater y-coordinate, or in case of equal y-position, if it has greater x-coordinate.
rectLocation& cvr::rectLocation::rotate | ( | const rectLocation & | other, | |
const float & | factor | |||
) |
Add the given angle in radians to the angle of the other rectLocation and leave the result here.
rectLocation& cvr::rectLocation::rotate | ( | const float & | factor | ) |
Add the given angle in radians to the actual angle.
rectLocation& cvr::rectLocation::scale | ( | const rectLocation & | other, | |
const float & | factor | |||
) |
Multiply the other rectLocation's lengths and position with the given factor and leave the result here.
rectLocation& cvr::rectLocation::scale | ( | const float & | factor | ) |
Multiply the lengths and position with the given factor.
rectLocation& cvr::rectLocation::shift | ( | const rectLocation & | other, | |
const fpoint & | shft | |||
) |
Shift the other rectLocation by the given point and leave the result here.
rectLocation& cvr::rectLocation::shift | ( | const rectLocation & | other, | |
const ipoint & | shft | |||
) |
Shift the other rectLocation by the given point and leave the result here.
rectLocation& cvr::rectLocation::shift | ( | const fpoint & | shft | ) |
Shift the rectLocation by the given point.
rectLocation& cvr::rectLocation::shift | ( | const ipoint & | shft | ) |
Shift the rectLocation by the given point.
float cvr::rectLocation::angle |
Angle in radians of the rectLocation.
It is usually given for the image coordinates, i.e. for a left coordinate system, in which positive angles are given clock-wise.
Major length.
The angle corresponds to the axis with the maxLength
Minor length.
Should be smaller than maximum length
Position of the rectLocation.