Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

drect.h

Go to the documentation of this file.
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_DRECT_H__
00030 #define __CSFL_SYS_GEOM_DRECT_H__
00031 
00032 // Include 
00033 #include <csfl/sys/geom/dpoint.h>
00034 
00035 
00036 // Namespace
00037 namespace csfl {
00038 
00039 
00040 class IDRect
00041 {
00045 public:
00046 
00047         static const IDRect zero;
00048 
00053 
00054         IDRect( 
00055                 const IDPoint &p_P1, 
00056                 const IDPoint &p_P2 );
00057         
00062         IDRect( 
00063                 double p_x = 0.0, 
00064                 double p_y = 0.0, 
00065                 double p_W = 0.0, 
00066                 double p_H = 0.0)
00067                 { p1.x = p_x; p1.y = p_y; p2.x = p_x + p_W; p2.y = p_y + p_H; }
00068 
00072         IDPoint LeftBottom() const { return p1; }
00073         
00077         IDPoint RightTop() const { return p2; }
00078         
00080         double Width() const { return fabs( p2.x - p1.x ); }
00081         double Height() const { return fabs( p2.y - p1.y ); }
00082 
00086         inline bool Contains( const IDPoint & p ) const;
00087         
00088         
00089 protected:
00090 
00091         IDPoint p1, p2;
00092 
00093 };
00094 
00095 inline bool IDRect::Contains( const IDPoint & p ) const
00096 {
00097         return (( p.x >= p1.x && p.x <= p2.x ) && ( p.y >= p1.y && p.y <= p2.y ));
00098 }
00099 
00100 } // csfl namespace
00101 
00102 #endif// __CSFL_SYS_GEOM_DRECT_H__

 

CFD Project | Documents | Downloads | Contact us | Use Terms

 

© SINMEC/EMC/UFSC, 2001.

All rights reserved.

Last Update: Jan. 18, 2002

 Webmaster