2D point or vector
More...
#include <cxy.h>
|
|
| cxy (double X, double Y) |
| |
|
| cxy (const cxy &xy) |
| |
| cxy | vect (const cxy &other) const |
| | vector from this point to other More...
|
| |
| double | dist2 (const cxy &other) const |
| | distance squared from this point to other More...
|
| |
|
double | tclosest (const cxy &end1, const cxy &end2) const |
| |
|
cxy | closest (const cxy &end1, const cxy &end2) const |
| |
| double | dis2toline (const cxy &end1, const cxy &end2) const |
| | distance squared from this point to nearest point on line segment More...
|
| |
|
bool | isInside (const std::vector< cxy > &polygon) const |
| | true if point inside polygon
|
| |
|
bool | isValid () const |
| |
|
void | invalidate () |
| |
|
void | zoom (float ratio) |
| |
|
bool | operator== (const cxy &other) const |
| |
|
cxy | operator+ (const cxy &other) const |
| |
|
cxy | operator- (const cxy &other) const |
| |
|
cxy & | operator*= (float s) |
| |
|
cxy & | operator*= (const cxy &other) |
| |
|
cxy & | operator+= (const cxy &other) |
| |
|
cxy & | operator/= (float s) |
| |
|
|
static cxy | enclosingWidthHeight (const std::vector< cxy > &polygon) |
| |
| static bool | isIntersection (cxy &p, const cxy &a, const cxy &b, const cxy &c, const cxy &d) |
| | true if line segments intersect More...
|
| |
|
static bool | isIntersect (cxy &p1, cxy &q1, cxy &p2, cxy &q2) |
| |
| static double | angle (const cxy &a, const cxy &b, const cxy &c, const cxy &d) |
| | angle between line segments, radians More...
|
| |
| static double | clockwise (const cxy &a, const cxy &b, const cxy &c) |
| | clockwise turn going from a to b to c, radians More...
|
| |
|
|
std::ostream & | operator<< (std::ostream &os, cxy p) |
| |
◆ angle()
| static double cxy::angle |
( |
const cxy & |
a, |
|
|
const cxy & |
b, |
|
|
const cxy & |
c, |
|
|
const cxy & |
d |
|
) |
| |
|
inlinestatic |
angle between line segments, radians
- Parameters
-
| a,b | line segment |
| c,d | line segment |
- Returns
- angle in radians
◆ clockwise()
| static double cxy::clockwise |
( |
const cxy & |
a, |
|
|
const cxy & |
b, |
|
|
const cxy & |
c |
|
) |
| |
|
inlinestatic |
clockwise turn going from a to b to c, radians
- Parameters
-
- Returns
- angle in radians
◆ dis2toline()
| double cxy::dis2toline |
( |
const cxy & |
end1, |
|
|
const cxy & |
end2 |
|
) |
| const |
|
inline |
distance squared from this point to nearest point on line segment
- Parameters
-
| end1 | line segment endpoint |
| end2 | line segment endpoint |
- Returns
◆ dist2()
| double cxy::dist2 |
( |
const cxy & |
other | ) |
const |
|
inline |
distance squared from this point to other
- Parameters
-
- Returns
◆ isIntersection()
| static bool cxy::isIntersection |
( |
cxy & |
p, |
|
|
const cxy & |
a, |
|
|
const cxy & |
b, |
|
|
const cxy & |
c, |
|
|
const cxy & |
d |
|
) |
| |
|
inlinestatic |
true if line segments intersect
- Parameters
-
| [out] | p | point of intersection |
| [in] | a,b | line segment |
| [in] | c,d | line segment |
- Returns
- true if line segments intersect
intersection point
double det = A1 * B2 - A2 * B1
if (det == 0) {
Lines are parallel } else { double x = (B2 * C1 - B1 * C2) / det double y = (A1 * C2 - A2 * C1) / det }
◆ vect()
| cxy cxy::vect |
( |
const cxy & |
other | ) |
const |
|
inline |
vector from this point to other
- Parameters
-
- Returns
The documentation for this class was generated from the following file: