ICOORD Class Reference

#include <points.h>

Inheritance diagram for ICOORD:

ICOORDELT List of all members.

Detailed Description

Class for dealing with one integer coordinate.

Definition at line 34 of file points.h.

Public Member Functions

Protected Attributes

Friends


Constructor & Destructor Documentation

ICOORD::ICOORD (  )  [inline]

Definition at line 39 of file points.h.

00039              {  //empty constructor
00040       xcoord = ycoord = 0;       //default zero
00041     }

ICOORD::ICOORD ( INT16  xin,
INT16  yin 
) [inline]

Definition at line 42 of file points.h.

00044                       {  //y value
00045       xcoord = xin;
00046       ycoord = yin;
00047     }

ICOORD::~ICOORD (  )  [inline]

Definition at line 48 of file points.h.

00048                {                 //destructor
00049     }


Member Function Documentation

float ICOORD::angle (  )  const [inline]

Definition at line 91 of file points.h.

00091                         {  //find angle
00092       return (float) atan2 ((double) ycoord, (double) xcoord);
00093     }

void ICOORD::de_serialise_asc ( FILE *  f  ) 

Convert from ascii

Reimplemented in ICOORDELT.

Definition at line 54 of file points.cpp.

References de_serialise_INT32(), xcoord, and ycoord.

Referenced by BOX::de_serialise_asc().

00056                                {
00057   xcoord = (INT16) de_serialise_INT32 (f);
00058   ycoord = (INT16) de_serialise_INT32 (f);
00059 }

float ICOORD::length (  )  const [inline]

Definition at line 73 of file points.h.

00073                          {  //find length
00074       return (float) sqrt (sqlength ());
00075     }

ICOORD::NEWDELETE2 ( ICOORD   )  const [inline]

Definition at line 52 of file points.h.

00053     {
00054       return xcoord;
00055     }

BOOL8 ICOORD::operator!= ( const ICOORD other  )  [inline]

Definition at line 99 of file points.h.

References xcoord, and ycoord.

00100                           {
00101       return xcoord != other.xcoord || ycoord != other.ycoord;
00102     }

BOOL8 ICOORD::operator== ( const ICOORD other  )  [inline]

Definition at line 95 of file points.h.

References xcoord, and ycoord.

00096                           {
00097       return xcoord == other.xcoord && ycoord == other.ycoord;
00098     }

float ICOORD::pt_to_pt_dist ( const ICOORD pt  )  const [inline]

Definition at line 86 of file points.h.

00087                                                 {
00088       return (float) sqrt (pt_to_pt_sqdist (pt));
00089     }

float ICOORD::pt_to_pt_sqdist ( const ICOORD pt  )  const [inline]

Definition at line 77 of file points.h.

References sqlength(), xcoord, and ycoord.

00078                                                   {
00079       ICOORD gap;
00080 
00081       gap.xcoord = xcoord - pt.xcoord;
00082       gap.ycoord = ycoord - pt.ycoord;
00083       return gap.sqlength ();
00084     }

void ICOORD::rotate ( const FCOORD vec  )  [inline]

Rotate an ICOORD by the given (normalized) (cos,sin) vector.

Definition at line 202 of file ipoints.h.

References xcoord, and ycoord.

Referenced by find_cblob_limits().

00203                                               {
00204   INT16 tmp;
00205 
00206   tmp = (INT16) floor (xcoord * vec.x () - ycoord * vec.y () + 0.5);
00207   ycoord = (INT16) floor (ycoord * vec.x () + xcoord * vec.y () + 0.5);
00208   xcoord = tmp;
00209 }

void ICOORD::serialise_asc ( FILE *  f  ) 

Convert to ascii

Definition at line 43 of file points.cpp.

References serialise_INT32(), xcoord, and ycoord.

Referenced by BOX::serialise_asc().

00045                             {
00046   serialise_INT32(f, xcoord); 
00047   serialise_INT32(f, ycoord); 
00048 }

void ICOORD::set_x ( INT16  xin  )  [inline]

Definition at line 60 of file points.h.

Referenced by BOX::bounding_union(), compute_pitch_sd(), h_edge(), BOX::intersection(), loop_bounding_box(), BOX::move(), operator+=(), operator-=(), process_image_event(), POLY_BLOCK::rotate(), and v_edge().

00061                           {
00062       xcoord = xin;              //write new value
00063     }

void ICOORD::set_y ( INT16  yin  )  [inline]

Definition at line 64 of file points.h.

Referenced by BOX::bounding_union(), PB_LINE_IT::get_line(), h_edge(), BOX::intersection(), loop_bounding_box(), operator+=(), operator-=(), process_image_event(), POLY_BLOCK::rotate(), and v_edge().

00065                           {  //value to set
00066       ycoord = yin;
00067     }

float ICOORD::sqlength (  )  const [inline]

Definition at line 69 of file points.h.

Referenced by pt_to_pt_sqdist().

00069                            {  //find sq length
00070       return (float) (xcoord * xcoord + ycoord * ycoord);
00071     }

INT16 ICOORD::y (  )  const [inline]

Definition at line 56 of file points.h.

Referenced by PDLSQ::add(), block_edges(), BOX::bounding_union(), BOX::BOX(), POLY_BLOCK::compute_bb(), BOX::contains(), convert_vec_block(), OL_BUCKETS::count_children(), create_edges_window(), create_to_win(), dot_of_i(), draw_raw_edge(), edgesteps_to_edgepts(), OL_BUCKETS::extract_children(), find_cblob_hlimits(), find_cblob_limits(), find_cblob_vlimits(), PB_LINE_IT::get_line(), BLOCK_LINE_IT::get_line(), h_edge(), horizontal_coutline_projection(), BOX::intersection(), join_edges(), loop_bounding_box(), BOX::major_overlap(), QUAD_COEFFS::move(), OL_BUCKETS::OL_BUCKETS(), OL_BUCKETS::operator()(), operator+=(), operator-=(), BOX::overlap(), PDLSQ::remove(), POLY_BLOCK::rotate(), v_edge(), vertical_coutline_projection(), vertical_cunderline_projection(), and POLY_BLOCK::winding_number().

