#include <HomgOperator2D.h>
Static Public Member Functions | |
static double | dot (const Homg2D &a, const Homg2D &b) |
Dot product of two Homg2Ds. | |
static void | cross (const Homg2D &a, const Homg2D &b, Homg2D *a_cross_b) |
Cross product of two Homg2Ds. | |
static void | unitize (Homg2D *a) |
Normalize Homg2D to unit magnitude. | |
static double | angle_between_oriented_lines (const HomgLine2D &line1, const HomgLine2D &line2) |
Get the angle between two lines. | |
static double | abs_angle (const HomgLine2D &line1, const HomgLine2D &line2) |
Get the 0 to pi/2 angle between two lines. | |
static double | distance_squared (const HomgPoint2D &point1, const HomgPoint2D &point2) |
Get the square of the 2D distance between the two points. | |
static double | distance_squared (const HomgLineSeg2D &lineseg, const HomgLine2D &line) |
Return the distance of a line segment to a line. | |
static double | distance_squared (const HomgLineSeg2D &lineseg, const HomgPoint2D &line) |
Return the "Schmid distance" from a point to a line segment. | |
static double | distance (const HomgLineSeg2D &lineseg1, const HomgLineSeg2D &lineseg2, double OVERLAP_THRESH) |
Return distance between line segments. | |
static double | perp_dist_squared (const HomgPoint2D &point, const HomgLine2D &line) |
Get the square of the perpendicular distance to a line. | |
static bool | is_within_distance (const HomgPoint2D &p1, const HomgPoint2D &p2, double d) |
static double | line_angle (const HomgLine2D &line) |
Get the anticlockwise angle between a line and the x axis. | |
static HomgLine2D | join (const HomgPoint2D &point1, const HomgPoint2D &point2) |
Get the line through two points (the cross-product). | |
static HomgLine2D | join_oriented (const HomgPoint2D &point1, const HomgPoint2D &point2) |
Get the line through two points (the cross-product). | |
static HomgPoint2D | intersection (const HomgLine2D &line1, const HomgLine2D &line2) |
Get the intersection point of two lines (the cross-product). | |
static HomgLine2D | perp_line_through_point (const HomgLine2D &line, const HomgPoint2D &point) |
Get the perpendicular line to line which passes through point. | |
static HomgPoint2D | perp_projection (const HomgLine2D &line, const HomgPoint2D &point) |
Get the perpendicular projection of point onto line. | |
static HomgPoint2D | midpoint (const HomgPoint2D &p1, const HomgPoint2D &p2) |
Return the midpoint of the line joining two homogeneous points. | |
static HomgLineSeg2D | clip_line_to_lineseg (const HomgLine2D &line, double x0, double y0, double x1, double y1) |
Clip line to lineseg. | |
static HomgPoint2D | lines_to_point (const vcl_vector< HomgLine2D > &) |
Intersect a set of 2D lines to find the least-square point of intersection. | |
static double | CrossRatio (const Homg2D &p1, const Homg2D &p2, const Homg2D &p3, const Homg2D &p4) |
Calculates the crossratio of four collinear points p1, p2, p3 and p4. | |
static Homg2D | Conjugate (const Homg2D &a, const Homg2D &b, const Homg2D &c, double cr) |
Conjugate point of three given collinear points. |
Definition at line 22 of file HomgOperator2D.h.
double HomgOperator2D::abs_angle | ( | const HomgLine2D & | line1, |
const HomgLine2D & | line2 | ||
) | [static] |
Get the 0 to pi/2 angle between two lines.
Definition at line 214 of file HomgOperator2D.cxx.
double HomgOperator2D::angle_between_oriented_lines | ( | const HomgLine2D & | line1, |
const HomgLine2D & | line2 | ||
) | [static] |
Get the angle between two lines.
Although homogeneous coordinates are only defined up to scale, here it is assumed that a line with homogeneous coordinates (m) is at 180 degrees to a line (-m), and this is why the term "oriented_line" is used. However, the overall scale (apart from sign) is not significant.
Definition at line 238 of file HomgOperator2D.cxx.
HomgLineSeg2D HomgOperator2D::clip_line_to_lineseg | ( | const HomgLine2D & | line, |
double | x0, | ||
double | y0, | ||
double | x1, | ||
double | y1 | ||
) | [static] |
Clip line to lineseg.
The infinite line is clipped against the viewport with lower left corner (x0,y0) and upper right corner (x1,y1)
Definition at line 397 of file HomgOperator2D.cxx.
Homg2D HomgOperator2D::Conjugate | ( | const Homg2D & | a, |
const Homg2D & | b, | ||
const Homg2D & | c, | ||
double | cr | ||
) | [static] |
Conjugate point of three given collinear points.
If cross ratio cr is given (default: -1), the generalized conjugate point returned is such that ((x1,x2;x3,answer)) = cr.
Definition at line 455 of file HomgOperator2D.cxx.
Cross product of two Homg2Ds.
Definition at line 27 of file HomgOperator2D.cxx.
double HomgOperator2D::CrossRatio | ( | const Homg2D & | a, |
const Homg2D & | b, | ||
const Homg2D & | c, | ||
const Homg2D & | d | ||
) | [static] |
Calculates the crossratio of four collinear points p1, p2, p3 and p4.
This number is projectively invariant, and it is the coordinate of p4 in the reference frame where p2 is the origin (coordinate 0), p3 is the unity (coordinate 1) and p1 is the point at infinity. This cross ratio is often denoted as ((p1, p2; p3, p4)) (which also equals ((p3, p4; p1, p2)) or ((p2, p1; p4, p3)) or ((p4, p3; p2, p1)) ) and is calculated as p1 - p3 p2 - p3 (p1-p3)(p2-p4) ------- : -------- = -------------- p1 - p4 p2 - p4 (p1-p4)(p2-p3)
In principle, any single nonhomogeneous coordinate from the four points can be used as parameters for CrossRatio (but of course the same for all points). The most reliable answer will be obtained when the coordinate with the largest spacing is used, i.e., the one with smallest slope.
Definition at line 437 of file HomgOperator2D.cxx.
double HomgOperator2D::distance | ( | const HomgLineSeg2D & | lineseg1, |
const HomgLineSeg2D & | lineseg2, | ||
double | OVERLAP_THRESH | ||
) | [static] |
Return distance between line segments.
Definition at line 129 of file HomgOperator2D.cxx.
double HomgOperator2D::distance_squared | ( | const HomgPoint2D & | point1, |
const HomgPoint2D & | point2 | ||
) | [static] |
Get the square of the 2D distance between the two points.
Definition at line 75 of file HomgOperator2D.cxx.
double HomgOperator2D::distance_squared | ( | const HomgLineSeg2D & | segment, |
const HomgLine2D & | line | ||
) | [static] |
Return the distance of a line segment to a line.
This is defined as the maximum of the distances of the two endpoints to the line.
Definition at line 121 of file HomgOperator2D.cxx.
double HomgOperator2D::distance_squared | ( | const HomgLineSeg2D & | lineseg, |
const HomgPoint2D & | p | ||
) | [static] |
Return the "Schmid distance" from a point to a line segment.
This is the distance to the closest point on the segment, be it endpoint or interior. UNTESTED.
Definition at line 175 of file HomgOperator2D.cxx.
Dot product of two Homg2Ds.
Definition at line 44 of file HomgOperator2D.cxx.
HomgPoint2D HomgOperator2D::intersection | ( | const HomgLine2D & | line1, |
const HomgLine2D & | line2 | ||
) | [static] |
Get the intersection point of two lines (the cross-product).
Definition at line 298 of file HomgOperator2D.cxx.
static bool HomgOperator2D::is_within_distance | ( | const HomgPoint2D & | p1, |
const HomgPoint2D & | p2, | ||
double | d | ||
) | [inline, static] |
Definition at line 38 of file HomgOperator2D.h.
HomgLine2D HomgOperator2D::join | ( | const HomgPoint2D & | point1, |
const HomgPoint2D & | point2 | ||
) | [static] |
Get the line through two points (the cross-product).
Definition at line 262 of file HomgOperator2D.cxx.
HomgLine2D HomgOperator2D::join_oriented | ( | const HomgPoint2D & | point1, |
const HomgPoint2D & | point2 | ||
) | [static] |
Get the line through two points (the cross-product).
In this case, we assume that the points are oriented, and ensure the cross is computed with positive point omegas.
Definition at line 275 of file HomgOperator2D.cxx.
double HomgOperator2D::line_angle | ( | const HomgLine2D & | line | ) | [static] |
Get the anticlockwise angle between a line and the x axis.
Definition at line 207 of file HomgOperator2D.cxx.
HomgPoint2D HomgOperator2D::lines_to_point | ( | const vcl_vector< HomgLine2D > & | lines | ) | [static] |
Intersect a set of 2D lines to find the least-square point of intersection.
This finds the point that minimizes , where is the matrix whose rows are the lines. The current implementation uses the vnl_scatter_3x3<double> class from vnl to accumulate and compute the nullspace of .
Definition at line 380 of file HomgOperator2D.cxx.
HomgPoint2D HomgOperator2D::midpoint | ( | const HomgPoint2D & | p1, |
const HomgPoint2D & | p2 | ||
) | [static] |
Return the midpoint of the line joining two homogeneous points.
Definition at line 342 of file HomgOperator2D.cxx.
double HomgOperator2D::perp_dist_squared | ( | const HomgPoint2D & | point, |
const HomgLine2D & | line | ||
) | [static] |
Get the square of the perpendicular distance to a line.
This is just the homogeneous form of the familiar : \[ d = {(l^ p)}{p_z{l_x^2 + l_y^2}} \] If either the point or the line are at infinity an error message is printed and Homg::infinity is returned.
Definition at line 106 of file HomgOperator2D.cxx.
HomgLine2D HomgOperator2D::perp_line_through_point | ( | const HomgLine2D & | line, |
const HomgPoint2D & | point | ||
) | [static] |
Get the perpendicular line to line which passes through point.
Params are line and point . Then the cross product of and the line's direction , called satisfies
(perpendicular condition) and
(incidence condition).
Definition at line 316 of file HomgOperator2D.cxx.
HomgPoint2D HomgOperator2D::perp_projection | ( | const HomgLine2D & | line, |
const HomgPoint2D & | point | ||
) | [static] |
Get the perpendicular projection of point onto line.
Definition at line 331 of file HomgOperator2D.cxx.
void HomgOperator2D::unitize | ( | Homg2D * | a | ) | [static] |
Normalize Homg2D to unit magnitude.
Definition at line 59 of file HomgOperator2D.cxx.