| 1 | .. _api-zoo-geometry-point: |
|---|
| 2 | |
|---|
| 3 | ZOO.Geometry.Point |
|---|
| 4 | ================== |
|---|
| 5 | |
|---|
| 6 | Point geometry class. |
|---|
| 7 | |
|---|
| 8 | Inherits from |
|---|
| 9 | |
|---|
| 10 | - :ref:`ZOO.Geometry <api-zoo-geometry>` |
|---|
| 11 | |
|---|
| 12 | Properties |
|---|
| 13 | ---------- |
|---|
| 14 | |
|---|
| 15 | .. list-table:: |
|---|
| 16 | :widths: 12 50 |
|---|
| 17 | :header-rows: 1 |
|---|
| 18 | |
|---|
| 19 | * - NAME |
|---|
| 20 | - DESCRIPTION |
|---|
| 21 | * - :ref:`x <x>` |
|---|
| 22 | - {float} |
|---|
| 23 | * - :ref:`y <y>` |
|---|
| 24 | - {float} |
|---|
| 25 | |
|---|
| 26 | Functions |
|---|
| 27 | --------- |
|---|
| 28 | |
|---|
| 29 | .. list-table:: |
|---|
| 30 | :widths: 15 50 |
|---|
| 31 | :header-rows: 1 |
|---|
| 32 | |
|---|
| 33 | * - NAME |
|---|
| 34 | - DESCRIPTION |
|---|
| 35 | * - :ref:`ZOO.Geometry.Point <ZOO.Geometry.Point>` |
|---|
| 36 | - Construct a point geometry. |
|---|
| 37 | * - :ref:`clone <clone>` |
|---|
| 38 | - {ZOO.Geometry.Point} An exact clone of this ZOO.Geometry.Point |
|---|
| 39 | * - :ref:`calculateBounds <calculateBounds>` |
|---|
| 40 | - Create a new Bounds based on the x/y |
|---|
| 41 | * - :ref:`equals <equals>` |
|---|
| 42 | - Determine whether another geometry is equivalent to this one. |
|---|
| 43 | * - :ref:`toShortString <toShortString>` |
|---|
| 44 | - {String} Shortened String representation of Point object. |
|---|
| 45 | * - :ref:`move <move>` |
|---|
| 46 | - Moves a geometry by the given displacement along positive x and y axes. |
|---|
| 47 | * - :ref:`rotate <rotate>` |
|---|
| 48 | - Rotate a point around another. |
|---|
| 49 | * - :ref:`getCentroid <getCentroid>` |
|---|
| 50 | - {ZOO.Geometry.Point} The centroid of the collection |
|---|
| 51 | * - :ref:`resize <resize>` |
|---|
| 52 | - Resize a point relative to some origin. |
|---|
| 53 | * - :ref:`intersects <intersects>` |
|---|
| 54 | - Determine if the input geometry intersects this one. |
|---|
| 55 | * - :ref:`transform <transform>` |
|---|
| 56 | - Translate the x,y properties of the point from source to dest. |
|---|
| 57 | * - :ref:`getVertices <getVertices>` |
|---|
| 58 | - Return a list of all points in this geometry. |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | **Properties** |
|---|
| 62 | |
|---|
| 63 | .. _x: |
|---|
| 64 | |
|---|
| 65 | x |
|---|
| 66 | ``{float}`` |
|---|
| 67 | |
|---|
| 68 | .. _y: |
|---|
| 69 | |
|---|
| 70 | y |
|---|
| 71 | ``{float}`` |
|---|
| 72 | |
|---|
| 73 | **Functions** |
|---|
| 74 | |
|---|
| 75 | .. _ZOO.Geometry.Point: |
|---|
| 76 | |
|---|
| 77 | ZOO.Geometry.Point |
|---|
| 78 | Construct a point geometry. |
|---|
| 79 | |
|---|
| 80 | *Parameters* |
|---|
| 81 | |
|---|
| 82 | | ``x {float}`` |
|---|
| 83 | | ``y {float}`` |
|---|
| 84 | |
|---|
| 85 | .. _clone: |
|---|
| 86 | |
|---|
| 87 | clone |
|---|
| 88 | :: |
|---|
| 89 | |
|---|
| 90 | clone: function(obj) |
|---|
| 91 | |
|---|
| 92 | *Returns* |
|---|
| 93 | |
|---|
| 94 | :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` An exact clone of this ZOO.Geometry.Point |
|---|
| 95 | |
|---|
| 96 | .. _calculateBounds: |
|---|
| 97 | |
|---|
| 98 | calculateBounds |
|---|
| 99 | :: |
|---|
| 100 | |
|---|
| 101 | calculateBounds: function () |
|---|
| 102 | |
|---|
| 103 | Create a new Bounds based on the x/y |
|---|
| 104 | |
|---|
| 105 | .. _equals: |
|---|
| 106 | |
|---|
| 107 | equals |
|---|
| 108 | :: |
|---|
| 109 | |
|---|
| 110 | equals: function(geom) |
|---|
| 111 | |
|---|
| 112 | Determine whether another geometry is equivalent to this one. Geometries are considered |
|---|
| 113 | equivalent if all components have the same coordinates. |
|---|
| 114 | |
|---|
| 115 | *Parameters* |
|---|
| 116 | |
|---|
| 117 | ``geom`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` The geometry to test. |
|---|
| 118 | |
|---|
| 119 | *Returns* |
|---|
| 120 | |
|---|
| 121 | ``{Boolean}`` The supplied geometry is equivalent to this geometry. |
|---|
| 122 | |
|---|
| 123 | .. _toShortString: |
|---|
| 124 | |
|---|
| 125 | toShortString |
|---|
| 126 | :: |
|---|
| 127 | |
|---|
| 128 | toShortString: function() |
|---|
| 129 | |
|---|
| 130 | *Returns* |
|---|
| 131 | |
|---|
| 132 | ``{String}`` Shortened String representation of Point object. (ex. <i>"5, 42"</i>) |
|---|
| 133 | |
|---|
| 134 | .. _move: |
|---|
| 135 | |
|---|
| 136 | move |
|---|
| 137 | :: |
|---|
| 138 | |
|---|
| 139 | move: function(x,y) |
|---|
| 140 | |
|---|
| 141 | Moves a geometry by the given displacement along positive x and y axes. This modifies |
|---|
| 142 | the position of the geometry and clears the cached bounds. |
|---|
| 143 | |
|---|
| 144 | *Parameters* |
|---|
| 145 | |
|---|
| 146 | | ``x {Float}`` Distance to move geometry in positive x direction. |
|---|
| 147 | | ``y {Float}`` Distance to move geometry in positive y direction. |
|---|
| 148 | |
|---|
| 149 | .. _rotate: |
|---|
| 150 | |
|---|
| 151 | rotate |
|---|
| 152 | :: |
|---|
| 153 | |
|---|
| 154 | rotate: function(angle,origin) |
|---|
| 155 | |
|---|
| 156 | Rotate a point around another. |
|---|
| 157 | |
|---|
| 158 | *Parameters* |
|---|
| 159 | |
|---|
| 160 | | ``angle {Float}`` Rotation angle in degrees (measured counterclockwise from the positive x-axis) |
|---|
| 161 | | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Center point for the rotation |
|---|
| 162 | |
|---|
| 163 | .. _getCentroid: |
|---|
| 164 | |
|---|
| 165 | getCentroid |
|---|
| 166 | :: |
|---|
| 167 | |
|---|
| 168 | getCentroid: function() |
|---|
| 169 | |
|---|
| 170 | *Returns* |
|---|
| 171 | |
|---|
| 172 | :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` The centroid of the collection |
|---|
| 173 | |
|---|
| 174 | .. _resize: |
|---|
| 175 | |
|---|
| 176 | resize |
|---|
| 177 | :: |
|---|
| 178 | |
|---|
| 179 | resize: function(scale,origin,ratio) |
|---|
| 180 | |
|---|
| 181 | Resize a point relative to some origin. For points, this has the effect of scaling a |
|---|
| 182 | vector (from the origin to the point). This method is more useful on geometry collection |
|---|
| 183 | subclasses. |
|---|
| 184 | |
|---|
| 185 | *Parameters* |
|---|
| 186 | |
|---|
| 187 | | ``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. |
|---|
| 188 | | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Point of origin for resizing |
|---|
| 189 | | ``ratio {Float}`` Optional x:y ratio for resizing. Default ratio is 1. |
|---|
| 190 | |
|---|
| 191 | *Returns* |
|---|
| 192 | |
|---|
| 193 | :ref:`{ZOO.Geometry} <api-zoo-geometry>` The current geometry. |
|---|
| 194 | |
|---|
| 195 | .. _intersects: |
|---|
| 196 | |
|---|
| 197 | intersects |
|---|
| 198 | :: |
|---|
| 199 | |
|---|
| 200 | intersects: function(geometry) |
|---|
| 201 | |
|---|
| 202 | Determine if the input geometry intersects this one. |
|---|
| 203 | |
|---|
| 204 | *Parameters* |
|---|
| 205 | |
|---|
| 206 | ``geometry`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` Any type of geometry. |
|---|
| 207 | |
|---|
| 208 | *Returns* |
|---|
| 209 | |
|---|
| 210 | ``{Boolean}`` The input geometry intersects this one. |
|---|
| 211 | |
|---|
| 212 | .. _transform: |
|---|
| 213 | |
|---|
| 214 | transform |
|---|
| 215 | :: |
|---|
| 216 | |
|---|
| 217 | transform: function(source,dest) |
|---|
| 218 | |
|---|
| 219 | Translate the x,y properties of the point from source to dest. |
|---|
| 220 | |
|---|
| 221 | *Parameters* |
|---|
| 222 | |
|---|
| 223 | | ``source`` :ref:`{ZOO.Projection} <api-zoo-projection>` |
|---|
| 224 | | ``dest`` :ref:`{ZOO.Projection} <api-zoo-projection>` |
|---|
| 225 | |
|---|
| 226 | *Returns* |
|---|
| 227 | |
|---|
| 228 | :ref:`{ZOO.Geometry} <api-zoo-geometry>` |
|---|
| 229 | |
|---|
| 230 | .. _getVertices: |
|---|
| 231 | |
|---|
| 232 | getVertices |
|---|
| 233 | :: |
|---|
| 234 | |
|---|
| 235 | getVertices: function(nodes) |
|---|
| 236 | |
|---|
| 237 | Return a list of all points in this geometry. |
|---|
| 238 | |
|---|
| 239 | *Parameters* |
|---|
| 240 | |
|---|
| 241 | ``nodes {Boolean}`` For lines, only return vertices that are endpoints. If false, for lines, |
|---|
| 242 | only vertices that are not endpoints will be returned. If not provided, all vertices will be returned. |
|---|
| 243 | |
|---|
| 244 | *Returns* |
|---|
| 245 | |
|---|
| 246 | ``{Array}`` A list of all vertices in the geometry. |
|---|