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

# SbBox2f.h

    00001 #ifndef COIN_SBBOX2F_H
    00002 #define COIN_SBBOX2F_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 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 <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/SbBasic.h>
    00028 #include <Inventor/SbVec2f.h>
    00029
    00030 class COIN_DLL_API SbBox2f {
    00031 public:
    00032   SbBox2f(void);
    00033   SbBox2f(float xmin, float ymin, float xmax, float ymax);
    00034   SbBox2f(const SbVec2f & min, const SbVec2f & max);
    00035   ~SbBox2f(void);
    00036
    00037   const SbVec2f & getMin(void) const;
    00038   const SbVec2f & getMax(void) const;
    00039   SbVec2f getCenter(void) const;
    00040   void extendBy(const SbVec2f & point);
    00041   void extendBy(const SbBox2f & box);
    00042   SbBool intersect(const SbVec2f & point) const;
    00043   SbBool intersect(const SbBox2f & box) const;
    00044   SbVec2f getClosestPoint(const SbVec2f & p) const;
    00045   void setBounds(float xmin, float ymin, float xmax, float ymax);
    00046   void setBounds(const SbVec2f & min, const SbVec2f & max);
    00047   void getBounds(float & xmin, float & ymin, float & xmax, float & ymax) const;
    00048   void getBounds(SbVec2f & min, SbVec2f & max) const;
    00049   void getOrigin(float & x0, float & y0) const;
    00050   void getSize(float & w, float & h) const;
    00051   float getAspectRatio(void) const;
    00052   void makeEmpty(void);
    00053   SbBool isEmpty(void) const;
    00054   SbBool hasArea(void) const;
    00055
    00056   friend COIN_DLL_API int operator ==(const SbBox2f & b1, const SbBox2f & b2);
    00057   friend COIN_DLL_API int operator !=(const SbBox2f & b1, const SbBox2f & b2);
    00058
    00059 private:
    00060   SbVec2f minpt, maxpt;
    00061
    00062   float width(void) const;
    00063   float height(void) const;
    00064 };
    00065
    00066 COIN_DLL_API int operator ==(const SbBox2f & b1, const SbBox2f & b2);
    00067 COIN_DLL_API int operator !=(const SbBox2f & b1, const SbBox2f & b2);
    00068
    00069 #endif // !COIN_SBBOX2F_H