#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 189 of file points.h.
◆ FCOORD() [1/3]
tesseract::FCOORD::FCOORD |
( |
| ) |
|
|
default |
◆ FCOORD() [2/3]
tesseract::FCOORD::FCOORD |
( |
float |
xvalue, |
|
|
float |
yvalue |
|
) |
| |
|
inline |
constructor
- Parameters
-
xvalue | x value |
yvalue | y value |
Definition at line 196 of file points.h.
196 {
197 xcoord = xvalue;
198 ycoord = yvalue;
199 }
◆ FCOORD() [3/3]
tesseract::FCOORD::FCOORD |
( |
ICOORD |
icoord | ) |
|
|
inline |
Definition at line 200 of file points.h.
201 {
202 xcoord = icoord.xcoord;
203 ycoord = icoord.ycoord;
204 }
◆ angle()
float tesseract::FCOORD::angle |
( |
| ) |
const |
|
inline |
find angle
Definition at line 246 of file points.h.
246 {
247 return std::atan2(ycoord, xcoord);
248 }
◆ angle_from_direction()
double tesseract::FCOORD::angle_from_direction |
( |
uint8_t |
direction | ) |
|
|
static |
Definition at line 141 of file points.cpp.
141 {
142 return direction * M_PI / 128.0 - M_PI;
143}
◆ binary_angle_plus_pi()
uint8_t tesseract::FCOORD::binary_angle_plus_pi |
( |
double |
angle | ) |
|
|
static |
Definition at line 136 of file points.cpp.
136 {
138}
int IntCastRounded(double x)
◆ from_direction()
void tesseract::FCOORD::from_direction |
( |
uint8_t |
direction | ) |
|
Definition at line 127 of file points.cpp.
127 {
129 xcoord = cos(radians);
130 ycoord = sin(radians);
131}
static double angle_from_direction(uint8_t direction)
◆ length()
float tesseract::FCOORD::length |
( |
| ) |
const |
|
inline |
find length
Definition at line 227 of file points.h.
227 {
229 }
float sqlength() const
find sq length
◆ nearest_pt_on_line()
FCOORD tesseract::FCOORD::nearest_pt_on_line |
( |
const FCOORD & |
line_point, |
|
|
const FCOORD & |
dir_vector |
|
) |
| const |
Definition at line 148 of file points.cpp.
148 {
149 FCOORD point_vector(*
this - line_point);
150
151
152
153
154 double lambda = point_vector % dir_vector / dir_vector.sqlength();
155 return line_point + (dir_vector * lambda);
156}
FCOORD()=default
empty constructor
◆ normalise()
bool tesseract::FCOORD::normalise |
( |
| ) |
|
Convert to unit vec.
Definition at line 32 of file points.cpp.
32 {
34
35 if (len < 0.0000000001) {
36 return false;
37 }
38 xcoord /= len;
39 ycoord /= len;
40 return true;
41}
float length() const
find length
◆ operator!=()
test inequality
Definition at line 276 of file points.h.
276 {
277 return xcoord != other.xcoord || ycoord != other.ycoord;
278 }
◆ operator==()
bool tesseract::FCOORD::operator== |
( |
const FCOORD & |
other | ) |
const |
|
inline |
test equality
Definition at line 272 of file points.h.
272 {
273 return xcoord == other.xcoord && ycoord == other.ycoord;
274 }
◆ pt_to_pt_dist()
float tesseract::FCOORD::pt_to_pt_dist |
( |
const FCOORD & |
pt | ) |
const |
|
inline |
Distance between pts.
Definition at line 241 of file points.h.
241 {
243 }
float pt_to_pt_sqdist(const FCOORD &pt) const
sq dist between pts
◆ pt_to_pt_sqdist()
float tesseract::FCOORD::pt_to_pt_sqdist |
( |
const FCOORD & |
pt | ) |
const |
|
inline |
sq dist between pts
Definition at line 232 of file points.h.
232 {
234
235 gap.xcoord = xcoord - pt.xcoord;
236 gap.ycoord = ycoord - pt.ycoord;
237 return gap.sqlength();
238 }
◆ rotate()
void tesseract::FCOORD::rotate |
( |
const FCOORD |
vec | ) |
|
|
inline |
rotate
- Parameters
-
Definition at line 712 of file points.h.
713 {
714 float tmp;
715
716 tmp = xcoord * vec.x() - ycoord * vec.y();
717 ycoord = ycoord * vec.x() + xcoord * vec.y();
718 xcoord = tmp;
719}
◆ set_x()
void tesseract::FCOORD::set_x |
( |
float |
xin | ) |
|
|
inline |
rewrite function
Definition at line 213 of file points.h.
213 {
214 xcoord = xin;
215 }
◆ set_y()
void tesseract::FCOORD::set_y |
( |
float |
yin | ) |
|
|
inline |
rewrite function
Definition at line 217 of file points.h.
217 {
218 ycoord = yin;
219 }
◆ sqlength()
float tesseract::FCOORD::sqlength |
( |
| ) |
const |
|
inline |
find sq length
Definition at line 222 of file points.h.
222 {
223 return xcoord * xcoord + ycoord * ycoord;
224 }
◆ to_direction()
uint8_t tesseract::FCOORD::to_direction |
( |
| ) |
const |
Definition at line 123 of file points.cpp.
123 {
125}
float angle() const
find angle
static uint8_t binary_angle_plus_pi(double angle)
◆ unrotate()
void tesseract::FCOORD::unrotate |
( |
const FCOORD & |
vec | ) |
|
|
inline |
Definition at line 721 of file points.h.
721 {
723}
void rotate(const FCOORD vec)
◆ x()
float tesseract::FCOORD::x |
( |
| ) |
const |
|
inline |
Definition at line 206 of file points.h.
206 {
207 return xcoord;
208 }
◆ y()
float tesseract::FCOORD::y |
( |
| ) |
const |
|
inline |
Definition at line 209 of file points.h.
209 {
210 return ycoord;
211 }
◆ operator!
rotate 90 deg anti
Definition at line 524 of file points.h.
526 {
528
529 result.xcoord = -src.ycoord;
530 result.ycoord = src.xcoord;
531 return result;
532}
◆ operator%
scalar product
Definition at line 616 of file points.h.
618 {
619 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
620}
◆ operator* [1/3]
cross product
Definition at line 628 of file points.h.
630 {
631 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
632}
◆ operator* [2/3]
multiply
Definition at line 640 of file points.h.
642 {
644
645 result.xcoord = op1.xcoord * scale;
646 result.ycoord = op1.ycoord * scale;
647 return result;
648}
◆ operator* [3/3]
multiply
Definition at line 650 of file points.h.
653 {
655
656 result.xcoord = op1.xcoord * scale;
657 result.ycoord = op1.ycoord * scale;
658 return result;
659}
◆ operator*=
multiply
Definition at line 667 of file points.h.
669 {
670 op1.xcoord *= scale;
671 op1.ycoord *= scale;
672 return op1;
673}
◆ operator+
add
Definition at line 556 of file points.h.
558 {
560
561 sum.xcoord = op1.xcoord + op2.xcoord;
562 sum.ycoord = op1.ycoord + op2.ycoord;
563 return sum;
564}
◆ operator+=
add
Definition at line 572 of file points.h.
574 {
575 op1.xcoord += op2.xcoord;
576 op1.ycoord += op2.ycoord;
577 return op1;
578}
◆ operator- [1/2]
unary minus
Definition at line 540 of file points.h.
542 {
544
545 result.xcoord = -src.xcoord;
546 result.ycoord = -src.ycoord;
547 return result;
548}
◆ operator- [2/2]
subtract
Definition at line 586 of file points.h.
588 {
590
591 sum.xcoord = op1.xcoord - op2.xcoord;
592 sum.ycoord = op1.ycoord - op2.ycoord;
593 return sum;
594}
◆ operator-=
subtract
Definition at line 602 of file points.h.
604 {
605 op1.xcoord -= op2.xcoord;
606 op1.ycoord -= op2.ycoord;
607 return op1;
608}
◆ operator/
divide
Definition at line 681 of file points.h.
683 {
686 result.xcoord = op1.xcoord / scale;
687 result.ycoord = op1.ycoord / scale;
688 return result;
689}
◆ operator/=
divide
Definition at line 697 of file points.h.
699 {
701 op1.xcoord /= scale;
702 op1.ycoord /= scale;
703 return op1;
704}
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/points.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/points.cpp