00001
00002
00003
00004
00005
00006
00007 #ifndef GT2005Polygon_h
00008 #define GT2005Polygon_h
00009
00010 #include "Tools/Math/Vector3.h"
00011 #include <string.h>
00012 #include <math.h>
00013
00014
00015
00016
00017
00018
00019
00020 class GT2005Polygon
00021 {
00022 public:
00023
00024 GT2005Polygon(int nPoints = 0, int sLength = 0);
00025
00026
00027 ~GT2005Polygon();
00028
00029 int stepLength;
00030
00031
00032 enum {maxPoints = 128};
00033 typedef struct
00034 {
00035 Vector3<double> point;
00036 double sLen;
00037 } pSegment;
00038 pSegment pPoints[maxPoints];
00039
00040
00041 int numPoints;
00042
00043
00044 double polyLengthX;
00045 double groundTime;
00046 Vector3<double> centerOfMassCorrection;
00047
00048 double rollAngle;
00049
00050 Vector3<double> getPointCoord(int pNum);
00051 void setPointCoord(int pNum, Vector3<double> p);
00052
00053 void getSegment(int sNum, double &sLen, Vector3<double> &p);
00054 void setSegment(int sNum, double sLen, Vector3<double> p);
00055 double getSegmentLength(int sNum);
00056
00057 Vector3<double> getPositionOnShape(double pos);
00058
00059 void insertPoint(int pNum);
00060
00061 GT2005Polygon* interpolateShape(double amount, GT2005Polygon* s2);
00062 void interpolateShapeP(double amount, GT2005Polygon* s2);
00063
00064 int getMaxX();
00065 int getMinX();
00066 double approxGroundTime();
00067 Vector3<double> calculateCenterOfMass();
00068 void finalize();
00069
00070 GT2005Polygon scaleX(double s);
00071 GT2005Polygon scaleY(double s);
00072
00073 GT2005Polygon rotateX(double a);
00074 GT2005Polygon rotateY(double a);
00075 GT2005Polygon rotateZ(double a);
00076
00077 void rotateXP(double a);
00078 void rotateYP(double a);
00079 void rotateZP(double a);
00080
00081 GT2005Polygon rotateZC(double a);
00082
00083 bool load(char* filename);
00084 void save(char* filename);
00085
00086 GT2005Polygon* copy();
00087 GT2005Polygon* mirrorY();
00088 };
00089
00090
00091 In& operator>>(In& stream, GT2005Polygon& Polygon);
00092 Out& operator<<(Out& stream, const GT2005Polygon& Polygon);
00093
00094 #endif // GT2005Polygon_h