latest version v1.9 - last update 10 Apr 2010 |
The rectLocation class specifies a small region in an image or channel. More...
#include <ltiLocation.h>
Public Member Functions | |
rectLocation () | |
rectLocation (const point &pos, const float &ang, const float &maxLength, const float &minLength) | |
rectLocation (const tpoint< float > &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 point &shft) |
rectLocation & | shift (const tpoint< float > &shft) |
rectLocation & | shift (const rectLocation &other, const point &shft) |
rectLocation & | shift (const rectLocation &other, const tpoint< float > &shft) |
rectLocation & | rotate (const float &factor) |
rectLocation & | rotate (const rectLocation &other, const float &factor) |
bool | contains (const point &p) const |
bool | contains (const tpoint< float > &p) const |
float | distanceSqr (const rectLocation &other) |
float | distanceSqr (const rectLocation &other, tpoint< float > &pt, tpoint< float > &po) |
float | getArea () const |
Public Attributes | |
tpoint< float > | position |
float | angle |
float | maxLength |
float | minLength |
The rectLocation class specifies a small region in an image or channel.
The rectangular locations are 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 lti::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 lti::boundingBox functor, and used them to check if objects overlap or not.
lti::rectLocation::rectLocation | ( | ) |
default constructor
lti::rectLocation::rectLocation | ( | const point & | pos, | |
const float & | ang, | |||
const float & | maxLength, | |||
const float & | minLength | |||
) |
Constructor.
pos | position of the middle 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 |
lti::rectLocation::rectLocation | ( | const tpoint< float > & | pos, | |
const float & | ang, | |||
const float & | maxLength, | |||
const float & | minLength | |||
) |
Constructor.
pos | position of the middle 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 |
lti::rectLocation::rectLocation | ( | const rectLocation & | other | ) |
copy constructor
rectLocation& lti::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 lti::rectLocation::contains | ( | const tpoint< float > & | p | ) | const |
Check if the given point can be considered within the rectLocation.
bool lti::rectLocation::contains | ( | const point & | p | ) | const |
Check if the given point can be considered within the rectLocation.
rectLocation& lti::rectLocation::copy | ( | const rectLocation & | other | ) |
copy operator
float lti::rectLocation::distanceSqr | ( | const rectLocation & | other, | |
tpoint< float > & | pt, | |||
tpoint< float > & | 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 lti::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 |
float lti::rectLocation::getArea | ( | ) | const |
Get the area of this location (maxLength*minLength).
bool lti::rectLocation::operator!= | ( | const rectLocation & | p | ) | const |
operator !=
bool lti::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& lti::rectLocation::operator= | ( | const rectLocation & | other | ) |
alias for copy operator
bool lti::rectLocation::operator== | ( | const rectLocation & | p | ) | const |
operator ==
bool lti::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& lti::rectLocation::rotate | ( | const rectLocation & | other, | |
const float & | factor | |||
) |
Add the given angle in radius to the angle of the other rectLocation and leave the result here.
rectLocation& lti::rectLocation::rotate | ( | const float & | factor | ) |
Add the given angle in radius to the actual angle.
rectLocation& lti::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& lti::rectLocation::scale | ( | const float & | factor | ) |
Multiply the lengths and position with the given factor.
rectLocation& lti::rectLocation::shift | ( | const rectLocation & | other, | |
const tpoint< float > & | shft | |||
) |
Shift the other rectLocation by the given point and leave the result here.
rectLocation& lti::rectLocation::shift | ( | const rectLocation & | other, | |
const point & | shft | |||
) |
Shift the other rectLocation by the given point and leave the result here.
rectLocation& lti::rectLocation::shift | ( | const tpoint< float > & | shft | ) |
Shift the rectLocation by the given point.
rectLocation& lti::rectLocation::shift | ( | const point & | shft | ) |
Shift the rectLocation by the given point.
float lti::rectLocation::angle |
Angle in radius 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.
maximum length.
The angle corresponds to the axis with the maxLength
minimum length.
Should be smaller than maximum length
Position of the rectLocation.