Image Component Library (ICL)
|
The ICLs abstract line class describing a line from Point "start" to Point "end". More...
#include <Line32f.h>
Public Member Functions | |
Line32f (utils::Point32f start=utils::Point::null, utils::Point32f end=utils::Point::null) | |
Creates a new line from point "start" to point "end". | |
Line32f (utils::Point32f start, float angle, float length) | |
Creates a new line by given polar coordinates. | |
Line32f (const Line &l) | |
Creates a line by a given integer line. | |
Line32f | operator+ (const utils::Point32f &p) const |
translates a line by a given vector | |
Line32f | operator- (const utils::Point32f &p) const |
translates a line by a given vector (negative direction) | |
float | length () const |
calculates the euclidean norm of this line | |
float | getAngle () const |
returns line angle [ atan2(dy,dx) ] | |
utils::Point32f | getCenter () const |
returns the lines center point [ (start+end)/2 ] | |
bool | intersects (const core::Line32f &other, utils::Point32f *p=0, float *dstr=0, float *dsts=0) const |
return whether the line intersects with the given other line | |
std::vector< utils::Point > | sample (const utils::Rect &limits=utils::Rect::null) const |
samples this line from start to end point regarding the given limiting rect | |
void | sample (std::vector< int > &xs, std::vector< int > &ys, const utils::Rect &limits=utils::Rect::null) const |
samples this line from start to end point regarding the given limiting rect | |
void | swap () |
swaps the lines start and end point internally | |
Public Attributes | |
utils::Point32f | start |
start point of this line | |
utils::Point32f | end |
end point of this line | |
Static Public Attributes | |
static const Line32f | null |
Null line of length 0 with and and end point 0. |
The ICLs abstract line class describing a line from Point "start" to Point "end".
icl::core::Line32f::Line32f | ( | utils::Point32f | start = utils::Point::null , |
utils::Point32f | end = utils::Point::null |
||
) | [inline] |
Creates a new line from point "start" to point "end".
start | start point |
end | end point |
icl::core::Line32f::Line32f | ( | utils::Point32f | start, |
float | angle, | ||
float | length | ||
) |
Creates a new line by given polar coordinates.
start | start point of the line |
angle | angle of the line |
length | length of the line |
icl::core::Line32f::Line32f | ( | const Line & | l | ) |
Creates a line by a given integer line.
l | interger line |
float icl::core::Line32f::getAngle | ( | ) | const |
returns line angle [ atan2(dy,dx) ]
utils::Point32f icl::core::Line32f::getCenter | ( | ) | const |
returns the lines center point [ (start+end)/2 ]
bool icl::core::Line32f::intersects | ( | const core::Line32f & | other, |
utils::Point32f * | p = 0 , |
||
float * | dstr = 0 , |
||
float * | dsts = 0 |
||
) | const |
return whether the line intersects with the given other line
Optionally, the actual intersection point can be calculated and stored into a non-null p argument. dstr and dsts are filled with the interpolation factors between start and end for the actual intersection point if not null. If there is no intersection, p, dstr and dsts are not used
float icl::core::Line32f::length | ( | ) | const |
calculates the euclidean norm of this line
Line32f icl::core::Line32f::operator+ | ( | const utils::Point32f & | p | ) | const [inline] |
translates a line by a given vector
p | translation vector |
Line32f icl::core::Line32f::operator- | ( | const utils::Point32f & | p | ) | const [inline] |
translates a line by a given vector (negative direction)
p | translation vector |
std::vector<utils::Point> icl::core::Line32f::sample | ( | const utils::Rect & | limits = utils::Rect::null | ) | const |
samples this line from start to end point regarding the given limiting rect
limits | each line point is check for being inside of this rect the eases working e.g. on image planes, that have an finite extend. If the limits rect has width*height == 0, the limits are not regarded. |
void icl::core::Line32f::sample | ( | std::vector< int > & | xs, |
std::vector< int > & | ys, | ||
const utils::Rect & | limits = utils::Rect::null |
||
) | const |
samples this line from start to end point regarding the given limiting rect
This function works essentially like the above function. In this case, the result is not returned, but it is stored into the given vector references.
xs | destination vector for x-coordinates (filled using push_back, so it is not cleared before it is filled) |
ys | as xs but for the y-coordinates |
limits | (see above) |
void icl::core::Line32f::swap | ( | ) | [inline] |
swaps the lines start and end point internally
end point of this line
const Line32f icl::core::Line32f::null [static] |
Null line of length 0 with and and end point 0.
start point of this line