00056                     {  //access_function
00057       return ycoord;
00058     }


Friends And Related Function Documentation

friend class FCOORD [friend]

Definition at line 36 of file points.h.

ICOORD operator * ( INT16  scale,
const ICOORD op1 
) [friend]

Definition at line 145 of file ipoints.h.

00148                           {
00149   ICOORD result;                 //output
00150 
00151   result.xcoord = op1.xcoord * scale;
00152   result.ycoord = op1.ycoord * scale;
00153   return result;
00154 }

ICOORD operator * ( const ICOORD op1,
INT16  scale 
) [friend]

Scalar multiply of an ICOORD.

Definition at line 134 of file ipoints.h.

00136                                       {
00137   ICOORD result;                 //output
00138 
00139   result.xcoord = op1.xcoord * scale;
00140   result.ycoord = op1.ycoord * scale;
00141   return result;
00142 }

INT32 operator * ( const ICOORD op1,
const ICOORD op2 
) [friend]

Cross product of 2 ICOORDS.

Definition at line 124 of file ipoints.h.

00126                                            {
00127   return op1.xcoord * op2.ycoord - op1.ycoord * op2.xcoord;
00128 }

ICOORD& operator *= ( ICOORD op1,
INT16  scale 
) [friend]

Scalar multiply of an ICOORD.

Definition at line 161 of file ipoints.h.

00163              {
00164   op1.xcoord *= scale;
00165   op1.ycoord *= scale;
00166   return op1;
00167 }

ICOORD operator! ( const ICOORD src  )  [friend]

Rotate an ICOORD 90 degrees anticlockwise.

Definition at line 29 of file ipoints.h.

00031   {
00032   ICOORD result;                 //output
00033 
00034   result.xcoord = -src.ycoord;
00035   result.ycoord = src.xcoord;
00036   return result;
00037 }

INT32 operator% ( const ICOORD op1,
const ICOORD op2 
) [friend]

Scalar product of 2 ICOORDS.

Definition at line 114 of file ipoints.h.

00116                     {
00117   return op1.xcoord * op2.xcoord + op1.ycoord * op2.ycoord;
00118 }

ICOORD operator+ ( const ICOORD op1,
const ICOORD op2 
) [friend]

Add 2 ICOORDS.

Definition at line 58 of file ipoints.h.

00060                     {
00061   ICOORD sum;                    //result
00062 
00063   sum.xcoord = op1.xcoord + op2.xcoord;
00064   sum.ycoord = op1.ycoord + op2.ycoord;
00065   return sum;
00066 }

ICOORD& operator+= ( ICOORD op1,
const ICOORD op2 
) [friend]

Add 2 ICOORDS.

Definition at line 73 of file ipoints.h.

00075                     {
00076   op1.xcoord += op2.xcoord;
00077   op1.ycoord += op2.ycoord;
00078   return op1;
00079 }

ICOORD operator- ( const ICOORD op1,
const ICOORD op2 
) [friend]

Subtract 2 ICOORDS.

Definition at line 86 of file ipoints.h.

00088                     {
00089   ICOORD sum;                    //result
00090 
00091   sum.xcoord = op1.xcoord - op2.xcoord;
00092   sum.ycoord = op1.ycoord - op2.ycoord;
00093   return sum;
00094 }

ICOORD operator- ( const ICOORD src  )  [friend]

Unary minus of an ICOORD.

Definition at line 43 of file ipoints.h.

00045   {
00046   ICOORD result;                 //output
00047 
00048   result.xcoord = -src.xcoord;
00049   result.ycoord = -src.ycoord;
00050   return result;
00051 }

ICOORD& operator-= ( ICOORD op1,
const ICOORD op2 
) [friend]

Subtract 2 ICOORDS.

Definition at line 101 of file ipoints.h.

00103                     {
00104   op1.xcoord -= op2.xcoord;
00105   op1.ycoord -= op2.ycoord;
00106   return op1;
00107 }

ICOORD operator/ ( const ICOORD op1,
INT16  scale 
) [friend]

Scalar divide of an ICOORD.

Definition at line 175 of file ipoints.h.

00177              {
00178   ICOORD result;                 //output
00179 
00180   result.xcoord = op1.xcoord / scale;
00181   result.ycoord = op1.ycoord / scale;
00182   return result;
00183 }

ICOORD& operator/= ( ICOORD op1,
INT16  scale 
) [friend]

Scalar divide of an ICOORD.

Definition at line 190 of file ipoints.h.

00192              {
00193   op1.xcoord /= scale;
00194   op1.ycoord /= scale;
00195   return op1;
00196 }


Member Data Documentation

INT16 ICOORD::xcoord [protected]

x value

Definition at line 142 of file points.h.

Referenced by de_serialise_asc(), operator *(), operator *=(), operator!(), operator!=(), operator%(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator==(), pt_to_pt_sqdist(), rotate(), and serialise_asc().

INT16 ICOORD::ycoord [protected]

y value

Definition at line 144 of file points.h.

Referenced by de_serialise_asc(), operator *(), operator *=(), operator!(), operator!=(), operator%(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator==(), pt_to_pt_sqdist(), rotate(), and serialise_asc().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:32 2007 for Tesseract by  doxygen 1.5.1