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

SbBox2d.h
1 #ifndef COIN_SBBOX2D_H
2 #define COIN_SBBOX2D_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/SbVec2d.h>
28 
29 class SbBox2f;
30 class SbBox2s;
31 class SbBox2i32;
32 
33 class COIN_DLL_API SbBox2d {
34 public:
35  SbBox2d(void);
36  SbBox2d(double xmin, double ymin, double xmax, double ymax);
37  SbBox2d(const SbVec2d & min, const SbVec2d & max);
38  explicit SbBox2d(const SbBox2f & box) { setBounds(box); }
39  explicit SbBox2d(const SbBox2s & box) { setBounds(box); }
40  explicit SbBox2d(const SbBox2i32 & box) { setBounds(box); }
41  ~SbBox2d(void);
42 
43  void setBounds(double xmin, double ymin, double xmax, double ymax);
44  void setBounds(const SbVec2d & min, const SbVec2d & max);
45  SbBox2d & setBounds(const SbBox2f & box);
46  SbBox2d & setBounds(const SbBox2s & box);
47  SbBox2d & setBounds(const SbBox2i32 & box);
48 
49  void getBounds(double & xmin, double & ymin, double & xmax, double & ymax) const;
50  void getBounds(SbVec2d & min, SbVec2d & max) const;
51 
52  const SbVec2d & getMin(void) const;
53  SbVec2d & getMin(void) { return maxpt; }
54  const SbVec2d & getMax(void) const;
55  SbVec2d & getMax(void) { return maxpt; }
56 
57  void extendBy(const SbVec2d & point);
58  void extendBy(const SbBox2d & box);
59  void makeEmpty(void);
60  SbBool isEmpty(void) const;
61  SbBool hasArea(void) const;
62 
63  SbBool intersect(const SbVec2d & point) const;
64  SbBool intersect(const SbBox2d & box) const;
65  SbVec2d getClosestPoint(const SbVec2d & p) const;
66  SbBool findIntersection(const SbVec2d & a, const SbVec2d & b, SbVec2d & ia, SbVec2d & ib) const;
67 
68  SbVec2d getCenter(void) const;
69  void getOrigin(double & x0, double & y0) const;
70  void getSize(double & w, double & h) const;
71  double getAspectRatio(void) const;
72 
73  friend COIN_DLL_API int operator ==(const SbBox2d & b1, const SbBox2d & b2);
74  friend COIN_DLL_API int operator !=(const SbBox2d & b1, const SbBox2d & b2);
75 
76 private:
77  SbVec2d minpt, maxpt;
78 
79  double width(void) const;
80  double height(void) const;
81 };
82 
83 COIN_DLL_API int operator == (const SbBox2d & b1, const SbBox2d & b2);
84 COIN_DLL_API int operator != (const SbBox2d & b1, const SbBox2d & b2);
85 
86 #endif // !COIN_SBBOX2D_H
SbBox2s::getMax
const SbVec2s & getMax(void) const
Definition: SbBox2s.cpp:234
SbBox2s
The SbBox2s class is a 2 dimensional box with short integer coordinates.
Definition: SbBox2s.h:34
SbBox2i32::getMin
const SbVec2i32 & getMin(void) const
Definition: SbBox2i32.h:58
SbBox2d::SbBox2d
SbBox2d(void)
Definition: SbBox2d.cpp:57
SbBox2i32::isEmpty
SbBool isEmpty(void) const
Definition: SbBox2i32.h:66
SbBox2d::getMin
const SbVec2d & getMin(void) const
Definition: SbBox2d.cpp:158
SbBox2i32::getMax
const SbVec2i32 & getMax(void) const
Definition: SbBox2i32.h:60
SbBox2d::extendBy
void extendBy(const SbVec2d &point)
Definition: SbBox2d.cpp:205
SbBox2s::isEmpty
SbBool isEmpty(void) const
Definition: SbBox2s.h:61
SoDebugError::postWarning
static void postWarning(const char *const source, const char *const format,...)
Definition: SoDebugError.cpp:324
SbBox2d::getBounds
void getBounds(double &xmin, double &ymin, double &xmax, double &ymax) const
Definition: SbBox2d.cpp:536
SbBox2d
The SbBox2d class is a 2 dimensional box with double precision corner coordinates.
Definition: SbBox2d.h:33
SbVec2d::setValue
SbVec2d & setValue(const double v[2])
Definition: SbVec2d.cpp:242
SbBox2f::getMax
const SbVec2f & getMax(void) const
Definition: SbBox2f.cpp:174
SbBox2d::getMin
SbVec2d & getMin(void)
Definition: SbBox2d.h:53
SbBox2d::getClosestPoint
SbVec2d getClosestPoint(const SbVec2d &p) const
Definition: SbBox2d.cpp:405
SbBox2d::intersect
SbBool intersect(const SbVec2d &point) const
Definition: SbBox2d.cpp:236
SbBox2d::makeEmpty
void makeEmpty(void)
Definition: SbBox2d.cpp:124
SbBox2s::operator!=
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.cpp:443
SbBox2f::isEmpty
SbBool isEmpty(void) const
Definition: SbBox2f.cpp:131
SbBox2d::getCenter
SbVec2d getCenter(void) const
Definition: SbBox2d.cpp:194
SbBox2d::getAspectRatio
double getAspectRatio(void) const
Definition: SbBox2d.cpp:587
SbBox2d::hasArea
SbBool hasArea(void) const
Definition: SbBox2d.cpp:147
SbBox2d::setBounds
void setBounds(double xmin, double ymin, double xmax, double ymax)
Definition: SbBox2d.cpp:437
SbBox2s::operator==
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.cpp:432
SbBox2d::SbBox2d
SbBox2d(const SbBox2i32 &box)
Definition: SbBox2d.h:40
SbVec2d::getValue
const double * getValue(void) const
Definition: SbVec2d.cpp:161
SbVec2d
The SbVec2d class is a 2 dimensional vector with double precision floating point coordinates.
Definition: SbVec2d.h:36
SbBox2s::getMin
const SbVec2s & getMin(void) const
Definition: SbBox2s.cpp:215
SbBox2d::isEmpty
SbBool isEmpty(void) const
Definition: SbBox2d.cpp:136
SbBox2f
The SbBox2f class is a 2 dimensional box with floating point corner coordinates.
Definition: SbBox2f.h:33
SbBox2d::getMax
SbVec2d & getMax(void)
Definition: SbBox2d.h:55
SbBox2d::findIntersection
SbBool findIntersection(const SbVec2d &a, const SbVec2d &b, SbVec2d &ia, SbVec2d &ib) const
Definition: SbBox2d.cpp:264
SbBox2i32
The SbBox2i32 class is a 2 dimensional box with int32_t coordinates.
Definition: SbBox2i32.h:34
SbBox2d::getOrigin
void getOrigin(double &x0, double &y0) const
Definition: SbBox2d.cpp:560
SbBox2d::SbBox2d
SbBox2d(const SbBox2s &box)
Definition: SbBox2d.h:39
SbBox2d::getMax
const SbVec2d & getMax(void) const
Definition: SbBox2d.cpp:177
SbBox2d::~SbBox2d
~SbBox2d(void)
Definition: SbBox2d.cpp:114
SbBox2d::SbBox2d
SbBox2d(const SbBox2f &box)
Definition: SbBox2d.h:38
SbBox2d::getSize
void getSize(double &w, double &h) const
Definition: SbBox2d.cpp:570
SbBox2f::getMin
const SbVec2f & getMin(void) const
Definition: SbBox2f.cpp:153

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

Generated on Mon Jul 27 2020 for Coin by Doxygen. 1.8.18