Aimsun Next Scripting: GKBBox Class Reference
Aimsun Next Scripting  22
Public Member Functions | Public Attributes | List of all members
GKBBox Class Reference

Public Member Functions

 GKBBox ()
 
 GKBBox (const GKBBox &)
 
 GKBBox (const GKPoint &, const GKPoint &)
 
 GKBBox (GKCoord, GKCoord, GKCoord, GKCoord)
 
 GKBBox (GKCoord, GKCoord, GKCoord, GKCoord, GKCoord, GKCoord)
 
virtual ~GKBBox ()
 
void set (const GKPoint &, const GKPoint &)
 
void set (GKCoord, GKCoord, GKCoord, GKCoord)
 
void set (GKCoord, GKCoord, GKCoord, GKCoord, GKCoord, GKCoord)
 
void set (const GKPoints &)
 
void expand3D (const GKPoint &)
 
void expand3D (const GKBBox &)
 
void expand3D (const GKPoints &)
 
void translate (const GKPoint &)
 
void undefine ()
 
bool isUndefined () const
 
GKCoord x () const
 
GKCoord y () const
 
GKCoord z () const
 
GKCoord width () const
 
GKCoord height () const
 
GKCoord altitude () const
 
double radioEsfMinContenedora () const
 
const GKPoint center () const
 
const GKCoord radious () const
 
bool contains2D (const GKPoint &) const
 
bool contains3D (const GKPoint &) const
 
bool contains3D (const GKBBox &) const
 
bool intersects2D (const GKBBox &) const
 
bool intersects2D (const GKLine &, GKPoint *, double=0.00001) const
 
bool intersects3D (const GKBBox &box, GKBBox &resultBox, bool noZ=false) const
 
void ensureMinimumSize ()
 
void expandWidth (GKCoord)
 
void expandHeight (GKCoord)
 
GKPoints as2DPolygon () const
 
bool operator!= (const GKBBox &) const
 

Public Attributes

GKPoint from
 
GKPoint to
 

Detailed Description

A bounding box is the minimum size rectangle that englobes completely a graphic shape. It is defined by two points, called from and to, for the bottom-left and top-right coordinates of the rectangle.

A bbox have two states: defined or undefined. An undefined bbox means that the bottom-left and top-right coordinates stored on it cannot be used since they have not been calculated yet. A defined bbox means that the bottom-left and top-right coordinates have been calculated for the graphical object's shape.

A bbox is undefined when created and can be undefined (to discard the current calculated coordinates) using the method undefined().

Using the set or the expand methods an undefined bbox is defined.

Constructor & Destructor Documentation

◆ GKBBox() [1/5]

GKBBox::GKBBox ( )

◆ GKBBox() [2/5]

GKBBox::GKBBox ( const GKBBox )

◆ GKBBox() [3/5]

GKBBox::GKBBox ( const GKPoint ,
const GKPoint  
)

◆ GKBBox() [4/5]

GKBBox::GKBBox ( GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord   
)

◆ GKBBox() [5/5]

GKBBox::GKBBox ( GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord   
)

◆ ~GKBBox()

virtual GKBBox::~GKBBox ( )
virtual

Member Function Documentation

◆ altitude()

GKCoord GKBBox::altitude ( ) const

Returns the altitude of the bounding box.

◆ as2DPolygon()

GKPoints GKBBox::as2DPolygon ( ) const

Returns this bbox as a 2D polygon of 4 points

◆ center()

const GKPoint GKBBox::center ( ) const

Calculates and returns the center of the bbox.

◆ contains2D()

bool GKBBox::contains2D ( const GKPoint ) const

It returns true if p is inside the bbox without taking into account the z coordinate in the box and in the point.

◆ contains3D() [1/2]

bool GKBBox::contains3D ( const GKBBox ) const

Returns true if rec is inside the bbox.

◆ contains3D() [2/2]

bool GKBBox::contains3D ( const GKPoint ) const

