tesseract  4.0.0-1-g2a2b
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]

ICOORD operator! ( const ICOORD src)
inline

Definition at line 328 of file points.h.

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

◆ operator!() [2/2]

FCOORD operator! ( const FCOORD src)
inline

Definition at line 554 of file points.h.

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

◆ operator%() [1/2]

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

Definition at line 432 of file points.h.

434  {
435  return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
436 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator%() [2/2]

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

Definition at line 658 of file points.h.

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

◆ operator*() [1/6]

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

Definition at line 445 of file points.h.

447  {
448  return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
449 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator*() [2/6]

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

Definition at line 458 of file points.h.

460  {
461  ICOORD result; //output
462 
463  result.xcoord = op1.xcoord * scale;
464  result.ycoord = op1.ycoord * scale;
465  return result;
466 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator*() [3/6]

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

Definition at line 469 of file points.h.

472  {
473  ICOORD result; //output
474 
475  result.xcoord = op1.xcoord * scale;
476  result.ycoord = op1.ycoord * scale;
477  return result;
478 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator*() [4/6]

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

Definition at line 671 of file points.h.

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

◆ operator*() [5/6]

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

Definition at line 684 of file points.h.

686  {
687  FCOORD result; //output
688 
689  result.xcoord = op1.xcoord * scale;
690  result.ycoord = op1.ycoord * scale;
691  return result;
692 }
Definition: points.h:189

◆ operator*() [6/6]

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

Definition at line 695 of file points.h.

698  {
699  FCOORD result; //output
700 
701  result.xcoord = op1.xcoord * scale;
702  result.ycoord = op1.ycoord * scale;
703  return result;
704 }
Definition: points.h:189

◆ operator*=() [1/2]

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

Definition at line 488 of file points.h.

490  {
491  op1.xcoord *= scale;
492  op1.ycoord *= scale;
493  return op1;
494 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator*=() [2/2]

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

Definition at line 714 of file points.h.

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

◆ operator+() [1/2]

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

Definition at line 364 of file points.h.

366  {
367  ICOORD sum; //result
368 
369  sum.xcoord = op1.xcoord + op2.xcoord;
370  sum.ycoord = op1.ycoord + op2.ycoord;
371  return sum;
372 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator+() [2/2]

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

Definition at line 590 of file points.h.

592  {
593  FCOORD sum; //result
594 
595  sum.xcoord = op1.xcoord + op2.xcoord;
596  sum.ycoord = op1.ycoord + op2.ycoord;
597  return sum;
598 }
Definition: points.h:189

◆ operator+=() [1/2]

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

Definition at line 382 of file points.h.

384  {
385  op1.xcoord += op2.xcoord;
386  op1.ycoord += op2.ycoord;
387  return op1;
388 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator+=() [2/2]

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

Definition at line 608 of file points.h.

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

◆ operator-() [1/4]

ICOORD operator- ( const ICOORD src)
inline

Definition at line 346 of file points.h.

348  {
349  ICOORD result; //output
350 
351  result.xcoord = -src.xcoord;
352  result.ycoord = -src.ycoord;
353  return result;
354 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator-() [2/4]

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

Definition at line 398 of file points.h.

400  {
401  ICOORD sum; //result
402 
403  sum.xcoord = op1.xcoord - op2.xcoord;
404  sum.ycoord = op1.ycoord - op2.ycoord;
405  return sum;
406 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator-() [3/4]

FCOORD operator- ( const FCOORD src)
inline

Definition at line 572 of file points.h.

574  {
575  FCOORD result; //output
576 
577  result.xcoord = -src.xcoord;
578  result.ycoord = -src.ycoord;
579  return result;
580 }
Definition: points.h:189

◆ operator-() [4/4]

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

Definition at line 624 of file points.h.

626  {
627  FCOORD sum; //result
628 
629  sum.xcoord = op1.xcoord - op2.xcoord;
630  sum.ycoord = op1.ycoord - op2.ycoord;
631  return sum;
632 }
Definition: points.h:189

◆ operator-=() [1/2]

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

Definition at line 416 of file points.h.

418  {
419  op1.xcoord -= op2.xcoord;
420  op1.ycoord -= op2.ycoord;
421  return op1;
422 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator-=() [2/2]

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

Definition at line 642 of file points.h.

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

◆ operator/() [1/2]

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

Definition at line 504 of file points.h.

506  {
507  ICOORD result; //output
508 
509  result.xcoord = op1.xcoord / scale;
510  result.ycoord = op1.ycoord / scale;
511  return result;
512 }
integer coordinate
Definition: points.h:32
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator/() [2/2]

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

Definition at line 730 of file points.h.

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

◆ operator/=() [1/2]

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

Definition at line 522 of file points.h.

524  {
525  op1.xcoord /= scale;
526  op1.ycoord /= scale;
527  return op1;
528 }
int16_t xcoord
Definition: points.h:158
int16_t ycoord
Definition: points.h:159

◆ operator/=() [2/2]

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

Definition at line 748 of file points.h.

750  {
751  ASSERT_HOST(scale != 0.0f);
752  op1.xcoord /= scale;
753  op1.ycoord /= scale;
754  return op1;
755 }
#define ASSERT_HOST(x)
Definition: errcode.h:84