Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SbBox2d Class Reference

VSG extension 2D box class. More...

#include <Inventor/SbBox.h>

Public Member Functions

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

Detailed Description

VSG extension 2D box class.

2D box which has planes parallel to the major axes and is specified by two points (specified in double precision) 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, SbVec2d, SbVec2s, SbMatrix

Definition at line 1996 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbBox2d() [1/3]

SbBox2d::SbBox2d ( )
inline

Constructor for a 2D double box.

The box is initially empty.

Definition at line 2002 of file SbBox.h.

◆ SbBox2d() [2/3]

SbBox2d::SbBox2d ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)
inline

Constructor for a 2D double box.

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

Definition at line 2009 of file SbBox.h.

◆ SbBox2d() [3/3]

SbBox2d::SbBox2d ( const SbVec2d _min,
const SbVec2d _max 
)
inline

Constructor for a 2D double box.

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

Definition at line 2016 of file SbBox.h.

◆ ~SbBox2d()

SbBox2d::~SbBox2d ( )
inline

Destructor.

Definition at line 2022 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/2]

void SbBox2d::extendBy ( const SbBox2d r)

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

◆ extendBy() [2/2]

void SbBox2d::extendBy ( const SbVec2d pt)

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

◆ getAspectRatio()

double SbBox2d::getAspectRatio ( ) const
inline

Gets box aspect ratio.

Definition at line 2136 of file SbBox.h.

◆ getBounds() [1/2]

void SbBox2d::getBounds ( double &  xmin,
double &  ymin,
double &  xmax,
double &  ymax 
) const
inline

Gets the corners of the box.

Definition at line 2083 of file SbBox.h.

◆ getBounds() [2/2]

void SbBox2d::getBounds ( SbVec2d _min,
SbVec2d _max 
) const
inline

Gets the corners of the box.

Definition at line 2091 of file SbBox.h.

◆ getCenter()

SbVec2d SbBox2d::getCenter ( ) const

Returns the center of the box.

◆ getClosestPoint()

SbVec2d SbBox2d::getClosestPoint ( const SbVec2d 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 SbVec2d & SbBox2d::getMax ( ) const
inline

Returns the maximum point of the box.

Definition at line 2034 of file SbBox.h.

◆ getMin()

const SbVec2d & SbBox2d::getMin ( ) const
inline

Returns the minimum point of the box.

Definition at line 2028 of file SbBox.h.

◆ getOrigin()

void SbBox2d::getOrigin ( double &  originX,
double &  originY 
) const
inline

Gets box origin.

Definition at line 2103 of file SbBox.h.

◆ getSize() [1/2]

SbVec2d SbBox2d::getSize ( ) const
inline

Return box size.

Definition at line 2125 of file SbBox.h.

◆ getSize() [2/2]

void SbBox2d::getSize ( double &  sizeX,
double &  sizeY 
) const
inline

Gets box size.

Definition at line 2109 of file SbBox.h.

◆ hasArea()

SbBool SbBox2d::hasArea ( ) const
inline

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

Definition at line 2153 of file SbBox.h.

◆ intersect() [1/2]

SbBool SbBox2d::intersect ( const SbBox2d bb) const

Returns TRUE if the specified box intersects this box.

◆ intersect() [2/2]

SbBool SbBox2d::intersect ( const SbVec2d pt) const

Returns TRUE if the specified point intersects this box.

◆ intersection()

SbBox2d SbBox2d::intersection ( const SbBox2d box) const

Returns the intersection of the specified box with this box.

Returned box is empty if there is no intersection.

◆ isEmpty()

SbBool SbBox2d::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 2147 of file SbBox.h.

◆ makeEmpty()

void SbBox2d::makeEmpty ( )

Makes an empty box.

◆ setBounds() [1/2]

void SbBox2d::setBounds ( const SbVec2d _min,
const SbVec2d _max 
)
inline

Sets the corners of the box.

Definition at line 2077 of file SbBox.h.

◆ setBounds() [2/2]

void SbBox2d::setBounds ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)
inline

Sets the corners of the box.

Definition at line 2071 of file SbBox.h.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison.

Definition at line 2164 of file SbBox.h.

◆ operator==

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

Equality comparison.


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