Returns true if p is inside the bbox.

◆ ensureMinimumSize()

void GKBBox::ensureMinimumSize ( )

Makes this bbox greater if it is too small (width or height almost zero) It changes the bbox if width or height is less than 0.5 m adding 0.5 m to its size.

◆ expand3D() [1/3]

void GKBBox::expand3D ( const GKBBox )

Expands a bbox with the bbox rec. If rec is inside the bbox nothing happen. If rec is outside the bbox it will grow to keep rec inside.

◆ expand3D() [2/3]

void GKBBox::expand3D ( const GKPoint )

Expands a bbox with the point p. If p is inside the bbox nothing happen. If p is outside the bbox it will grow to keep p inside.

◆ expand3D() [3/3]

void GKBBox::expand3D ( const GKPoints )

Expands a bbox with points. If all the points in points are inside the bbox nothing happen. If any point is outside it will grow to keep the point inside.

◆ expandHeight()

void GKBBox::expandHeight ( GKCoord  )

Expands the bbox in both directions with "size"

◆ expandWidth()

void GKBBox::expandWidth ( GKCoord  )

Expands the bbox in both directions with "size"

◆ height()

GKCoord GKBBox::height ( ) const

Returns the height of the bounding box.

◆ intersects2D() [1/2]

bool GKBBox::intersects2D ( const GKBBox ) const

Returns true if rec is inside the bbox or if both bboxes intersect.

◆ intersects2D() [2/2]

bool GKBBox::intersects2D ( const GKLine ,
GKPoint ,
double  = 0.00001 
) const

If this and line2 intersect returns true and finds the intersection point p. Remember that lines perpendicular to the x axis are codified with slope = DBL_MAX and coef = x. Epsilon is the allowed difference between slopes to consider both lines parallel

◆ intersects3D()

bool GKBBox::intersects3D ( const GKBBox box,
GKBBox resultBox,
bool  noZ = false 
) const

Returns true if the two given bounding boxes intersect

◆ isUndefined()

bool GKBBox::isUndefined ( ) const

Returns true if the bbox bottom-left and top-right points have not been calculated yet and false otherwise.

◆ operator!=()

bool GKBBox::operator!= ( const GKBBox ) const

Returns true if the compared bounding boxes are different

◆ radioEsfMinContenedora()

double GKBBox::radioEsfMinContenedora ( ) const

◆ radious()

const GKCoord GKBBox::radious ( ) const

Calculates and returns the radious of a circle that totally encloses the bbox. This circle is centered at GKBBox::center().

◆ set() [1/4]

void GKBBox::set ( const GKPoint ,
const GKPoint  
)

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarted.

◆ set() [2/4]

void GKBBox::set ( const GKPoints )

Calculates the bbox of points. The previous bottom-left and top-right coordinates are discarted.

◆ set() [3/4]

void GKBBox::set ( GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord   
)

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarted.

◆ set() [4/4]

void GKBBox::set ( GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord  ,
GKCoord   
)

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarted.

◆ translate()

void GKBBox::translate ( const GKPoint )

Translates the bbox to a new location. That is: add inc to from and to

◆ undefine()

void GKBBox::undefine ( )

Marks the bbox as undefined. Values in from and to cannot be used.

◆ width()

GKCoord GKBBox::width ( ) const

Returns the width of the bounding box.

◆ x()

GKCoord GKBBox::x ( ) const

Returns the x coordinate of the "from" point of the bounding box, the minimum x of the box.

◆ y()

GKCoord GKBBox::y ( ) const

Returns the y coordinate of the "from" point of the bounding box, the minimum y of the box.

◆ z()

GKCoord GKBBox::z ( ) const

Returns the z coordinate of the "from" point of the bounding box, the minimum z of the box.

Member Data Documentation

◆ from

GKPoint GKBBox::from

Bottom left point of the bounding box

◆ to

GKPoint GKBBox::to

Top right point of the bounding box

© Aimsun SLU
Aimsun ®