Packagenet.guttershark.util.geom
Classpublic class Dimension

The Dimension class stores width and height dimensions and provides various methods of manipulations.



Public Properties
 PropertyDefined by
  height : int
The height.
Dimension
  width : int
The width.
Dimension
Public Methods
 MethodDefined by
  
Dimension(w:int = 0, h:int = 0)
Constructor for Dimension instances.
Dimension
  
Creates and returns a copy of this Dimension.
Dimension
  
contains(d:Dimension):Boolean
Returns true if the passed Dimension fits within the bounds of this Dimension.
Dimension
  
Returns true if this Dimension properly contains the one specified - proper containment is defined as containment using "<", instead of "<=".
Dimension
  
equals(d:Dimension):Boolean
Test equality between this Dimension and another Dimension.
Dimension
  
expand(w:Number = 0, h:Number = 0):Dimension
Expands the size of this Dimension by the specified width and height.
Dimension
  
getArea():Number
Returns the area of this Dimension.
Dimension
  
This Dimension is intersected with the one specified.
Dimension
  
isEmpty():Boolean
Returns true if the Dimension has width or height greater than 0.
Dimension
  
scale(w:Number = 0, h:Number = 0):Dimension
Scales the width of this Dimension by w and scales the height of this Dimension by h.
Dimension
  
shrink(w:Number = 0, h:Number = 0):Dimension
Reduces the width and height of this Dimension.
Dimension
  
toString():String
Friendly description and for debug info.
Dimension
  
Sets the width and height of this Dimension to to the max() value between this Dimension and the target Dimension.
Dimension
Property detail
heightproperty
public var height:int

The height.

widthproperty 
public var width:int

The width.

Constructor detail
Dimension()constructor
public function Dimension(w:int = 0, h:int = 0)

Constructor for Dimension instances.

Parameters
w:int (default = 0) — The width
 
h:int (default = 0) — The height
Method detail
clone()method
public function clone():Dimension

Creates and returns a copy of this Dimension.

Returns
Dimension
contains()method 
public function contains(d:Dimension):Boolean

Returns true if the passed Dimension fits within the bounds of this Dimension. A Dimension of the same size is considered to "fit".

Parameters
d:Dimension — The dimension being tested

Returns
Boolean
containsProper()method 
public function containsProper(d:Dimension):Boolean

Returns true if this Dimension properly contains the one specified - proper containment is defined as containment using "<", instead of "<=".

Parameters
d:Dimension — The demension being tested.

Returns
Boolean
equals()method 
public function equals(d:Dimension):Boolean

Test equality between this Dimension and another Dimension.

Parameters
d:Dimension — The Dimension being tested for equality

Returns
Boolean
expand()method 
public function expand(w:Number = 0, h:Number = 0):Dimension

Expands the size of this Dimension by the specified width and height.

Parameters
w:Number (default = 0) — The amount the width will be increased by.
 
h:Number (default = 0) — The amount the height will be increased by.

Returns
Dimension
getArea()method 
public function getArea():Number

Returns the area of this Dimension.

Returns
Number
intersect()method 
public function intersect(d:Dimension):Dimension

This Dimension is intersected with the one specified. intersection is performed by taking the min of the values from each dimension.

Parameters
d:Dimension — The Dimension to intersect with this Dimension.

Returns
Dimension
isEmpty()method 
public function isEmpty():Boolean

Returns true if the Dimension has width or height greater than 0.

Returns
Boolean
scale()method 
public function scale(w:Number = 0, h:Number = 0):Dimension

Scales the width of this Dimension by w and scales the height of this Dimension by h.

Parameters
w:Number (default = 0) — The amount the width will be scaled.
 
h:Number (default = 0) — The amount the height will be scaled.

Returns
Dimension
shrink()method 
public function shrink(w:Number = 0, h:Number = 0):Dimension

Reduces the width and height of this Dimension.

Parameters
w:Number (default = 0) — The amount to reduce the width by.
 
h:Number (default = 0) — The amount to reduce the height by.

Returns
Dimension
toString()method 
public function toString():String

Friendly description and for debug info.

Returns
String
union()method 
public function union(d:Dimension):Dimension

Sets the width and height of this Dimension to to the max() value between this Dimension and the target Dimension.

Parameters
d:Dimension — The Dimension to union with this Dimension.

Returns
Dimension