00001 /* 00002 * Copyright (c) 2001 The AUTHORS 00003 * Romeu Andre' Pieritz, Ph.D. - romeu_pieritz@hotmail.com 00004 * Rafael Mendes, Eng. – mendes_rafael@yahoo.com 00005 * Rodrigo Ferraz de Andrade, Eng. – rferraz@iname.com 00006 * All rights reserved. 00007 * 00008 * Permission to use, copy and distribute this software and its 00009 * documentation for educational and personal use, without fee is hereby granted, 00010 * provided that the above copyright notice and the following 00011 * two paragraphs appear in all copies of this software. 00012 * 00013 * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR 00014 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00015 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS 00016 * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00017 * 00018 * THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, 00019 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00020 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HERE UNDER IS 00021 * ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO OBLIGATION TO 00022 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00023 * 00024 * SINMEC Lab. - CFD Sinflow Project - http://www.sinmec.ufsc.br/cfd 00025 */ 00026 00027 00028 // File Define 00029 #ifndef __CSFL_SYS_GEOM_DPOLYGON_H__ 00030 #define __CSFL_SYS_GEOM_DPOLYGON_H__ 00031 00032 00033 // Include 00034 #include <csfl/sys/geom/dline.h> 00035 #include <csfl/sys/core/oarray.h> 00036 #include <csfl/sys/core/string.h> 00037 00038 00039 // Namespace 00040 namespace csfl { 00041 00042 00043 class IDMultiPointLine : 00044 public ISimpleArrayOf<IDPoint> 00048 00049 { 00050 public: 00051 00056 IDMultiPointLine( const int & i=0, IDPoint * _p= NULL ); 00057 IDMultiPointLine( IDMultiPointLine *_m ); 00058 00060 double MaximumX( ) { DeterminateLimits() ; return Pmax.x; } 00062 double MinimumX( ) { DeterminateLimits() ; return Pmin.x; } 00064 double MaximumY( ) { DeterminateLimits() ; return Pmax.y; } 00066 double MinimumY( ) { DeterminateLimits() ; return Pmin.y; } 00067 00069 IDPoint MaximumContainerPoint() { DeterminateLimits() ; return Pmax; } 00071 IDPoint MinimumContainerPoint() { DeterminateLimits() ; return Pmin; } 00072 00077 bool isHorizontal( const double & ToleranceAngle = 0.5 ) const; 00078 00083 bool isVertical( const double & ToleranceAngle = 0.5) const; 00084 00086 int NumberofPoints( ) const 00087 { return count; } 00088 00090 void Rotate( const double &_angle, const IDPoint &_origin = IDPoint::zero ); 00091 00093 const IString & Name() { return name; } 00094 00096 void SetName( const IString &_name ) { name = IString( _name ); } 00097 00098 protected: 00099 IString name; 00100 00104 void DeterminateLimits(); 00105 IDPoint Pmax, Pmin; 00106 }; 00107 00108 class IDPolygon : 00109 public IDMultiPointLine, 00110 public ISFLObject 00111 00115 00116 { 00117 public: 00118 00123 IDPolygon( const int & i= 0, IDPoint * _p= NULL ) 00124 : IDMultiPointLine( i, _p ), ISFLObject() { SetName( "Polygon" ); } 00125 IDPolygon( IDPolygon * _p ) 00126 : IDMultiPointLine( _p ), ISFLObject() {} 00127 00129 int NumberofVertex( ) const 00130 { return count; } 00131 00133 bool isPointInsidePolygon( const IDPoint &_p ); 00134 00135 }; 00136 00137 } // csfl namespace 00138 00139 #endif // __CSFL_SYS_GEOM_DPOLYGON_H__
CFD Project
|
Documents |
Downloads |
Contact us |
Use Terms |
|
|||
© SINMEC/EMC/UFSC,
2001. |
All rights
reserved. |
Last Update: Jan. 18, 2002 |
|