www.pudn.com > Product_Submit2004.rar > Common.h, change:2004-06-19,size:2649b


#ifndef _Common_h_DEFINED 
#define _Common_h_DEFINED 
#include <math.h> 
 
#define MAX_VISION_OBJECTS 25 
#define MAX_VISION_LINES 25 
#define MAX_FIELD_OBJECTS 14 
#define PLAYERS_PER_TEAM 4 
 
 
#define RAW_MULTIPLIER 6 
 
#ifdef ERS_7 
//#define FOVx DEG_TO_RAD(56.9) 
  #define FOVx DEG_TO_RAD(55.4) // sony's spec does not seem correct. 
  #define FOVy DEG_TO_RAD(45.2) 
 
  #define IMAGE_WIDTH_SCALE 208.0/176.0 
  #define IMAGE_HEIGHT_SCALE 160.0/144.0 
  #define IMAGE_AVERAGE_SCALE (IMAGE_WIDTH_SCALE/2.0+IMAGE_HEIGHT_SCALE/2.0) 
  #define IMAGE_SCALE 1.238 
  #define EFFECTIVE_CAMERA_DISTANCE_IN_PIXELS 191.9 
  #define CAMERA_OFFSET 1.46 
 
  // FIXME these 3 are dodgy++ 
  #define HEADLENGTH 8.106 
  #define NECKLENGTH 8.0 
  #define HEIGHTOFNECK 16.1 
 
  #define FULL_IMAGE_WIDTH 208 
  #define FULL_IMAGE_HEIGHT 160 
  #define DODGY_PIXELS_TOP 40 
  #define DOUBLE_IMAGE_WIDTH FULL_IMAGE_WIDTH*2 
  #define DOUBLE_IMAGE_HEIGHT FULL_IMAGE_HEIGHT*2 
#endif 
 
#ifdef ERS_210 
  #define FOVx 1.0122909 
  #define FOVy 0.8377580 
 
  #define IMAGE_WIDTH_SCALE 1.0 
  #define IMAGE_HEIGHT_SCALE 1.0 
  #define IMAGE_AVERAGE_SCALE 1.0 
  #define IMAGE_SCALE 1.0 
  #define EFFECTIVE_CAMERA_DISTANCE_IN_PIXELS 158.8 
  #define CAMERA_OFFSET 0.0 
 
  #define HEADLENGTH 6.5 //not too sure on this one, i used a ruler (!). can anyone find the real value? 
  #define NECKLENGTH 4.8 // direct from spec 
  #define HEIGHTOFNECK 13 // ?? 
 
  #define FULL_IMAGE_WIDTH 176 
  #define FULL_IMAGE_HEIGHT 144 
  #define DODGY_PIXELS_TOP 30 
  // FIXME we run out of memory otherwise ! 
  #define DOUBLE_IMAGE_WIDTH FULL_IMAGE_WIDTH 
  #define DOUBLE_IMAGE_HEIGHT FULL_IMAGE_HEIGHT 
#endif 
 
#define PI 3.141592 
#define PI_L 3141592L 
 
#define DEG_TO_RAD(x)     ((double)((x)*PI)/180.0) 
#define RAD_TO_MICRO(x)		((long)((x)*1000000)) 
#define DEG_TO_MICRO(x)		(RAD_TO_MICRO((DEG_TO_RAD((x))))) 
#define RAD_TO_DEG(x)		  ((double)((x)*180.0)/PI) 
#define MICRO_TO_RAD(x)		((double)(x)/1000000.0) 
#define MICRO_TO_DEG(x)		(RAD_TO_DEG((MICRO_TO_RAD((x))))) 
 
#define SQUARE(x)         ((x) * (x)) 
#define ABS(x)            (((x)>0)?(x):-1*(x)) 
 
#define MAX(x,y) ((x) > (y) ? (x) : (y)) 
#define MIN(x,y) ((x) > (y) ? (y) : (x)) 
 
inline double CROP(double num, double low, double high) { 
  if (num < low) num = low; 
  else if (num > high) num = high; 
  return num; 
} 
 
typedef unsigned char uchar; 
typedef unsigned short ushort; 
typedef unsigned long ulong; 
 
inline double Normalise_PI(double angle) { 
  while (angle>PI) { 
    angle -= 2.0*PI; 
  } 
  while (angle<=-PI) { 
    angle += 2.0*PI; 
  } 
  return angle; 
} 
 
#endif