#include <points.h>
|
FCOORD | operator! (const FCOORD &) |
| rotate 90 deg anti More...
|
|
FCOORD | operator- (const FCOORD &) |
| unary minus More...
|
|
FCOORD | operator+ (const FCOORD &, const FCOORD &) |
| add More...
|
|
FCOORD & | operator+= (FCOORD &, const FCOORD &) |
| add More...
|
|
FCOORD | operator- (const FCOORD &, const FCOORD &) |
| subtract More...
|
|
FCOORD & | operator-= (FCOORD &, const FCOORD &) |
| subtract More...
|
|
float | operator% (const FCOORD &, const FCOORD &) |
| scalar product More...
|
|
float | operator* (const FCOORD &, const FCOORD &) |
| cross product More...
|
|
FCOORD | operator* (const FCOORD &, float) |
| multiply More...
|
|
FCOORD | operator* (float, const FCOORD &) |
| multiply More...
|
|
FCOORD & | operator*= (FCOORD &, float) |
| multiply More...
|
|
FCOORD | operator/ (const FCOORD &, float) |
| divide More...
|
|
FCOORD & | operator/= (FCOORD &, float) |
| divide More...
|
|
Definition at line 188 of file points.h.
◆ FCOORD() [1/3]
◆ FCOORD() [2/3]
FCOORD::FCOORD |
( |
float |
xvalue, |
|
|
float |
yvalue |
|
) |
| |
|
inline |
constructor
- Parameters
-
xvalue | x value |
yvalue | y value |
Definition at line 196 of file points.h.
197 {
198 xcoord = xvalue;
199 ycoord = yvalue;
200 }
◆ FCOORD() [3/3]
FCOORD::FCOORD |
( |
ICOORD |
icoord | ) |
|
|
inline |
◆ angle()
float FCOORD::angle |
( |
| ) |
const |
|
inline |
find angle
Definition at line 247 of file points.h.
247 {
248 return std::atan2(ycoord, xcoord);
249 }
◆ angle_from_direction()
double FCOORD::angle_from_direction |
( |
uint8_t |
direction | ) |
|
|
static |
Definition at line 126 of file points.cpp.
126 {
127 return direction * M_PI / 128.0 - M_PI;
128}
◆ binary_angle_plus_pi()
uint8_t FCOORD::binary_angle_plus_pi |
( |
double |
angle | ) |
|
|
static |
Definition at line 121 of file points.cpp.
121 {
123}
int IntCastRounded(double x)
◆ from_direction()
void FCOORD::from_direction |
( |
uint8_t |
direction | ) |
|
Definition at line 112 of file points.cpp.
112 {
114 xcoord = cos(radians);
115 ycoord = sin(radians);
116}
static double angle_from_direction(uint8_t direction)
◆ length()
float FCOORD::length |
( |
| ) |
const |
|
inline |
find length
Definition at line 228 of file points.h.
228 {
230 }
float sqlength() const
find sq length
◆ nearest_pt_on_line()
FCOORD FCOORD::nearest_pt_on_line |
( |
const FCOORD & |
line_point, |
|
|
const FCOORD & |
dir_vector |
|
) |
| const |
Definition at line 133 of file points.cpp.
134 {
135 FCOORD point_vector(*
this - line_point);
136
137
138
139
140 double lambda = point_vector % dir_vector / dir_vector.
sqlength();
141 return line_point + (dir_vector * lambda);
142}
◆ normalise()
bool FCOORD::normalise |
( |
| ) |
|
Convert to unit vec.
Definition at line 29 of file points.cpp.
29 {
31
32 if (len < 0.0000000001) {
33 return false;
34 }
35 xcoord /= len;
36 ycoord /= len;
37 return true;
38}
float length() const
find length
◆ operator!=()
test inequality
Definition at line 278 of file points.h.
278 {
279 return xcoord != other.xcoord || ycoord != other.ycoord;
280 }
◆ operator==()
bool FCOORD::operator== |
( |
const FCOORD & |
other | ) |
|
|
inline |
test equality
Definition at line 274 of file points.h.
274 {
275 return xcoord == other.xcoord && ycoord == other.ycoord;
276 }
◆ pt_to_pt_dist()
float FCOORD::pt_to_pt_dist |
( |
const FCOORD & |
pt | ) |
const |
|
inline |
Distance between pts.
Definition at line 242 of file points.h.
242 {
244 }
float pt_to_pt_sqdist(const FCOORD &pt) const
sq dist between pts
◆ pt_to_pt_sqdist()
float FCOORD::pt_to_pt_sqdist |
( |
const FCOORD & |
pt | ) |
const |
|
inline |
sq dist between pts
Definition at line 233 of file points.h.
233 {
235
236 gap.xcoord = xcoord - pt.xcoord;
237 gap.ycoord = ycoord - pt.ycoord;
239 }
◆ rotate()
void FCOORD::rotate |
( |
const FCOORD |
vec | ) |
|
|
inline |
rotate
- Parameters
-
Definition at line 763 of file points.h.
764 {
765 float tmp;
766
767 tmp = xcoord * vec.
x () - ycoord * vec.
y ();
768 ycoord = ycoord * vec.
x () + xcoord * vec.
y ();
769 xcoord = tmp;
770}
◆ set_x()
void FCOORD::set_x |
( |
float |
xin | ) |
|
|
inline |
rewrite function
Definition at line 214 of file points.h.
214 {
215 xcoord = xin;
216 }
◆ set_y()
void FCOORD::set_y |
( |
float |
yin | ) |
|
|
inline |
rewrite function
Definition at line 218 of file points.h.
218 {
219 ycoord = yin;
220 }
◆ sqlength()
float FCOORD::sqlength |
( |
| ) |
const |
|
inline |
find sq length
Definition at line 223 of file points.h.
223 {
224 return xcoord * xcoord + ycoord * ycoord;
225 }
◆ to_direction()
uint8_t FCOORD::to_direction |
( |
| ) |
const |
Definition at line 108 of file points.cpp.
108 {
110}
float angle() const
find angle
static uint8_t binary_angle_plus_pi(double angle)
◆ unrotate()
void FCOORD::unrotate |
( |
const FCOORD & |
vec | ) |
|
|
inline |
Definition at line 772 of file points.h.
772 {
774}
FCOORD()=default
empty constructor
void rotate(const FCOORD vec)
◆ x()
float FCOORD::x |
( |
| ) |
const |
|
inline |
Definition at line 207 of file points.h.
207 {
208 return xcoord;
209 }
◆ y()
float FCOORD::y |
( |
| ) |
const |
|
inline |
Definition at line 210 of file points.h.
210 {
211 return ycoord;
212 }
◆ operator!
rotate 90 deg anti
Definition at line 553 of file points.h.
555 {
557
558 result.xcoord = -src.ycoord;
559 result.ycoord = src.xcoord;
560 return result;
561}
◆ operator%
scalar product
Definition at line 657 of file points.h.
659 {
660 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
661}
◆ operator* [1/3]
cross product
Definition at line 670 of file points.h.
672 {
673 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
674}
◆ operator* [2/3]
multiply
Definition at line 683 of file points.h.
685 {
687
688 result.xcoord = op1.xcoord * scale;
689 result.ycoord = op1.ycoord * scale;
690 return result;
691}
◆ operator* [3/3]
multiply
Definition at line 694 of file points.h.
697 {
699
700 result.xcoord = op1.xcoord * scale;
701 result.ycoord = op1.ycoord * scale;
702 return result;
703}
◆ operator*=
multiply
Definition at line 713 of file points.h.
715 {
716 op1.xcoord *= scale;
717 op1.ycoord *= scale;
718 return op1;
719}
◆ operator+
add
Definition at line 589 of file points.h.
591 {
593
594 sum.xcoord = op1.xcoord + op2.xcoord;
595 sum.ycoord = op1.ycoord + op2.ycoord;
596 return sum;
597}
◆ operator+=
add
Definition at line 607 of file points.h.
609 {
610 op1.xcoord += op2.xcoord;
611 op1.ycoord += op2.ycoord;
612 return op1;
613}
◆ operator- [1/2]
unary minus
Definition at line 571 of file points.h.
573 {
575
576 result.xcoord = -src.xcoord;
577 result.ycoord = -src.ycoord;
578 return result;
579}
◆ operator- [2/2]
subtract
Definition at line 623 of file points.h.
625 {
627
628 sum.xcoord = op1.xcoord - op2.xcoord;
629 sum.ycoord = op1.ycoord - op2.ycoord;
630 return sum;
631}
◆ operator-=
subtract
Definition at line 641 of file points.h.
643 {
644 op1.xcoord -= op2.xcoord;
645 op1.ycoord -= op2.ycoord;
646 return op1;
647}
◆ operator/
divide
Definition at line 729 of file points.h.
731 {
734 result.xcoord = op1.xcoord / scale;
735 result.ycoord = op1.ycoord / scale;
736 return result;
737}
◆ operator/=
divide
Definition at line 747 of file points.h.
749 {
751 op1.xcoord /= scale;
752 op1.ycoord /= scale;
753 return op1;
754}
The documentation for this class was generated from the following files: