36#include <Inventor/SbVec2s.h>
37#include <Inventor/SbVec2f.h>
46 SbBox2s(
short xmin,
short ymin,
short xmax,
short ymax)
47 : minpt(xmin, ymin), maxpt(xmax, ymax) { }
49 : minpt(minpoint), maxpt(maxpoint) { }
55 { minpt.setValue(xmin, ymin); maxpt.setValue(xmax, ymax);
return *
this; }
57 { minpt = minpoint; maxpt = maxpoint;
return *
this; }
62 void getBounds(
short & xmin,
short & ymin,
short & xmax,
short & ymax)
const
63 { minpt.getValue(xmin, ymin); maxpt.getValue(xmax, ymax); }
65 { minpoint = minpt; maxpoint = maxpt; }
72 void extendBy(
const SbVec2s & point);
73 void extendBy(
const SbBox2s & box);
75 SbBool
isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
76 SbBool
hasArea(
void)
const {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1])); }
78 SbBool intersect(
const SbVec2s & point)
const;
79 SbBool intersect(
const SbBox2s & box)
const;
82 void getOrigin(
short & originX,
short & originY)
const
83 { minpt.getValue(originX, originY); }
84 void getSize(
short & sizeX,
short & sizeY)
const
85 {
if (
isEmpty()) { sizeX = sizeY = 0; }
86 else { sizeX = maxpt[0] - minpt[0]; sizeY = maxpt[1] - minpt[1]; } }
94 { SbDividerChk(
"SbBox2s::getAspectRatio()", maxpt[1] - minpt[1]);
95 return (
float(maxpt[0] - minpt[0]) /
float(maxpt[1] - minpt[1])); }
The SbBox2d class is a 2 dimensional box with double precision corner coordinates.
Definition SbBox2d.h:42
The SbBox2f class is a 2 dimensional box with floating point corner coordinates.
Definition SbBox2f.h:42
The SbBox2i32 class is a 2 dimensional box with 32-bit integer coordinates.
Definition SbBox2i32.h:43
The SbBox2s class is a 2 dimensional box with short integer coordinates.
Definition SbBox2s.h:43
SbVec2s getSize(void) const
Definition SbBox2s.h:87
SbBool hasArea(void) const
Definition SbBox2s.h:76
SbBox2s(const SbBox2i32 &box)
Definition SbBox2s.h:50
SbBox2s(const SbBox2f &box)
Definition SbBox2s.h:51
SbBox2s & setBounds(short xmin, short ymin, short xmax, short ymax)
Definition SbBox2s.h:54
const SbVec2s & getMin(void) const
Definition SbBox2s.h:67
float getAspectRatio(void) const
Definition SbBox2s.h:93
void getBounds(short &xmin, short &ymin, short &xmax, short &ymax) const
Definition SbBox2s.h:62
const SbVec2s & getMax(void) const
Definition SbBox2s.h:69
SbVec2s & getMax(void)
Definition SbBox2s.h:70
SbVec2f getCenter(void) const
Definition SbBox2s.h:81
SbBool isEmpty(void) const
Definition SbBox2s.h:75
void getOrigin(short &originX, short &originY) const
Definition SbBox2s.h:82
SbBox2s(void)
Definition SbBox2s.h:45
void getSize(short &sizeX, short &sizeY) const
Definition SbBox2s.h:84
void makeEmpty(void)
Definition SbBox2s.cpp:202
SbBox2s(const SbVec2s &minpoint, const SbVec2s &maxpoint)
Definition SbBox2s.h:48
SbVec2s & getMin(void)
Definition SbBox2s.h:68
SbBox2s(const SbBox2d &box)
Definition SbBox2s.h:52
void getBounds(SbVec2s &minpoint, SbVec2s &maxpoint) const
Definition SbBox2s.h:64
SbBox2s(short xmin, short ymin, short xmax, short ymax)
Definition SbBox2s.h:46
SbBox2s & setBounds(const SbVec2s &minpoint, const SbVec2s &maxpoint)
Definition SbBox2s.h:56
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51