hiScaleBox
hiScaleBox(l_boundingBox n_scale) =>l_scaledBBox
Description
Returns a bounding box that has the same center point as the bounding box passed, but whose sides are scaled by 1/n_scale.
For example, if you pass 2 as the scale, the sides are half as long. If you pass 0.5 as the scale, the sides are twice as long.
You enter the lower left and upper right coordinates of the bounding box. The function calculates the center point, scales the sides, and returns the new lower left and upper right coordinates.
Arguments
|
List of the lower left and upper right coordinates of the initial bounding box. |
|
Values Returned
|
Returns the bounding box with the same canter point as the bounding box passed. |
Examples
This example starts with a bounding box that is 100 units high by 200 units wide and gets two bounding boxes with the same center point, one whose sides are 50 units by 100 units and the other whose sides are 200 units by 400 units.
let ( ( ( myBBox list( 0:0 200:100 ) ) smallerBBox biggerBBox )
smallerBBox = hiScaleBox(myBBox 2 )
; result is ( ( 50 25 ) ( 150 75 ) ), which is 1/2 the dimensions
biggerBBox = hiScaleBox(myBBox .5 )
; result is ( ( -100.0 -50.0 ) ( 300.0 150.0 ) ), which is
; twice the dimensions
)
Here, the return values are floating-point numbers, even though the original bounding box consist integers.
Related Topics
General Environmental Functions
Return to top