Coin Logo http://www.sim.no
http://www.coin3d.org

SbBox2d.h

00001 #ifndef COIN_SBBOX2D_H
00002 #define COIN_SBBOX2D_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/SbVec2d.h>
00029 
00030 class COIN_DLL_API SbBox2d {
00031 public:
00032   SbBox2d(void);
00033   SbBox2d(double xmin, double ymin, double xmax, double ymax);
00034   SbBox2d(const SbVec2d & min, const SbVec2d & max);
00035   ~SbBox2d(void);
00036 
00037   const SbVec2d & getMin(void) const;
00038   const SbVec2d & getMax(void) const;
00039   SbVec2d getCenter(void) const;
00040   void extendBy(const SbVec2d & point);
00041   void extendBy(const SbBox2d & box);
00042   SbBool intersect(const SbVec2d & point) const;
00043   SbBool intersect(const SbBox2d & box) const;
00044   SbBool findIntersection(const SbVec2d & a, const SbVec2d & b, SbVec2d & ia, SbVec2d & ib) const;
00045   SbVec2d getClosestPoint(const SbVec2d & p) const;
00046   void setBounds(double xmin, double ymin, double xmax, double ymax);
00047   void setBounds(const SbVec2d & min, const SbVec2d & max);
00048   void getBounds(double & xmin, double & ymin, double & xmax, double & ymax) const;
00049   void getBounds(SbVec2d & min, SbVec2d & max) const;
00050   void getOrigin(double & x0, double & y0) const;
00051   void getSize(double & w, double & h) const;
00052   double getAspectRatio(void) const;
00053   void makeEmpty(void);
00054   SbBool isEmpty(void) const;
00055   SbBool hasArea(void) const;
00056 
00057   friend COIN_DLL_API int operator ==(const SbBox2d & b1, const SbBox2d & b2);
00058   friend COIN_DLL_API int operator !=(const SbBox2d & b1, const SbBox2d & b2);
00059 
00060 private:
00061   SbVec2d minpt, maxpt;
00062 
00063   double width(void) const;
00064   double height(void) const;
00065 };
00066 
00067 COIN_DLL_API int operator == (const SbBox2d & b1, const SbBox2d & b2);
00068 COIN_DLL_API int operator != (const SbBox2d & b1, const SbBox2d & b2);
00069 
00070 #endif // !COIN_SBBOX2D_H

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Tue Apr 17 03:29:34 2007 for Coin by Doxygen. 1.4.6