Macros | |
#define | mindiffangle_int(a, b, modulo) |
Minimum Absolute Difference between Two Angles, Fix Point (Macro). More... | |
Functions | |
F32 | Norm (point *a) |
Calculates the Euclidean Length of a Vector. More... | |
F32 | AngleP (point *v) |
Calculates the Angle of a Vector. More... | |
F32 | PointDistance (point *a, point *b) |
Calculates the Euclidean Distance between Two Points. More... | |
void | MidPoint (point *a, point *b, point *out) |
Calculates the Middle between Two Points. More... | |
void | VectorDifference (point *a, point *b, point *out) |
Calculates the Vector Difference of Two Points. More... | |
void | VectorScale (point *a, F32 scalar, point *out) |
Scales a Vector by a Value. More... | |
void | VectorSum (point *a, point *b, point *out) |
Calculates the Vector Sum of Two Points. More... | |
I32 | LineIntersection (vcline *a, vcline *b, point *out) |
Calculates the Intersection Point of Two Lines. More... | |
F32 | LineAngle (vcline *a, vcline *b) |
Calculates the Angle between Two Lines. More... | |
F32 | LineAngle2 (vcline *a, vcline *b) |
Calculates the Angle between Two Lines. More... | |
F32 | Angle (vcline *a) |
Calculates the Angle of a Line. More... | |
void | LineParallelD (F32 dist, vcline *l, vcline *out) |
Calculates the Line Parallel to l at Distance dist . More... | |
F32 | PointLineDistance (point *p, vcline *l) |
Calculates the Distance beween a Point and a Line. More... | |
void | PointLineProjection (point *p, vcline *l, point *out) |
Maps Point to nearest Point on Line. More... | |
void | LinePerpendicular (point *p, vcline *l, vcline *out) |
Calculates a Line perpendicualar to a given One through a Point. More... | |
void | LineParallel (point *p, vcline *l, vcline *out) |
Calculates a Line parallel to a given One through a Point. More... | |
void | LineTranslate (point *v, vcline *l, vcline *out) |
Translates a Line parallel by a Vector. More... | |
void | LineParameters (point *p1, point *p2, vcline *out) |
Calculates the Line Parameters using Two Points. More... | |
void | LineParametersA (point *p, F32 angle, vcline *out) |
Calculates the Line Parameters using a point and an angle. More... | |
void | LineFromSlopeInterceptForm (F32 mx, F32 b, vcline *out) |
Calculates a vcline from Line Slope Intercept Form. More... | |
void | LineNormal (point *p, F32 angle, vcline *out) |
Calculates the line through the point p perpendicular to angle . More... | |
void | affine_point_map (point *p, point *target_p, F32 a[2][2], F32 t[2]) |
Affine Transformation of a Point. More... | |
I32 | IntersectionPointsN (image *img, vcline *ln, point *p1, point *p2) |
Calculates Two Intersection Points between a Line and the Boundaries of an Image Variable. More... | |
I32 | IntersectionPoints (image *a, F32 cx, F32 cy, F32 b, I32 *X0, I32 *Y0, I32 *X1, I32 *Y1) |
Calculates Two Intersection Points between a Line and the Boundaries of an Image Variable. More... | |
I32 | IntersectionPointsWithRect (F32 cx, F32 cy, F32 b, F32 xMin, F32 yMin, F32 xMax, F32 yMax, F32 *X0, F32 *Y0, F32 *X1, F32 *Y1) |
Calculates Two Intersection Points between a Line and a Boundary Rectangle. More... | |
#define mindiffangle_int | ( | a, | |
b, | |||
modulo | |||
) |
The minimum absolute difference between the both given angles is returned modulo the given modulo
parameter.
a,b | angles as integer values. |
modulo | modulo as an integer value. |
This function calculates the norm or length of a vector in point representation and returns the result as a float value. The result is given by out
= sqrtf(( a->x)² + ( a->y)²).
This function calculates the angle between the horizontal x-axis and the vector v
given in point coordinates and returns the result in radiants.
A value of 0 is output for a horizontal vector pointing right. The result increases for a clockwise rotation up to a value of 2π (360deg) and is always positive.
The function calculates the Euclidean distance between two points and returns the result.
The function uses 2 points a
and b
to calculate the arithmetic middle right inbetween the points and outputs the result in point out
.
It is possible to use this function in place, i.e. the pointer out
may be identical to either a
or b
.
The function calculates the vector difference of two points and returns the result out
= a
- b
.
It is possible to use this function in place, i.e. the pointer out
may be identical to either a
or b
.
The function calculates the vector scaled by a given value and returns the result out
= a
* scale
.
It is possible to use this function in place, i.e. the pointer out
may be identical to in
.
The function calculates the vector sum of two points and returns the result out
= a
+ b
.
It is possible to use this function in place, i.e. the pointer out
may be identical to either a
or b
.
This function finds the intersection point of 2 lines given in the standard normal form .
ERR_SINGULAR | If Lines are Parallel. |
ERR_NONE | On Success. |
This function calculates the angle between two lines a
and b
given in vector normal form and returns the result in radiants: A value of 0 is output if both lines are parallel. In all other cases, the result is the angle that line a
must be rotated clockwise to be parallel to b
. The result increases for a clockwise rotation up to a value of π (180deg) and is always positive.
This function calculates the angle between two lines a
and b
and returns the result in radiants. A value of 0 is output if both lines are parallel. In all other cases, the result is the angle that line a
must be rotated clockwise to be parallel to b
. In contrast to function LineAngle(), the result covers a full range from -π (-180deg) to +π (180deg) and assumes that the lines are oriented.
This function calculates the angle between the horizontal x-axis and line a
given in vector normal form and returns the result in radiants. A value of 0 is output for a horizontal line. The result increases for a clockwise rotation up to a value of π (180deg) and is always positive.
calculates the line parallel to l
at distance dist
larger dist
means that the line is more distant to the origin.
It is possible to use this function in place, i.e. the pointer l
may be identical to out
.
dist | distance for parallel line |
l | reference line |
out | result line |
This function calculates the distance beween a point and a line and returns the result.
This function maps a point to a nearest point on a line. Nearest means: The euclidean distance between the points is minimal.
This function calculates a line perpendicualar to a given one through a point. The result is stored in out
.
It is possible to use this function in place, i.e. the pointer l
may be identical to out
.
This function calculates a line parallel to a given one through a point. The result is stored as out
.
It is possible to use this function in place, i.e. the pointer l
may be identical to out
.
This function translates a line by a vector given. The result is stored as out
.
The line parameters cx and cy must form a vector of norm 1 for this function to work properly.
It is possible to use this function in place, i.e. the pointer l
may be identical to out
.
This function calculates the line parameters for a line running through the two points p1
and p2
. If the two points are too close together, (distance < 5.0e-7), all line parameters will be set to 0.0.
This function calculates the line through the point p
with angle angle
p | point for line calculation |
angle | angle for line calculation, in degree |
out | result line |
The function transforms a line representation in slope intercept form known as: y = mx
* x + b
to the more universial representation used by vcline: out->cx * x + out->cy * y - out->b = 0.
mx,b | Slope Intercept Representation of Line. |
out | Line in Normal Form. |
This function calculates the line through the point p
NORMAL, i.e. perpendicular to angle
p | point for line calculation |
angle | angle for line calculation, in degree |
out | result line |
p | Point in Original Image (x, y). |
target_p | (Result) Target Point of p After Affine Transformation. |
a | 2D Transformation Matrix. |
t | 2D Translation Vector. |
This function calculates two intersection points between a line and the boundaries of an image variable given. The intersection points are calculated in the following order: Left, Right, Top, Bottom. The line is parameterized as vcline struct.
img | Pointer to Image Variable. |
ln | Line. |
p1 | Coordinates of First Intersection Point. |
p2 | Coordinates of Second Intersection Point. |
ERR_PARAM | If Less than 2 Points Found. |
ERR_NONE | On Success. |
I32 IntersectionPoints | ( | image * | a, |
float | cx, | ||
float | cy, | ||
float | b, | ||
I32 * | X0, | ||
I32 * | Y0, | ||
I32 * | X1, | ||
I32 * | Y1 | ||
) |
This function calculates two intersection points between a line and the boundaries of an image variable given. The intersection points are calculated in the following order: Left, Right, Top, Bottom. The line is parameterized in a normalized vector form as: (cx
* x) + (cy
* y) - b
= 0.
a | Pointer to Image Variable. |
cx,cy,b | Line Parameters. |
X0,Y0 | Coordinates of First Intersection Point. |
X1,Y1 | Coordinates of Second Intersection Point. |
ERR_PARAM | If Less than 2 Points Found. |
ERR_NONE | On Success. |
I32 IntersectionPointsWithRect | ( | float | cx, |
float | cy, | ||
float | b, | ||
F32 | xMin, | ||
F32 | yMin, | ||
F32 | xMax, | ||
F32 | yMax, | ||
F32 * | X0, | ||
F32 * | Y0, | ||
F32 * | X1, | ||
F32 * | Y1 | ||
) |
This function calculates two intersection points between a line and a boundary rectangle. The intersection points are calculated in the following order: Left, Right, Top, Bottom. The line is parameterized in a normalized vector form as: (cx
* x) + (cy
* y) - b
= 0.
xMin,yMin,xMax,yMax | Boundary rectangle. |
cx,cy,b | Line Parameters. |
X0,Y0 | Coordinates of First Intersection Point. |
X1,Y1 | Coordinates of Second Intersection Point. |
ERR_PARAM | If Less than 2 Points Found. |
ERR_NONE | On Success. |