tesseract 4.1.1
Loading...
Searching...
No Matches
points.h File Reference
#include <cmath>
#include <cstdio>
#include "elst.h"
#include "errcode.h"
#include "platform.h"

Go to the source code of this file.

Classes

class  ICOORD
 integer coordinate More...
 
class  ICOORDELT
 
class  FCOORD
 

Functions

ICOORD operator! (const ICOORD &src)
 
ICOORD operator- (const ICOORD &src)
 
ICOORD operator+ (const ICOORD &op1, const ICOORD &op2)
 
ICOORDoperator+= (ICOORD &op1, const ICOORD &op2)
 
ICOORD operator- (const ICOORD &op1, const ICOORD &op2)
 
ICOORDoperator-= (ICOORD &op1, const ICOORD &op2)
 
int32_t operator% (const ICOORD &op1, const ICOORD &op2)
 
int32_t operator* (const ICOORD &op1, const ICOORD &op2)
 
ICOORD operator* (const ICOORD &op1, int16_t scale)
 
ICOORD operator* (int16_t scale, const ICOORD &op1)
 
ICOORDoperator*= (ICOORD &op1, int16_t scale)
 
ICOORD operator/ (const ICOORD &op1, int16_t scale)
 
ICOORDoperator/= (ICOORD &op1, int16_t scale)
 
FCOORD operator! (const FCOORD &src)
 
FCOORD operator- (const FCOORD &src)
 
FCOORD operator+ (const FCOORD &op1, const FCOORD &op2)
 
FCOORDoperator+= (FCOORD &op1, const FCOORD &op2)
 
FCOORD operator- (const FCOORD &op1, const FCOORD &op2)
 
FCOORDoperator-= (FCOORD &op1, const FCOORD &op2)
 
float operator% (const FCOORD &op1, const FCOORD &op2)
 
float operator* (const FCOORD &op1, const FCOORD &op2)
 
FCOORD operator* (const FCOORD &op1, float scale)
 
FCOORD operator* (float scale, const FCOORD &op1)
 
FCOORDoperator*= (FCOORD &op1, float scale)
 
FCOORD operator/ (const FCOORD &op1, float scale)
 
FCOORDoperator/= (FCOORD &op1, float scale)
 

Function Documentation

◆ operator!() [1/2]

FCOORD operator! ( const FCOORD src)
inline

Definition at line 553 of file points.h.

555 {
556 FCOORD result; //output
557
558 result.xcoord = -src.ycoord;
559 result.ycoord = src.xcoord;
560 return result;
561}
Definition: points.h:189

◆ operator!() [2/2]

ICOORD operator! ( const ICOORD src)
inline

Definition at line 327 of file points.h.

329 {
330 ICOORD result; //output
331
332 result.xcoord = -src.ycoord;
333 result.ycoord = src.xcoord;
334 return result;
335}
integer coordinate
Definition: points.h:32
int16_t ycoord
y value
Definition: points.h:158
int16_t xcoord
x value
Definition: points.h:157

◆ operator%() [1/2]

