Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SbBox2s Class Reference

2D box class. More...

#include <Inventor/SbBox.h>

Public Member Functions

 SbBox2s ()
 Constructor for a 2D integer box.
 
 SbBox2s (short xmin, short ymin, short xmax, short ymax)
 Constructor for a 2D integer box.
 
 SbBox2s (const SbVec2s &_min, const SbVec2s &_max)
 Constructor for a 2D integer box.
 
 ~SbBox2s ()
 Destructor.
 
const SbVec2sgetMin () const
 Returns the minimum point of the box.
 
const SbVec2sgetMax () const
 Returns the maximum point of the box.
 
void extendBy (const SbVec2s &pt)
 Extends this box (if necessary) to contain the specified point.
 
void extendBy (const SbBox2s &r)
 Extends this box (if necessary) to contain the specified box.
 
SbBool intersect (const SbVec2s &pt) const
 Returns TRUE if the specified point intersects this box.
 
SbBool intersect (const SbBox2s &bb) const
 Returns TRUE if the specified box intersects this box.
 
SbBox2s intersection (const SbBox2s &box) const
 Returns the intersection of the specified box with this box.
 
void setBounds (short xmin, short ymin, short xmax, short ymax)
 Sets the corners of the box.
 
void setBounds (const SbVec2s &_min, const SbVec2s &_max)
 Sets the corners of the box.
 
void getBounds (short &xmin, short &ymin, short &xmax, short &ymax) const
 Gets the corners of the box.
 
void getBounds (SbVec2s &_min, SbVec2s &_max) const
 Gets the corners of the box.
 
void getOrigin (short &originX, short &originY) const
 Returns origin (minimum point) of box.
 
void getSize (short &sizeX, short &sizeY) const
 Returns box size.
 
SbVec2s getSize () const
 Return box size.
 
float getAspectRatio () const
 Returns aspect ratio (ratio of width to height) of box.
 
void makeEmpty ()
 Makes an empty box.
 
SbBool isEmpty () const
 Returns TRUE if the box is empty, and FALSE otherwise.
 
SbBool hasArea () const
 Returns TRUE if both dimensions of the box have positive size, and FALSE otherwise.
 

Friends

int operator== (const SbBox2s &b1, const SbBox2s &b2)
 Equality comparison.
 
int operator!= (const SbBox2s &b1, const SbBox2s &b2)
 Inequality comparison.
 

Detailed Description

2D box class.

2D box which has planes parallel to the major axes and is specified by two points (specified with short integers) on a diagonal. This class is part of the standard Open Inventor datatype classes and is used as input and output to geometry operations.

SEE ALSO

SbBox3f, SbXfBox3f, SbBox2f, SbVec3f, SbVec2f, SbVec2s, SbMatrix

Definition at line 2194 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbBox2s() [1/3]

SbBox2s::SbBox2s ( )
inline

Constructor for a 2D integer box.

The box is initially empty.

Definition at line 2200 of file SbBox.h.

◆ SbBox2s() [2/3]

SbBox2s::SbBox2s ( short  xmin,
short  ymin,
short  xmax,
short  ymax 
)
inline

Constructor for a 2D integer box.

xmin , ymin , xmax , and ymax are the bounds of the box.

Definition at line 2207 of file SbBox.h.

◆ SbBox2s() [3/3]

SbBox2s::SbBox2s ( const SbVec2s _min,
const SbVec2s _max 
)
inline

Constructor for a 2D integer box.

m_min and m_max are the corners of the diagonal that defines the box.

Definition at line 2214 of file SbBox.h.

◆ ~SbBox2s()

SbBox2s::~SbBox2s ( )
inline

Destructor.

Definition at line 2220 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/2]

void SbBox2s::extendBy ( const SbBox2s r)

Extends this box (if necessary) to contain the specified box.

◆ extendBy() [2/2]

void SbBox2s::extendBy ( const SbVec2s pt)

Extends this box (if necessary) to contain the specified point.

◆ getAspectRatio()

float SbBox2s::getAspectRatio ( ) const
inline

Returns aspect ratio (ratio of width to height) of box.

Definition at line 2323 of file SbBox.h.

◆ getBounds() [1/2]

void SbBox2s::getBounds ( SbVec2s _min,
SbVec2s _max 
) const
inline

Gets the corners of the box.

Definition at line 2284 of file SbBox.h.

◆ getBounds() [2/2]

void SbBox2s::getBounds ( short &  xmin,
short &  ymin,
short &  xmax,
short &  ymax 
) const
inline

Gets the corners of the box.

Definition at line 2276 of file SbBox.h.

◆ getMax()

const SbVec2s & SbBox2s::getMax ( ) const
inline

Returns the maximum point of the box.

Definition at line 2232 of file SbBox.h.

◆ getMin()

const SbVec2s & SbBox2s::getMin ( ) const
inline

Returns the minimum point of the box.

Definition at line 2226 of file SbBox.h.

◆ getOrigin()

void SbBox2s::getOrigin ( short &  originX,
short &  originY 
) const
inline

Returns origin (minimum point) of box.

Definition at line 2290 of file SbBox.h.

◆ getSize() [1/2]

SbVec2s SbBox2s::getSize ( ) const
inline

Return box size.

Definition at line 2312 of file SbBox.h.

◆ getSize() [2/2]

void SbBox2s::getSize ( short &  sizeX,
short &  sizeY 
) const
inline

Returns box size.

Definition at line 2296 of file SbBox.h.

◆ hasArea()

SbBool SbBox2s::hasArea ( ) const
inline

Returns TRUE if both dimensions of the box have positive size, and FALSE otherwise.

Definition at line 2340 of file SbBox.h.

◆ intersect() [1/2]

SbBool SbBox2s::intersect ( const SbBox2s bb) const

Returns TRUE if the specified box intersects this box.

◆ intersect() [2/2]

SbBool SbBox2s::intersect ( const SbVec2s pt) const

Returns TRUE if the specified point intersects this box.

◆ intersection()

SbBox2s SbBox2s::intersection ( const SbBox2s box) const

Returns the intersection of the specified box with this box.

Returned box is empty if there is no intersection.

◆ isEmpty()

SbBool SbBox2s::isEmpty ( ) const
inline

Returns TRUE if the box is empty, and FALSE otherwise.

Note: Setting the box to all zeros does not make it "empty". Use the makeEmpty() method. (This method only returns true if the maximum X value is less than the minimum X value.)

Definition at line 2334 of file SbBox.h.

◆ makeEmpty()

void SbBox2s::makeEmpty ( )

Makes an empty box.

◆ setBounds() [1/2]

void SbBox2s::setBounds ( const SbVec2s _min,
const SbVec2s _max 
)
inline

Sets the corners of the box.

Definition at line 2270 of file SbBox.h.

◆ setBounds() [2/2]

void SbBox2s::setBounds ( short  xmin,
short  ymin,
short  xmax,
short  ymax 
)
inline

Sets the corners of the box.

Definition at line 2264 of file SbBox.h.

Friends And Related Symbol Documentation

◆ operator!=

int operator!= ( const SbBox2s b1,
const SbBox2s b2 
)
friend

Inequality comparison.

Definition at line 2352 of file SbBox.h.

◆ operator==

int operator== ( const SbBox2s b1,
const SbBox2s b2 
)
friend

Equality comparison.


The documentation for this class was generated from the following file: