1#ifndef COIN_SBBOX2I32_H
2#define COIN_SBBOX2I32_H
27#include <Inventor/SbVec2i32.h>
28#include <Inventor/SbVec2f.h>
36 SbBox2i32(
void) { makeEmpty(); }
37 SbBox2i32(int32_t
xmin, int32_t ymin, int32_t
xmax, int32_t ymax)
38 : minpt(
xmin, ymin), maxpt(
xmax, ymax) { }
45 SbBox2i32 & setBounds(int32_t
xmin, int32_t ymin, int32_t
xmax, int32_t ymax)
46 { minpt.setValue(
xmin, ymin); maxpt.setValue(
xmax, ymax);
return *
this; }
53 void getBounds(int32_t &
xmin, int32_t & ymin, int32_t &
xmax, int32_t & ymax)
const
54 { minpt.getValue(
xmin, ymin); maxpt.getValue(
xmax, ymax); }
58 const SbVec2i32 & getMin(
void)
const {
return minpt; }
59 SbVec2i32 & getMin(
void) {
return minpt; }
60 const SbVec2i32 & getMax(
void)
const {
return maxpt; }
61 SbVec2i32 & getMax(
void) {
return maxpt; }
64 void extendBy(
const SbBox2i32 &
box);
66 SbBool isEmpty(
void)
const {
return (maxpt[0] < minpt[0]); }
67 SbBool hasArea(
void)
const {
return ((maxpt[0] > minpt[0]) && (maxpt[1] > minpt[1])); }
69 SbBool intersect(
const SbVec2i32 & point)
const;
70 SbBool intersect(
const SbBox2i32 &
box)
const;
72 SbVec2f getCenter(
void)
const {
return SbVec2f((minpt[0] + maxpt[0]) * 0.5f, (minpt[0] + maxpt[0]) * 0.5f); }
75 void getSize(int32_t &
sizeX, int32_t &
sizeY)
const
77 else {
sizeX = maxpt[0] - minpt[0];
sizeY = maxpt[1] - minpt[1]; } }
78 float getAspectRatio(
void)
const
79 { SbDividerChk(
"SbBox2i32::getAspectRatio()", maxpt[1] - minpt[1]);
80 return float(maxpt[0] - minpt[0]) / float(maxpt[1] - minpt[1]); }
88 return ((
b1.getMin() ==
b2.getMin()) && (
b1.getMax() ==
b2.getMax()));
The SbBox2d class is a 2 dimensional box with double precision corner coordinates.
Definition SbBox2d.h:33
The SbBox2f class is a 2 dimensional box with floating point corner coordinates.
Definition SbBox2f.h:33
The SbBox2s class is a 2 dimensional box with short integer coordinates.
Definition SbBox2s.h:34
The SbList class is a template container class for lists.
Definition SbList.h:61
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:39
The SbVec2i32 class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2i32.h:41