float operator% ( const FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 657 of file points.h.

659 {
660 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
661}

◆ operator%() [2/2]

int32_t operator% ( const ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 431 of file points.h.

433 {
434 return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
435}

◆ operator*() [1/6]

float operator* ( const FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 670 of file points.h.

672 {
673 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
674}

◆ operator*() [2/6]

FCOORD operator* ( const FCOORD op1,
float  scale 
)
inline

Definition at line 683 of file points.h.

685 {
686 FCOORD result; //output
687
688 result.xcoord = op1.xcoord * scale;
689 result.ycoord = op1.ycoord * scale;
690 return result;
691}

◆ operator*() [3/6]

int32_t operator* ( const ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 444 of file points.h.

446 {
447 return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
448}

◆ operator*() [4/6]

ICOORD operator* ( const ICOORD op1,
int16_t  scale 
)
inline

Definition at line 457 of file points.h.

459 {
460 ICOORD result; //output
461
462 result.xcoord = op1.xcoord * scale;
463 result.ycoord = op1.ycoord * scale;
464 return result;
465}

◆ operator*() [5/6]

FCOORD operator* ( float  scale,
const FCOORD op1 
)
inline

Definition at line 694 of file points.h.

697 {
698 FCOORD result; //output
699
700 result.xcoord = op1.xcoord * scale;
701 result.ycoord = op1.ycoord * scale;
702 return result;
703}

◆ operator*() [6/6]

ICOORD operator* ( int16_t  scale,
const ICOORD op1 
)
inline

Definition at line 468 of file points.h.

471 {
472 ICOORD result; //output
473
474 result.xcoord = op1.xcoord * scale;
475 result.ycoord = op1.ycoord * scale;
476 return result;
477}

◆ operator*=() [1/2]

FCOORD & operator*= ( FCOORD op1,
float  scale 
)
inline

Definition at line 713 of file points.h.

715 {
716 op1.xcoord *= scale;
717 op1.ycoord *= scale;
718 return op1;
719}

◆ operator*=() [2/2]

ICOORD & operator*= ( ICOORD op1,
int16_t  scale 
)
inline

Definition at line 487 of file points.h.

489 {
490 op1.xcoord *= scale;
491 op1.ycoord *= scale;
492 return op1;
493}

◆ operator+() [1/2]

FCOORD operator+ ( const FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 589 of file points.h.

591 {
592 FCOORD sum; //result
593
594 sum.xcoord = op1.xcoord + op2.xcoord;
595 sum.ycoord = op1.ycoord + op2.ycoord;
596 return sum;
597}

◆ operator+() [2/2]

ICOORD operator+ ( const ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 363 of file points.h.

365 {
366 ICOORD sum; //result
367
368 sum.xcoord = op1.xcoord + op2.xcoord;
369 sum.ycoord = op1.ycoord + op2.ycoord;
370 return sum;
371}

◆ operator+=() [1/2]

FCOORD & operator+= ( FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 607 of file points.h.

609 {
610 op1.xcoord += op2.xcoord;
611 op1.ycoord += op2.ycoord;
612 return op1;
613}

◆ operator+=() [2/2]

ICOORD & operator+= ( ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 381 of file points.h.

383 {
384 op1.xcoord += op2.xcoord;
385 op1.ycoord += op2.ycoord;
386 return op1;
387}

◆ operator-() [1/4]

FCOORD operator- ( const FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 623 of file points.h.

625 {
626 FCOORD sum; //result
627
628 sum.xcoord = op1.xcoord - op2.xcoord;
629 sum.ycoord = op1.ycoord - op2.ycoord;
630 return sum;
631}

◆ operator-() [2/4]

FCOORD operator- ( const FCOORD src)
inline

Definition at line 571 of file points.h.

573 {
574 FCOORD result; //output
575
576 result.xcoord = -src.xcoord;
577 result.ycoord = -src.ycoord;
578 return result;
579}

◆ operator-() [3/4]

ICOORD operator- ( const ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 397 of file points.h.

399 {
400 ICOORD sum; //result
401
402 sum.xcoord = op1.xcoord - op2.xcoord;
403 sum.ycoord = op1.ycoord - op2.ycoord;
404 return sum;
405}

◆ operator-() [4/4]

ICOORD operator- ( const ICOORD src)
inline

Definition at line 345 of file points.h.

347 {
348 ICOORD result; //output
349
350 result.xcoord = -src.xcoord;
351 result.ycoord = -src.ycoord;
352 return result;
353}

◆ operator-=() [1/2]

FCOORD & operator-= ( FCOORD op1,
const FCOORD op2 
)
inline

Definition at line 641 of file points.h.

643 {
644 op1.xcoord -= op2.xcoord;
645 op1.ycoord -= op2.ycoord;
646 return op1;
647}

◆ operator-=() [2/2]

ICOORD & operator-= ( ICOORD op1,
const ICOORD op2 
)
inline

Definition at line 415 of file points.h.

417 {
418 op1.xcoord -= op2.xcoord;
419 op1.ycoord -= op2.ycoord;
420 return op1;
421}

◆ operator/() [1/2]

FCOORD operator/ ( const FCOORD op1,
float  scale 
)
inline

Definition at line 729 of file points.h.

731 {
732 FCOORD result; //output
733 ASSERT_HOST(scale != 0.0f);
734 result.xcoord = op1.xcoord / scale;
735 result.ycoord = op1.ycoord / scale;
736 return result;
737}
#define ASSERT_HOST(x)
Definition: errcode.h:88

◆ operator/() [2/2]

ICOORD operator/ ( const ICOORD op1,
int16_t  scale 
)
inline

Definition at line 503 of file points.h.

505 {
506 ICOORD result; //output
507
508 result.xcoord = op1.xcoord / scale;
509 result.ycoord = op1.ycoord / scale;
510 return result;
511}

◆ operator/=() [1/2]

FCOORD & operator/= ( FCOORD op1,
float  scale 
)
inline

Definition at line 747 of file points.h.

749 {
750 ASSERT_HOST(scale != 0.0f);
751 op1.xcoord /= scale;
752 op1.ycoord /= scale;
753 return op1;
754}

◆ operator/=() [2/2]

ICOORD & operator/= ( ICOORD op1,
int16_t  scale 
)
inline

Definition at line 521 of file points.h.

523 {
524 op1.xcoord /= scale;
525 op1.ycoord /= scale;
526 return op1;
527}