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 #ifndef _scansimulator_h_
00027 #define _scansimulator_h_
00028
00029 #include <vector>
00030
00031 #include "matvec3D.h"
00032
00033
00034 #undef DEBUG
00035
00040 struct RawScanPoint {
00041 float hAngle,vAngle;
00042 float dx, dy, dz;
00043 float distance;
00044 };
00045
00056 class ScanSimulator {
00057 public:
00058 enum Type{SCANNER_COORDINATES,WORLD_COORDINATES};
00062 enum AxesConvention{
00064 STEREO_CAMERA
00065 };
00066
00067 private:
00069 position mPosition;
00071 vec3 mDirection;
00073 vec3 mUp;
00075 vec3 mHorizDirection;
00076
00078
00080 transf mTran;
00082 transf mTranInv;
00083
00084 Type mType;
00085
00086 float mHMin, mHMax;
00087 int mHLines;
00088 float mVMin, mVMax;
00089 int mVLines;
00090
00091 bool shootRay(const vec3 &rayDirection, position &rayPoint);
00092 public:
00093 ScanSimulator();
00094 void setPosition(transf tr, AxesConvention convention);
00095 void setPosition(position p, vec3 optical_axis, vec3 up_axis, AxesConvention convention);
00096 void setPosition(vec3 p, vec3 optical_axis, vec3 up_axis, AxesConvention convention){
00097 position pp(p.x(), p.y(), p.z());
00098 setPosition(pp, optical_axis, up_axis, convention);
00099 }
00100 void getPosition(position &p, vec3 &optical_axis, vec3 &up_axis){
00101 p = mPosition; optical_axis = mDirection; up_axis = mUp;
00102 }
00103 void setOptics( float hMin, float hMax, int hLines,
00104 float vMin, float vMax, int vLines) {
00105 mHMin = hMin; mHMax = hMax; mHLines = hLines;
00106 mVMin = vMin; mVMax = vMax; mVLines = vLines;}
00107 void setType(Type t){mType=t;}
00108 Type getType() const {return mType;}
00109 void computeRayDirection(float hAngle, float vAngle, vec3 &rayDirection);
00110
00112
00114 void scan(std::vector<position> *cloud, std::vector<RawScanPoint> *rawData = NULL);
00115 };
00116
00117 #endif