|
CartoType API
|
#include <cartotype_arithmetic.h>
Static Public Member Functions | |
| static CT_IMPORT int32 | MulDiv (int32 aA, int32 aB, int32 aC) |
| static CT_IMPORT void | MulTo64 (int32 aX, int32 aY, int64 &aZ) |
| static CT_IMPORT void | Add64 (int64 aX, int64 aY, int64 &aZ) |
| static CT_IMPORT int32 | Div64By32 (int64 aX, int32 aY) |
| static CT_IMPORT int32 | DegreesToRadians (int32 aX) |
| static CT_IMPORT int32 | RadiansToDegrees (int32 aX) |
| static CT_IMPORT TResult | LineIntersection (double &aIntersectionX, double &aIntersectionY, double aStart1X, double aStart1Y, double aEnd1X, double aEnd1Y, double aStart2X, double aStart2Y, double aEnd2X, double aEnd2Y, TIntersectionType *aIntersectionType=NULL) |
| static CT_IMPORT TResult | LineIntersection (TPoint &aIntersection, const TPoint &aStart1, const TPoint &aEnd1, const TPoint &aStart2, const TPoint &aEnd2, TIntersectionType *aIntersectionType=NULL) |
| static CT_IMPORT void | LineBisection (TPoint &aBisectStart, TPoint &aBisectEnd, const TPoint &aStart1, const TPoint &aEnd1, const TPoint &aStart2, const TPoint &aEnd2) |
| static CT_IMPORT bool | LineSegmentContainsPoint (const TPoint &aStart, const TPoint &aEnd, const TPoint &aPoint) |
| static CT_IMPORT double | DistanceSquaredFromLineSegmentToPoint (double aStartX, double aStartY, double aEndX, double aEndY, double aPointX, double aPointY, double *aNearestPointX, double *aNearestPointY) |
| static CT_IMPORT void | GetLineTangent (double aX1, double aY1, double aX2, double aY2, double aDistance, double &aPointX, double &aPointY) |
| static int32 | Min (int32 aA, int32 aB) |
| static int32 | Max (int32 aA, int32 aB) |
| static int32 | Abs (int32 aValue) |
| static CT_IMPORT int32 | Sqrt (int32 aValue) |
| static CT_IMPORT int32 | CubeRoot (int32 aValue) |
| static int32 | Round (double aValue) |
| static double | AngleDiff (double aP, double aQ) |
A wrapper for static arithmetic functions.
| static int32 CartoType::Arithmetic::Abs | ( | int32 | aValue | ) | [inline, static] |
Return absolute value of number.
Add aX and Ay to give the 64-bit result aZ.
| static double CartoType::Arithmetic::AngleDiff | ( | double | aP, |
| double | aQ | ||
| ) | [inline, static] |
Return the difference between two angles in radians. The result, expressed in radians, is the angular distance swept out when moving the angle to aAngle by the shortest route, and thus is in the range -pi ... pi.
| CT_EXPORT int32 Arithmetic::CubeRoot | ( | int32 | aValue | ) | [static] |
Return the nearest integer at or below the cube root of aValue. Return 0 for arguments <= 0.
| CT_EXPORT int32 Arithmetic::DegreesToRadians | ( | int32 | aX | ) | [static] |
Convert the 32 bit integer value aX from degrees to radians.
| CT_EXPORT double Arithmetic::DistanceSquaredFromLineSegmentToPoint | ( | double | aStartX, |
| double | aStartY, | ||
| double | aEndX, | ||
| double | aEndY, | ||
| double | aPointX, | ||
| double | aPointY, | ||
| double * | aNearestPointX, | ||
| double * | aNearestPointY | ||
| ) | [static] |
Calculate the square of the distance from a point to a line segment. If aNearestPointX and aNearestPointY are non-null, also return the coordinates of the nearest point on the line to the point.
| CT_EXPORT int32 Arithmetic::Div64By32 | ( | int64 | aX, |
| int32 | aY | ||
| ) | [static] |
Divide the 64-bit value aX by the 32-bit value aY and return the 32-bit result.
| CT_EXPORT void Arithmetic::GetLineTangent | ( | double | aX1, |
| double | aY1, | ||
| double | aX2, | ||
| double | aY2, | ||
| double | aDistance, | ||
| double & | aPointX, | ||
| double & | aPointY | ||
| ) | [static] |
Return a point at a certain distance along the line (aX1,aY1) - (aX2,aY2) in (aPointX,aPointY). aDistance can be negative, or beyond the end of the line. In these cases the line is extended in the same direction.
| CT_EXPORT void Arithmetic::LineBisection | ( | TPoint & | aBisectStart, |
| TPoint & | aBisectEnd, | ||
| const TPoint & | aStart1, | ||
| const TPoint & | aEnd1, | ||
| const TPoint & | aStart2, | ||
| const TPoint & | aEnd2 | ||
| ) | [static] |
Get the line bisecting the angle between two line segments.
| CT_EXPORT TResult Arithmetic::LineIntersection | ( | double & | aIntersectionX, |
| double & | aIntersectionY, | ||
| double | aStart1X, | ||
| double | aStart1Y, | ||
| double | aEnd1X, | ||
| double | aEnd1Y, | ||
| double | aStart2X, | ||
| double | aStart2Y, | ||
| double | aEnd2X, | ||
| double | aEnd2Y, | ||
| TIntersectionType * | aIntersectionType = NULL |
||
| ) | [static] |
Get the intersection of two infinite lines. If the lines don't intersect, set the intersection to aStart1 and return KErrorParallelLines.
If aIntersectionType is non-null set it correctly.
The algorithm is described at http://astronomy.swin.edu.au/pbourke/geometry/lineline2d.
| CT_EXPORT TResult Arithmetic::LineIntersection | ( | TPoint & | aIntersection, |
| const TPoint & | aStart1, | ||
| const TPoint & | aEnd1, | ||
| const TPoint & | aStart2, | ||
| const TPoint & | aEnd2, | ||
| TIntersectionType * | aIntersectionType = NULL |
||
| ) | [static] |
Get the intersection of two infinite lines. If the lines don't intersect, set the intersection to aStart1 and return KErrorParallelLines.
If aIntersectionType is non-null set it correctly.
The algorithm is described at http://astronomy.swin.edu.au/pbourke/geometry/lineline2d.
| CT_EXPORT bool Arithmetic::LineSegmentContainsPoint | ( | const TPoint & | aStart, |
| const TPoint & | aEnd, | ||
| const TPoint & | aPoint | ||
| ) | [static] |
Determine whether a line segment contains the point, not in the sense of whether the point actually lies on the line, but whether a rectangle aligned with the coordinate system, defined by the two points aStart and aEnd. contains the point aPoint.
| static int32 CartoType::Arithmetic::Max | ( | int32 | aA, |
| int32 | aB | ||
| ) | [inline, static] |
Return maximum of two numbers.
| static int32 CartoType::Arithmetic::Min | ( | int32 | aA, |
| int32 | aB | ||
| ) | [inline, static] |
Return minimum of two numbers.
| CT_EXPORT int32 Arithmetic::MulDiv | ( | int32 | aA, |
| int32 | aB, | ||
| int32 | aC | ||
| ) | [static] |
Return (aA * aB) / aC.
| CT_EXPORT void Arithmetic::MulTo64 | ( | int32 | aX, |
| int32 | aY, | ||
| int64 & | aZ | ||
| ) | [static] |
Multiply aX and aY to give the 64-bit result aZ.
| CT_EXPORT int32 Arithmetic::RadiansToDegrees | ( | int32 | aX | ) | [static] |
Convert the 32 bit integer value aX from radians to degrees. Ignore overflows.
| static int32 CartoType::Arithmetic::Round | ( | double | aValue | ) | [inline, static] |
Rounds a floating-point value to the nearest integer. Does not use floor() because it is said to be slow on some platforms.
| CT_EXPORT int32 Arithmetic::Sqrt | ( | int32 | aValue | ) | [static] |
Return the nearest integer at or below the square root of aValue. Return 0 for arguments <= 0.
1.7.5.1