LuaDocs/Box

From Data Realms Wiki

Revision as of 22:58, 10 May 2011 by LuaBot (Talk | contribs)
Jump to: navigation, search

Contents

Has no parent class

Generic Class. A useful 2D axis-aligned rectangle class.

Go back to Class Index


Properties

ClassName

Read-only property. The class name of this Box.A string with the friendly-formatted type name of this Box.

Corner

The primary corner of this boxA Vector with the primary corner of this box.

Width

The width of this box. Note that this can be negative if the box hasn't been righted with Unflip().A float value that represents the width value of this Box.

Height

The height of this box. Note that this can be negative if the box hasn't been righted with Unflip().A float value that represents the height value of this Box.

Center

Read-only property. The center point of this Box' area, in absolute Scene coordinates.The center point.

Area

Read-only property. The width times the height.The width times the height.


Functions

GetRandomPoint

Gets a random point within this box.

Arguments:

  • None.

Return value:

The random point within the box.


Unflip

Makes the corner of this box represent the upper left corner, and both width and height will end up positive.

Arguments:

  • None.

Return value:

None.


WithinBox

Tells whether a point is within the Box or not.

Arguments:

  • The Vector describing the point to test for insideness.

Return value:

Inside the box or not.


WithinBoxX

Tells whether an x coordinate is within the Box's x-range or not.

Arguments:

  • The coordinate describing the x value to test for insideness.

Return value:

Inside the box or not in the x axis.


WithinBoxY

Tells whether an y coordinate is within the Box's y-range or not.

Arguments:

  • The coordinate describing the y value to test for insideness.

Return value:

Inside the box or not in the y axis.


GetWithinBoxX

Returns an X value constrained inside the Box and returns it.

Arguments:

  • The X value to constrain inside the Box.

Return value:

The constrained value.


GetWithinBoxY

Returns an X value constrained inside the Box and returns it.

Arguments:

  • The X value to constrain inside the Box.

Return value:

The constrained value.


GetWithinBox

Returns a copy of a point constrained inside this box.

Arguments:

  • The Vector describing the point to constrain inside the box.

Return value:

The resulting point isnide the box.


Go back to Class Index

Personal tools