ZOO.Geometry.Point¶
Point geometry class.
Inherits from
Functions¶
NAME | DESCRIPTION |
---|---|
ZOO.Geometry.Point | Construct a point geometry. |
clone | {ZOO.Geometry.Point} An exact clone of this ZOO.Geometry.Point |
calculateBounds | Create a new Bounds based on the x/y |
equals | Determine whether another geometry is equivalent to this one. |
toShortString | {String} Shortened String representation of Point object. |
move | Moves a geometry by the given displacement along positive x and y axes. |
rotate | Rotate a point around another. |
getCentroid | {ZOO.Geometry.Point} The centroid of the collection |
resize | Resize a point relative to some origin. |
intersects | Determine if the input geometry intersects this one. |
transform | Translate the x,y properties of the point from source to dest. |
getVertices | Return a list of all points in this geometry. |
Properties
- x
{float}
- y
{float}
Functions
- ZOO.Geometry.Point
Construct a point geometry.
Parameters
x {float}
y {float}
- clone
clone: function(obj)
Returns
{ZOO.Geometry.Point} An exact clone of this ZOO.Geometry.Point
- calculateBounds
calculateBounds: function ()
Create a new Bounds based on the x/y
- equals
equals: function(geom)
Determine whether another geometry is equivalent to this one. Geometries are considered equivalent if all components have the same coordinates.
Parameters
geom
{ZOO.Geometry.Point} The geometry to test.Returns
{Boolean}
The supplied geometry is equivalent to this geometry.
- toShortString
toShortString: function()
Returns
{String}
Shortened String representation of Point object. (ex. <i>”5, 42”</i>)
- move
move: function(x,y)
Moves a geometry by the given displacement along positive x and y axes. This modifies the position of the geometry and clears the cached bounds.
Parameters
x {Float}
Distance to move geometry in positive x direction.y {Float}
Distance to move geometry in positive y direction.
- rotate
rotate: function(angle,origin)
Rotate a point around another.
Parameters
angle {Float}
Rotation angle in degrees (measured counterclockwise from the positive x-axis)origin
{ZOO.Geometry.Point} Center point for the rotation
- getCentroid
getCentroid: function()
Returns
{ZOO.Geometry.Point} The centroid of the collection
- resize
resize: function(scale,origin,ratio)
Resize a point relative to some origin. For points, this has the effect of scaling a vector (from the origin to the point). This method is more useful on geometry collection subclasses.
Parameters
scale {Float}
Ratio of the new distance from the origin to the old distance from the origin. A scale of 2 doubles the distance between the point and origin.origin
{ZOO.Geometry.Point} Point of origin for resizingratio {Float}
Optional x:y ratio for resizing. Default ratio is 1.Returns
{ZOO.Geometry} The current geometry.
- intersects
intersects: function(geometry)
Determine if the input geometry intersects this one.
Parameters
geometry
{ZOO.Geometry} Any type of geometry.Returns
{Boolean}
The input geometry intersects this one.
- transform
transform: function(source,dest)
Translate the x,y properties of the point from source to dest.
Parameters
source
{ZOO.Projection}dest
{ZOO.Projection}Returns
- getVertices
getVertices: function(nodes)
Return a list of all points in this geometry.
Parameters
nodes {Boolean}
For lines, only return vertices that are endpoints. If false, for lines, only vertices that are not endpoints will be returned. If not provided, all vertices will be returned.Returns
{Array}
A list of all vertices in the geometry.