00001
00032 #ifndef INC_MI32_PLANECONIC_H
00033 #define INC_MI32_PLANECONIC_H
00034
00035 #ifndef INC_MI32_POINT_H
00036 #include <mi32/point.h>
00037 #endif
00038
00039 #ifdef GEOMDLL
00040 #define GEOMLIBEXPORT MI_DLLEXPORT
00041 #define GEOMLIBCLASSEXPORT MI_DLLCLASSEXPORT
00042 #else
00043 #define GEOMLIBEXPORT MI_DLLIMPORT
00044 #define GEOMLIBCLASSEXPORT MI_DLLCLASSIMPORT
00045 #endif
00046
00047 #ifndef GENERATING_DOXYGEN_OUTPUT
00048
00049 struct DPOINT3D;
00050 class POLYLINE;
00051 class TRANS2D_AFFINE;
00052 class TRANS2D_MAPGEN;
00053 class TRANS3D;
00054 #endif
00055
00056 class GEOMLIBCLASSEXPORT PLANECONIC {
00057 public:
00058 enum CLOSURE {
00059 CLOSURE_Open,
00060 CLOSURE_Chord,
00061 CLOSURE_Wedge,
00062 CLOSURE_Complete
00063 };
00064
00066 PLANECONIC (
00067 );
00068
00070 PLANECONIC (
00071 const PLANECONIC& rhs
00072 );
00073
00075 PLANECONIC& operator= (
00076 const PLANECONIC& rhs
00077 );
00078
00080 void Clear (
00081 );
00082
00085 bool ComputeArc (
00086 const DPOINT2D& p1,
00087 const DPOINT2D& p2,
00088 const DPOINT2D& p3
00089 );
00090
00094 bool ComputeArc (
00095 const DPOINT3D& p1,
00096 const DPOINT3D& p2,
00097 const DPOINT3D& p3
00098 );
00099
00102 bool ComputeArcByBulge (
00103 const DPOINT2D& p1,
00104 const DPOINT2D& p2,
00105 double bulge
00106 );
00107
00110 bool ComputeArcByBulge (
00111 const DPOINT3D& p1,
00112 const DPOINT3D& p2,
00113 double bulge,
00114 const DPOINT3D& Normal
00115 );
00116
00119 bool ComputeCircle (
00120 const DPOINT2D& p1,
00121 const DPOINT2D& p2
00122 );
00123
00126 bool ComputeCircle (
00127 const DPOINT2D& p1,
00128 const DPOINT2D& p2,
00129 const DPOINT2D& p3
00130 );
00131
00135 bool ComputeCircle (
00136 const DPOINT3D& p1,
00137 const DPOINT3D& p2,
00138 const DPOINT3D& p3
00139 );
00140
00143 double ComputeDistanceFrom (
00144 const DPOINT2D& pt
00145 ) const;
00146
00149 double ComputeDistanceFrom (
00150 const DPOINT3D& pt
00151 ) const;
00152
00153
00156 bool ComputeEllipseFromRect (
00157 const POLYLINE& PolyLine
00158 );
00159
00161 void ComputeExtents (
00162 DRECT3D& Extents
00163 ) const;
00164
00167 bool ComputeRectFromEllipse (
00168 POLYLINE& PolyLine
00169 ) const;
00170
00173 bool ConvertForward (
00174 const TRANS2D_AFFINE& taf
00175 );
00176
00179 bool ConvertForward (
00180 const TRANS2D_MAPGEN& tmg
00181 );
00182
00185 bool ConvertInverse (
00186 const TRANS2D_AFFINE& taf
00187 );
00188
00191 bool ConvertInverse (
00192 const TRANS2D_MAPGEN& tmg
00193 );
00194
00196 bool GenerateArc3Points (
00197 DPOINT2D& p1,
00198 DPOINT2D& p2,
00199 DPOINT2D& p3
00200 ) const;
00201
00204 ERRVALUE GenerateConicPoints (
00205 POLYLINE& PolyLine,
00206 double MinChordDist = 0.0
00207 ) const;
00208
00211 const DPOINT3D& GetCenterPoint (
00212 ) const { return (m_CenterPoint); }
00213
00216 CLOSURE GetClosure (
00217 ) const { return (m_Closure); }
00218
00221 double GetEndAngle (
00222 ) const { return (m_EndAngle); }
00223
00227 const DPOINT3D& GetExtrusionPoint (
00228 ) const { return (m_Extrusion); }
00229
00232 double GetRotation (
00233 ) const { return (m_Rotation); }
00234
00237 double GetStartAngle (
00238 ) const { return (m_StartAngle); }
00239
00243 double GetXRadius (
00244 ) const { return (m_XRadius); }
00245
00249 double GetYRadius (
00250 ) const { return (m_YRadius); }
00251
00254 bool HasExtrusion (
00255 ) const { return (m_HasExtrusion); }
00256
00259 bool IsCircular (
00260 ) const { return (m_XRadius == m_YRadius || m_YRadius == 0); }
00261
00263 bool IsDefined (
00264 ) const { return (m_XRadius > 0.0); }
00265
00268 bool IsPointInside (
00269 const DPOINT2D& pt
00270 ) const;
00271
00273 bool IsPointInside (
00274 const DPOINT3D& pt
00275 ) const;
00276
00278 void SetCenterPoint (
00279 const DPOINT3D& point
00280 ) { m_CenterPoint = point; }
00281
00283 void SetClosure (
00284 CLOSURE Closure
00285 ) { m_Closure = Closure; }
00286
00288 void SetEndAngle (
00289 double angle
00290 ) { m_EndAngle = angle; }
00291
00294 void SetExtrusionPoint (
00295 const DPOINT3D& Extrusion
00296 );
00297
00299 void SetStartAngle (
00300 double angle
00301 ) { m_StartAngle = angle; }
00302
00305 void SetXRadius (
00306 double radius
00307 ) { m_XRadius = radius; }
00308
00311 void SetYRadius (
00312 double radius
00313 ) { m_YRadius = radius; }
00314
00316 void SetRotation (
00317 double rotation
00318 ) { m_Rotation = rotation; }
00319
00320 private:
00321 #ifndef GENERATING_DOXYGEN_OUTPUT
00322 DPOINT3D m_CenterPoint;
00323 double m_StartAngle;
00324 double m_EndAngle;
00325 double m_XRadius;
00326 double m_YRadius;
00327 double m_Rotation;
00328 DPOINT3D m_Extrusion;
00329 bool m_HasExtrusion;
00330 CLOSURE m_Closure;
00331
00332 void ComputeArcEndPoints (DPOINT2D& StartPt, DPOINT2D& EndPt) const;
00333 double ComputeAngleRadius (double angle) const;
00334 bool ComputeCircleLow (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3);
00335 void Generate3dTrans (TRANS3D& t3d) const;
00336 void GenerateStartEndAngle (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3);
00337 #endif // GENERATING_DOXYGEN_OUTPUT
00338
00339 };
00340
00341 #undef GEOMLIBEXPORT
00342 #undef GEOMLIBCLASSEXPORT
00343
00344 #endif // INC_MI32_PLANECONIC_H