00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef CAMERAD_H
00040 #define CAMERAD_H
00041
00042 #ifndef PKGEOM_H
00043 #include "pkgeom.h"
00044 #endif
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00050 #ifndef CAMERA_H
00051 #define CPLANE_TOP 0
00052 #define CPLANE_BOTTOM 1
00053 #define CPLANE_LEFT 2
00054 #define CPLANE_RIGHT 3
00055 #define CPLANE_NEAR 4
00056 #define CPLANE_FAR 5
00057 #endif
00058
00059
00060 typedef struct CameraRecd {
00061
00062 boolean parallel;
00063 boolean upside;
00064 boolean c_fixed;
00065
00066 byte magnification;
00067
00068 short xmin, ymin;
00069 short width, height;
00070 double aspect;
00071
00072 point3d position;
00073 double psi, theta, phi;
00074 point3d g_centre;
00075 point3d c_centre;
00076
00077 double xscale, yscale;
00078
00079 trans3d CTr;
00080
00081 trans3d CTrInv;
00082 char ncplanes;
00083 vector4d cplane[6];
00084
00085 double zmin, zmax;
00086 union {
00087 struct {
00088 double f;
00089 double xi0, eta0;
00090 double dxi0, deta0;
00091 } persp;
00092 struct {
00093 double wdt, hgh, diag;
00094 boolean dim_case;
00095 } para;
00096 } vd;
00097
00098 } CameraRecd;
00099
00100
00101 void CameraInitFramed ( CameraRecd *CPos,
00102 boolean parallel, boolean upside,
00103 short width, short height, short xmin, short ymin,
00104 double aspect, int ncplanes );
00105 void CameraSetMagd ( CameraRecd *CPos, byte mag );
00106 void CameraSetDepthRanged ( CameraRecd *CPos, double zmin, double zmax );
00107 void CameraSetMappingd ( CameraRecd *CPos );
00108
00109 void CameraProjectPoint3d ( CameraRecd *CPos, const point3d *p, point3d *q );
00110 void CameraUnProjectPoint3d ( CameraRecd *CPos, const point3d *p, point3d *q );
00111 void CameraProjectPoint2d ( CameraRecd *CPos, const point2d *p, point2d *q );
00112 void CameraUnProjectPoint2d ( CameraRecd *CPos, const point2d *p, point2d *q );
00113 void CameraProjectPoint3Rd ( CameraRecd *CPos, const point4d *p, point3d *q );
00114 void CameraUnProjectPoint3Rd ( CameraRecd *CPos, const point3d *p, double w,
00115 point4d *q );
00116 void CameraProjectPoint2Rd ( CameraRecd *CPos, const point3d *p, point2d *q );
00117 void CameraUnProjectPoint2Rd ( CameraRecd *CPos, const point2d *p, double w,
00118 point3d *q );
00119 void CameraProjectPoint3d2s ( CameraRecd *CPos, const point3d *p, point2s *q );
00120 void CameraProjectPoint3Rd2s ( CameraRecd *CPos, const point4d *p, point2s *q );
00121
00122 void CameraRayOfPixeld ( CameraRecd *CPos, double xi, double eta, ray3d *ray );
00123
00124 void CameraInitPosd ( CameraRecd *CPos );
00125 void CameraSetRotCentred ( CameraRecd *CPos, point3d *centre,
00126 boolean global_coord, boolean global_fixed );
00127 void CameraMoveToGd ( CameraRecd *CPos, point3d *pos );
00128 void CameraTurnGd ( CameraRecd *CPos, double _psi, double _theta, double _phi );
00129 void CameraMoveGd ( CameraRecd *CPos, vector3d *v );
00130 void CameraMoveCd ( CameraRecd *CPos, vector3d *v );
00131 void CameraRotGd ( CameraRecd *CPos, double _psi, double _theta, double _phi );
00132 #define CameraRotXGd(CPos,angle) \
00133 CameraRotGd(CPos, 0.0, angle, 0.0)
00134 #define CameraRotYGd(CPos,angle) \
00135 CameraRotGd(CPos, 0.5 * PI, angle, -0.5 * PI)
00136 #define CameraRotZGd(CPos,angle) \
00137 CameraRotGd(CPos, angle, 0.0, 0.0)
00138 void CameraRotVGd ( CameraRecd *CPos, vector3d *v, double angle );
00139 void CameraRotCd ( CameraRecd *CPos, double, double, double );
00140 #define CameraRotXCd(CPos,angle) \
00141 CameraRotCd ( CPos, 0.0, angle, 0.0 )
00142 #define CameraRotYCd(CPos,angle) \
00143 CameraRotCd ( CPos, 0.5 * PI, angle, -0.5 * PI )
00144 #define CameraRotZCd(CPos,angle) \
00145 CameraRotCd ( CPos, angle, 0.0, 0.0 )
00146 void CameraRotVCd ( CameraRecd *CPos, vector3d *v, double angle );
00147 void CameraSetFd ( CameraRecd *CPos, double f );
00148 void CameraZoomd ( CameraRecd *CPos, double fchange );
00149
00150
00151 boolean CameraClipPoint3d ( CameraRecd *CPos, point3d *p, point3d *q );
00152
00153 boolean CameraClipLine3d ( CameraRecd *CPos,
00154 point3d *p0, double t0, point3d *p1, double t1,
00155 point3d *q0, point3d *q1 );
00156
00157 boolean CameraClipPolygon3d ( CameraRecd *CPos, int n, const point3d *p,
00158 void (*output)(int n, point3d *p) );
00159
00160
00161
00162
00163 boolean Pixel2Spaced ( CameraRecd *CPos, double x, double y, vector3d *n,
00164 point3d *p, point3d *q,
00165 boolean global_in, boolean global_out );
00166
00167 typedef struct PixHLine_detd {
00168 double D, Dt, Dz, Ds, Dts;
00169 } PixHLine_detd;
00170
00171 boolean PixHLine2Spaced ( CameraRecd *CPos, int xi1, int xi2,
00172 int eta, vector3d *n, point3d *p, point3d *p1,
00173 point3d *p2, PixHLine_detd *det );
00174
00175 #ifdef __cplusplus
00176 }
00177 #endif
00178
00179 #endif
00180