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

2D box class. More...

#include <Inventor/SbBox.h>

Public Member Functions

 SbBox2f ()
 Constructor for a 2D float box.
 
 SbBox2f (float xmin, float ymin, float xmax, float ymax)
 Constructor for a 2D float box.
 
 SbBox2f (const SbVec2f &_min, const SbVec2f &_max)
 Constructor for a 2D float box.
 
 ~SbBox2f ()
 Destructor.
 
const SbVec2fgetMin () const
 Returns the minimum point of the box.
 
const SbVec2fgetMax () const
 Returns the maximum point of the box.
 
SbVec2f getCenter () const
 Returns the center of the box.
 
void extendBy (const SbVec2f &pt)
 Extends this box (if necessary) to contain the specified point.
 
void extendBy (const SbBox2f &r)
 Extends this box (if necessary) to contain the specified box.
 
SbBool intersect (const SbVec2f &pt) const
 Returns TRUE if the specified point intersects this box.
 
SbBool intersect (const SbBox2f &bb) const
 Returns TRUE if the specified box intersects this box.
 
SbBox2f intersection (const SbBox2f &box) const
 Returns the intersection of the specified box with this box.
 
void setBounds (float xmin, float ymin, float xmax, float ymax)
 Sets the corners of the box.
 
void setBounds (const SbVec2f &_min, const SbVec2f &_max)
 Sets the corners of the box.
 
void getBounds (float &xmin, float &ymin, float &xmax, float &ymax) const
 Gets the corners of the box.
 
void getBounds (SbVec2f &_min, SbVec2f &_max) const
 Gets the corners of the box.
 
SbVec2f getClosestPoint (const SbVec2f &point) const
 Returns the closest point on the box to the given point.
 
void getOrigin (float &originX, float &originY) const
 Gets box origin.
 
void getSize (float &sizeX, float &sizeY) const
 Gets box size.
 
SbVec2f getSize () const
 Return box size.
 
float getAspectRatio () const
 Gets box aspect ratio.
 
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 SbBox2f &b1, const SbBox2f &b2)
 Equality comparison.
 
int operator!= (const SbBox2f &b1, const SbBox2f &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 as floating point) 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, SbBox2s, SbVec3f, SbVec2f, SbVec2s, SbMatrix

Definition at line 1798 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbBox2f() [1/3]

SbBox2f::SbBox2f ( )
inline

Constructor for a 2D float box.

The box is initially empty.

Definition at line 1804 of file SbBox.h.

◆ SbBox2f() [2/3]

SbBox2f::SbBox2f ( float  xmin,
float  ymin,
float  xmax,
float  ymax 
)
inline

Constructor for a 2D float box.

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

Definition at line 1811 of file SbBox.h.

◆ SbBox2f() [3/3]

SbBox2f::SbBox2f ( const SbVec2f _min,
const SbVec2f _max 
)
inline

Constructor for a 2D float box.

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

Definition at line 1818 of file SbBox.h.

◆ ~SbBox2f()

SbBox2f::~SbBox2f ( )
inline

Destructor.

Definition at line 1824 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/2]

void SbBox2f::extendBy ( const SbBox2f r)

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

◆ extendBy() [2/2]

void SbBox2f::extendBy ( const SbVec2f pt)

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

◆ getAspectRatio()

float SbBox2f::getAspectRatio ( ) const
inline

Gets box aspect ratio.

Definition at line 1938 of file SbBox.h.

◆ getBounds() [1/2]

void SbBox2f::getBounds ( float &  xmin,
float &  ymin,
float &  xmax,
float &  ymax 
) const
inline

Gets the corners of the box.

Definition at line 1885 of file SbBox.h.

◆ getBounds() [2/2]

void SbBox2f::getBounds ( SbVec2f _min,
SbVec2f _max 
) const
inline

Gets the corners of the box.

Definition at line 1893 of file SbBox.h.

◆ getCenter()

SbVec2f SbBox2f::getCenter ( ) const

Returns the center of the box.

◆ getClosestPoint()

SbVec2f SbBox2f::getClosestPoint ( const SbVec2f point) const

Returns the closest point on the box to the given point.

(Returns the point on the center of the Z face if passed the center.)

◆ getMax()

const SbVec2f & SbBox2f::getMax ( ) const
inline

Returns the maximum point of the box.

Definition at line 1836 of file SbBox.h.

◆ getMin()

const SbVec2f & SbBox2f::getMin ( ) const
inline

Returns the minimum point of the box.

Definition at line 1830 of file SbBox.h.

◆ getOrigin()

void SbBox2f::getOrigin ( float &  originX,
float &  originY 
) const
inline

Gets box origin.

Definition at line 1905 of file SbBox.h.

◆ getSize() [1/2]

SbVec2f SbBox2f::getSize ( ) const
inline

Return box size.

Definition at line 1927 of file SbBox.h.

◆ getSize() [2/2]

void SbBox2f::getSize ( float &  sizeX,
float &  sizeY 
) const
inline

Gets box size.

Definition at line 1911 of file SbBox.h.

◆ hasArea()

SbBool SbBox2f::hasArea ( ) const
inline

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

Definition at line 1955 of file SbBox.h.

◆ intersect() [1/2]

SbBool SbBox2f::intersect ( const SbBox2f bb) const

Returns TRUE if the specified box intersects this box.

◆ intersect() [2/2]

SbBool SbBox2f::intersect ( const SbVec2f pt) const

Returns TRUE if the specified point intersects this box.

◆ intersection()

SbBox2f SbBox2f::intersection ( const SbBox2f box) const

Returns the intersection of the specified box with this box.

Returned box is empty if there is no intersection.

◆ isEmpty()

SbBool SbBox2f::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 1949 of file SbBox.h.

◆ makeEmpty()

void SbBox2f::makeEmpty ( )

Makes an empty box.

◆ setBounds() [1/2]

void SbBox2f::setBounds ( const SbVec2f _min,
const SbVec2f _max 
)
inline

Sets the corners of the box.

Definition at line 1879 of file SbBox.h.

◆ setBounds() [2/2]

void SbBox2f::setBounds ( float  xmin,
float  ymin,
float  xmax,
float  ymax 
)
inline

Sets the corners of the box.

Definition at line 1873 of file SbBox.h.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison.

Definition at line 1966 of file SbBox.h.

◆ operator==

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

Equality comparison.


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