All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TPOINT Struct Reference

#include <blobs.h>

Public Member Functions

 TPOINT ()
 
 TPOINT (inT16 vx, inT16 vy)
 
 TPOINT (const ICOORD &ic)
 
void operator+= (const TPOINT &other)
 
void operator/= (int divisor)
 
bool operator== (const TPOINT &other) const
 

Static Public Member Functions

static bool IsCrossed (const TPOINT &a0, const TPOINT &a1, const TPOINT &b0, const TPOINT &b1)
 

Public Attributes

inT16 x
 
inT16 y
 

Detailed Description

Definition at line 50 of file blobs.h.

Constructor & Destructor Documentation

TPOINT::TPOINT ( )
inline

Definition at line 51 of file blobs.h.

51 : x(0), y(0) {}
inT16 y
Definition: blobs.h:72
inT16 x
Definition: blobs.h:71
TPOINT::TPOINT ( inT16  vx,
inT16  vy 
)
inline

Definition at line 52 of file blobs.h.

52 : x(vx), y(vy) {}
inT16 y
Definition: blobs.h:72
inT16 x
Definition: blobs.h:71
TPOINT::TPOINT ( const ICOORD ic)
inline

Definition at line 53 of file blobs.h.

53 : x(ic.x()), y(ic.y()) {}
inT16 y
Definition: blobs.h:72
inT16 y() const
access_function
Definition: points.h:56
inT16 x
Definition: blobs.h:71
inT16 x() const
access function
Definition: points.h:52

Member Function Documentation

bool TPOINT::IsCrossed ( const TPOINT a0,
const TPOINT a1,
const TPOINT b0,
const TPOINT b1 
)
static

Definition at line 73 of file blobs.cpp.

74  {
75  int b0a1xb0b1, b0b1xb0a0;
76  int a1b1xa1a0, a1a0xa1b0;
77 
78  TPOINT b0a1, b0a0, a1b1, b0b1, a1a0;
79 
80  b0a1.x = a1.x - b0.x;
81  b0a0.x = a0.x - b0.x;
82  a1b1.x = b1.x - a1.x;
83  b0b1.x = b1.x - b0.x;
84  a1a0.x = a0.x - a1.x;
85  b0a1.y = a1.y - b0.y;
86  b0a0.y = a0.y - b0.y;
87  a1b1.y = b1.y - a1.y;
88  b0b1.y = b1.y - b0.y;
89  a1a0.y = a0.y - a1.y;
90 
91  b0a1xb0b1 = CROSS(b0a1, b0b1);
92  b0b1xb0a0 = CROSS(b0b1, b0a0);
93  a1b1xa1a0 = CROSS(a1b1, a1a0);
94  // For clarity, we want CROSS(a1a0,a1b0) here but we have b0a1 instead of a1b0
95  // so use -CROSS(a1b0,b0a1) instead, which is the same.
96  a1a0xa1b0 = -CROSS(a1a0, b0a1);
97 
98  return ((b0a1xb0b1 > 0 && b0b1xb0a0 > 0) ||
99  (b0a1xb0b1 < 0 && b0b1xb0a0 < 0)) &&
100  ((a1b1xa1a0 > 0 && a1a0xa1b0 > 0) || (a1b1xa1a0 < 0 && a1a0xa1b0 < 0));
101 }
inT16 y
Definition: blobs.h:72
#define CROSS(a, b)
Definition: vecfuncs.h:52
Definition: blobs.h:50
inT16 x
Definition: blobs.h:71
void TPOINT::operator+= ( const TPOINT other)
inline

Definition at line 55 of file blobs.h.

55  {
56  x += other.x;
57  y += other.y;
58  }
inT16 y
Definition: blobs.h:72
inT16 x
Definition: blobs.h:71
void TPOINT::operator/= ( int  divisor)
inline

Definition at line 59 of file blobs.h.

59  {
60  x /= divisor;
61  y /= divisor;
62  }
inT16 y
Definition: blobs.h:72
inT16 x
Definition: blobs.h:71
bool TPOINT::operator== ( const TPOINT other) const
inline

Definition at line 63 of file blobs.h.

63  {
64  return x == other.x && y == other.y;
65  }
inT16 y
Definition: blobs.h:72
inT16 x
Definition: blobs.h:71

Member Data Documentation

inT16 TPOINT::x

Definition at line 71 of file blobs.h.

inT16 TPOINT::y

Definition at line 72 of file blobs.h.


The documentation for this struct was generated from the following files: