cgma
|
00001 //- Class: CubitPolygon 00002 //- 00003 //- Description: This file defines the CubitPolygon class which is basically 00004 //- an ordered list of 2D points and their 2D bounding box. 00005 //- 00006 //- Owner: Steve Storm 00007 00008 #ifndef CUBITPOLYGON_HPP 00009 #define CUBITPOLYGON_HPP 00010 00011 #include "CubitDefines.h" 00012 #include "Cubit2DPoint.hpp" 00013 #include "DLIList.hpp" 00014 #include "CGMGeomConfigure.h" 00015 00016 class CUBIT_GEOM_EXPORT CubitPolygon 00017 { 00018 public: 00019 00020 //- Heading: Constructors and Destructor 00021 CubitPolygon(); //- Default constructor. 00022 00023 CubitPolygon( DLIList<Cubit2DPoint*> &point_list ); 00024 //- Constructor: create polygon from array of points. Points are copied. 00025 00026 CubitPolygon( Cubit2DPoint &point ); 00027 //- Constructor: create polygon with initial point. Point is copied. 00028 00029 ~CubitPolygon(); 00030 //- Destructor 00031 00032 void add_point( Cubit2DPoint &point ); 00033 //- Add a point to the end of the point list. Point is copied. 00034 00035 CubitPointContainment pnt_containment( Cubit2DPoint &point, 00036 double tol = 1e-10 ); 00037 //- Determine if the input point is inside, outside or on the boundary 00038 //- of the polygon. 00039 00040 CubitStatus centroid_area( Cubit2DPoint ¢roid, double &area ); 00041 //- Get geometrical centroid and area of polygon 00042 00043 private: 00044 00045 DLIList<Cubit2DPoint*> pointList; 00046 Cubit2DPoint minCoord; // Minimum coordinate of polygon 00047 Cubit2DPoint maxCoord; // Maximum coordinate of polygon 00048 00049 }; 00050 00051 #endif 00052 00053