cpr.geometry.Dimension

Geometry object that abstracts the width and height of the plane coordinate system.

Index

Properties
Name Type Description
area Number Area.
height Number Height default 0
width Number Width default 0
Methods
Name Return Type Description
add Dimension Expand the area.
addByDimension Dimension Expand by adding size.
addByPoint Dimension Add point objects to expand their size.
equals Boolean Compare for equality.
getAddByPoint Dimension Returns a new object with its size expanded.
getAdded Dimension Gets a copy object with the area expanded by the given size.
getAddedByDimension Dimension Returns a new object with its size expanded.
getCopy Dimension Get a copy object.
getNegated Dimension Create and return a new dimension with negative values.
isEmpty Boolean
negate Dimension It negates the width and height of this Dimension.
transpose Dimension

Constructor

Dimension(width, height)
Create a new width object.
Parameters
name type description
width Number width.
height Number Height.

Properties

area
type Number
readonly
Area.
height
type Number
Height default 0
width
type Number
Width default 0

Methods

add(dimension)
Expand the area.
Parameters
name type description
dimension Dimension Width to expand.
return Dimension
add(point)
Expand the area.
Parameters
name type description
point Point A point object with x and y values ​​of the width of the area to be extended.
return Dimension
add(width, height)
Expand the area.
Parameters
name type description
width Number Width to expand.
height Number The height to extend.
return Dimension
addByDimension(dimension)
deprecatedPlease use add.
Expand by adding size.
Parameters
name type description
dimension Dimension
return Dimension
addByPoint(point)
deprecatedPlease use add.
Add point objects to expand their size.
Parameters
name type description
point Point
return Dimension
equals(obj, tolerance)
Compare for equality.
Parameters
name type description
obj Object Object to be compared.
toleranceoptional Number default0 tolerance.
return Boolean
getAddByPoint(point)
deprecatedPlease use getAdded.
Returns a new object with its size expanded.
Parameters
name type description
point Point
return Dimension
getAdded(dimension)
Gets a copy object with the area expanded by the given size.
Parameters
name type description
dimension Dimension The size to be expanded.
return Dimension
getAdded(dimension)
Gets a copy object with the area expanded by the given size.
Parameters
name type description
dimension Point The size to be expanded.
return Dimension
getAdded(width, height)
Gets a copy object with the area expanded by the given size.
Parameters
name type description
width Number Width to expand.
height Number The height to extend.
return Dimension
getAddedByDimension(dimension)
deprecatedPlease use getAdded.
Returns a new object with its size expanded.
Parameters
name type description
dimension Dimension
return Dimension
getCopy()
Get a copy object.
return Dimension
getNegated()
Create and return a new dimension with negative values.
return Dimension
isEmpty()
return Boolean
negate()
It negates the width and height of this Dimension.
return Dimension
transpose()
return Dimension