paper 0.12.18 → 0.12.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/docs/assets/js/paper.js +91 -53
  3. package/dist/docs/classes/Color.html +2 -2
  4. package/dist/docs/classes/CompoundPath.html +2 -2
  5. package/dist/docs/classes/Curve.html +2 -2
  6. package/dist/docs/classes/CurveLocation.html +2 -2
  7. package/dist/docs/classes/Event.html +2 -2
  8. package/dist/docs/classes/Gradient.html +2 -2
  9. package/dist/docs/classes/GradientStop.html +2 -2
  10. package/dist/docs/classes/Group.html +2 -2
  11. package/dist/docs/classes/HitResult.html +2 -2
  12. package/dist/docs/classes/Item.html +2 -2
  13. package/dist/docs/classes/Key.html +2 -2
  14. package/dist/docs/classes/KeyEvent.html +2 -2
  15. package/dist/docs/classes/Layer.html +2 -2
  16. package/dist/docs/classes/Matrix.html +2 -2
  17. package/dist/docs/classes/MouseEvent.html +2 -2
  18. package/dist/docs/classes/PaperScope.html +2 -2
  19. package/dist/docs/classes/PaperScript.html +2 -2
  20. package/dist/docs/classes/Path.html +2 -2
  21. package/dist/docs/classes/PathItem.html +2 -2
  22. package/dist/docs/classes/Point.html +2 -2
  23. package/dist/docs/classes/PointText.html +2 -2
  24. package/dist/docs/classes/Project.html +2 -2
  25. package/dist/docs/classes/Raster.html +2 -2
  26. package/dist/docs/classes/Rectangle.html +2 -2
  27. package/dist/docs/classes/Segment.html +2 -2
  28. package/dist/docs/classes/Shape.html +2 -2
  29. package/dist/docs/classes/Size.html +2 -2
  30. package/dist/docs/classes/Style.html +2 -2
  31. package/dist/docs/classes/SymbolDefinition.html +2 -2
  32. package/dist/docs/classes/SymbolItem.html +2 -2
  33. package/dist/docs/classes/TextItem.html +2 -2
  34. package/dist/docs/classes/Tool.html +2 -2
  35. package/dist/docs/classes/ToolEvent.html +2 -2
  36. package/dist/docs/classes/Tween.html +2 -2
  37. package/dist/docs/classes/View.html +2 -2
  38. package/dist/docs/classes/global.html +2 -2
  39. package/dist/docs/classes/index.html +2 -2
  40. package/dist/docs/index.html +1 -1
  41. package/dist/paper-core.js +90 -52
  42. package/dist/paper-core.min.js +3 -3
  43. package/dist/paper-full.js +91 -53
  44. package/dist/paper-full.min.js +3 -3
  45. package/dist/paper.d.ts +2 -2
  46. package/package.json +5 -2
  47. package/dist/paperjs/LICENSE.txt +0 -23
  48. package/dist/paperjs/dist/node/canvas.js +0 -66
  49. package/dist/paperjs/dist/node/extend.js +0 -156
  50. package/dist/paperjs/dist/node/self.js +0 -58
  51. package/dist/paperjs/dist/node/xml.js +0 -40
  52. package/dist/paperjs/dist/paper-core.d.ts +0 -1
  53. package/dist/paperjs/dist/paper-core.js +0 -15703
  54. package/dist/paperjs/dist/paper-core.min.js +0 -32
  55. package/dist/paperjs/dist/paper-full.js +0 -17472
  56. package/dist/paperjs/dist/paper-full.min.js +0 -32
  57. package/dist/paperjs/dist/paper.d.ts +0 -7394
  58. package/dist/paperjs/docs/assets/css/docs.css +0 -414
  59. package/dist/paperjs/docs/assets/js/codemirror.js +0 -4
  60. package/dist/paperjs/docs/assets/js/docs.js +0 -493
  61. package/dist/paperjs/docs/assets/js/jquery.js +0 -6
  62. package/dist/paperjs/docs/assets/js/paper.js +0 -17472
  63. package/dist/paperjs/docs/classes/Color.html +0 -2188
  64. package/dist/paperjs/docs/classes/CompoundPath.html +0 -8877
  65. package/dist/paperjs/docs/classes/Curve.html +0 -2323
  66. package/dist/paperjs/docs/classes/CurveLocation.html +0 -672
  67. package/dist/paperjs/docs/classes/Event.html +0 -176
  68. package/dist/paperjs/docs/classes/Gradient.html +0 -240
  69. package/dist/paperjs/docs/classes/GradientStop.html +0 -273
  70. package/dist/paperjs/docs/classes/Group.html +0 -6864
  71. package/dist/paperjs/docs/classes/HitResult.html +0 -239
  72. package/dist/paperjs/docs/classes/Item.html +0 -6628
  73. package/dist/paperjs/docs/classes/Key.html +0 -139
  74. package/dist/paperjs/docs/classes/KeyEvent.html +0 -308
  75. package/dist/paperjs/docs/classes/Layer.html +0 -6850
  76. package/dist/paperjs/docs/classes/Matrix.html +0 -1744
  77. package/dist/paperjs/docs/classes/MouseEvent.html +0 -355
  78. package/dist/paperjs/docs/classes/PaperScope.html +0 -459
  79. package/dist/paperjs/docs/classes/PaperScript.html +0 -198
  80. package/dist/paperjs/docs/classes/Path.html +0 -11775
  81. package/dist/paperjs/docs/classes/PathItem.html +0 -8639
  82. package/dist/paperjs/docs/classes/Point.html +0 -2699
  83. package/dist/paperjs/docs/classes/PointText.html +0 -7029
  84. package/dist/paperjs/docs/classes/Project.html +0 -1305
  85. package/dist/paperjs/docs/classes/Raster.html +0 -7843
  86. package/dist/paperjs/docs/classes/Rectangle.html +0 -1654
  87. package/dist/paperjs/docs/classes/Segment.html +0 -939
  88. package/dist/paperjs/docs/classes/Shape.html +0 -7363
  89. package/dist/paperjs/docs/classes/Size.html +0 -1825
  90. package/dist/paperjs/docs/classes/Style.html +0 -919
  91. package/dist/paperjs/docs/classes/SymbolDefinition.html +0 -311
  92. package/dist/paperjs/docs/classes/SymbolItem.html +0 -6755
  93. package/dist/paperjs/docs/classes/TextItem.html +0 -6869
  94. package/dist/paperjs/docs/classes/Tool.html +0 -761
  95. package/dist/paperjs/docs/classes/ToolEvent.html +0 -446
  96. package/dist/paperjs/docs/classes/Tween.html +0 -374
  97. package/dist/paperjs/docs/classes/View.html +0 -1772
  98. package/dist/paperjs/docs/classes/global.html +0 -425
  99. package/dist/paperjs/docs/classes/index.html +0 -88
  100. package/dist/paperjs/docs/index.html +0 -11
  101. package/dist/paperjs/examples/Animated/AnimatedStar.html +0 -53
  102. package/dist/paperjs/examples/Animated/BooleanOperations.html +0 -115
  103. package/dist/paperjs/examples/Animated/CandyCrash.html +0 -151
  104. package/dist/paperjs/examples/Animated/Extruded.html +0 -50
  105. package/dist/paperjs/examples/Animated/Lines.html +0 -53
  106. package/dist/paperjs/examples/Animated/Smoothing.html +0 -70
  107. package/dist/paperjs/examples/Animated/Space.html +0 -86
  108. package/dist/paperjs/examples/Animated/SpaceUsingShapes.html +0 -79
  109. package/dist/paperjs/examples/Games/Paperoids.html +0 -569
  110. package/dist/paperjs/examples/JSON/Circle Testing.html +0 -34
  111. package/dist/paperjs/examples/JSON/Compound Path.html +0 -25
  112. package/dist/paperjs/examples/JSON/Empty Path Testing.html +0 -31
  113. package/dist/paperjs/examples/JSON/Gradients.html +0 -34
  114. package/dist/paperjs/examples/JSON/Group Transform.html +0 -28
  115. package/dist/paperjs/examples/JSON/Line Testing.html +0 -44
  116. package/dist/paperjs/examples/JSON/Random Path Testing.html +0 -42
  117. package/dist/paperjs/examples/JSON/Raster.html +0 -29
  118. package/dist/paperjs/examples/JSON/Rect and Attribute Testing.html +0 -56
  119. package/dist/paperjs/examples/JSON/Rotated Primitives.html +0 -55
  120. package/dist/paperjs/examples/JSON/Selection.html +0 -43
  121. package/dist/paperjs/examples/JSON/Shapes.html +0 -54
  122. package/dist/paperjs/examples/JSON/Symbols.html +0 -30
  123. package/dist/paperjs/examples/JSON/Text Testing.html +0 -38
  124. package/dist/paperjs/examples/JSON/Tiger.html +0 -19
  125. package/dist/paperjs/examples/JSON/Transform Test 1.html +0 -32
  126. package/dist/paperjs/examples/JSON/Transform Test 2.html +0 -30
  127. package/dist/paperjs/examples/Node.js/AnimatedStar.js +0 -52
  128. package/dist/paperjs/examples/Node.js/BooleanOperations.js +0 -36
  129. package/dist/paperjs/examples/Node.js/JSONtoPDF.js +0 -20
  130. package/dist/paperjs/examples/Node.js/Raster.js +0 -32
  131. package/dist/paperjs/examples/Node.js/RasterRemote.js +0 -33
  132. package/dist/paperjs/examples/Node.js/SvgExport.js +0 -52
  133. package/dist/paperjs/examples/Node.js/SvgImport.js +0 -23
  134. package/dist/paperjs/examples/Node.js/Tadpoles.js +0 -16
  135. package/dist/paperjs/examples/Node.js/Tadpoles.pjs +0 -278
  136. package/dist/paperjs/examples/Node.js/in.json +0 -1
  137. package/dist/paperjs/examples/Node.js/in.svg +0 -16
  138. package/dist/paperjs/examples/Paperjs.org/BooleanOperattions.html +0 -115
  139. package/dist/paperjs/examples/Paperjs.org/BouncingBalls.html +0 -103
  140. package/dist/paperjs/examples/Paperjs.org/Chain.html +0 -54
  141. package/dist/paperjs/examples/Paperjs.org/DivisionRaster.html +0 -72
  142. package/dist/paperjs/examples/Paperjs.org/FutureSplash.html +0 -122
  143. package/dist/paperjs/examples/Paperjs.org/HitTesting.html +0 -103
  144. package/dist/paperjs/examples/Paperjs.org/InteractiveTiger.html +0 -777
  145. package/dist/paperjs/examples/Paperjs.org/MetaBalls.html +0 -132
  146. package/dist/paperjs/examples/Paperjs.org/NyanRainbow.html +0 -202
  147. package/dist/paperjs/examples/Paperjs.org/PathIntersections.html +0 -76
  148. package/dist/paperjs/examples/Paperjs.org/Qbertify.html +0 -146
  149. package/dist/paperjs/examples/Paperjs.org/RadialRainbows.html +0 -80
  150. package/dist/paperjs/examples/Paperjs.org/RoundedRectangles.html +0 -41
  151. package/dist/paperjs/examples/Paperjs.org/SatieLikedToDraw.html +0 -140
  152. package/dist/paperjs/examples/Paperjs.org/Simplify.html +0 -63
  153. package/dist/paperjs/examples/Paperjs.org/SpiralRaster.html +0 -120
  154. package/dist/paperjs/examples/Paperjs.org/Tadpoles.html +0 -283
  155. package/dist/paperjs/examples/Paperjs.org/Voronoi.html +0 -134
  156. package/dist/paperjs/examples/Rasters/PhyllotaxisRaster.html +0 -96
  157. package/dist/paperjs/examples/Rasters/Raster.html +0 -34
  158. package/dist/paperjs/examples/Rasters/RotationRaster.html +0 -44
  159. package/dist/paperjs/examples/Rasters/Smoothing.html +0 -36
  160. package/dist/paperjs/examples/SVG Export/Circle Testing.html +0 -32
  161. package/dist/paperjs/examples/SVG Export/Clipping.html +0 -17
  162. package/dist/paperjs/examples/SVG Export/Compound Path.html +0 -22
  163. package/dist/paperjs/examples/SVG Export/Empty Path Testing.html +0 -28
  164. package/dist/paperjs/examples/SVG Export/Gradients.html +0 -52
  165. package/dist/paperjs/examples/SVG Export/Group Transform.html +0 -25
  166. package/dist/paperjs/examples/SVG Export/Line Testing.html +0 -41
  167. package/dist/paperjs/examples/SVG Export/Random Path Testing.html +0 -39
  168. package/dist/paperjs/examples/SVG Export/Raster.html +0 -21
  169. package/dist/paperjs/examples/SVG Export/Rect and Attribute Testing.html +0 -53
  170. package/dist/paperjs/examples/SVG Export/Rotated Primitives.html +0 -80
  171. package/dist/paperjs/examples/SVG Export/Shapes.html +0 -58
  172. package/dist/paperjs/examples/SVG Export/Symbols.html +0 -27
  173. package/dist/paperjs/examples/SVG Export/Text Testing.html +0 -45
  174. package/dist/paperjs/examples/SVG Export/Tiger.html +0 -23
  175. package/dist/paperjs/examples/SVG Export/Transform Test 1.html +0 -29
  176. package/dist/paperjs/examples/SVG Export/Transform Test 2.html +0 -27
  177. package/dist/paperjs/examples/SVG Import/Arcs.html +0 -78
  178. package/dist/paperjs/examples/SVG Import/Butterfly.html +0 -223
  179. package/dist/paperjs/examples/SVG Import/Circle and Ellipse Testing.html +0 -26
  180. package/dist/paperjs/examples/SVG Import/Clipping.html +0 -100
  181. package/dist/paperjs/examples/SVG Import/From File.html +0 -30
  182. package/dist/paperjs/examples/SVG Import/Gradient.html +0 -138
  183. package/dist/paperjs/examples/SVG Import/Gradients.html +0 -30
  184. package/dist/paperjs/examples/SVG Import/Inkscape Pivot.html +0 -52
  185. package/dist/paperjs/examples/SVG Import/Inkscape.html +0 -88
  186. package/dist/paperjs/examples/SVG Import/Line Testing.html +0 -24
  187. package/dist/paperjs/examples/SVG Import/MoreGradients.html +0 -107
  188. package/dist/paperjs/examples/SVG Import/Multiple Paths Test 1.html +0 -42
  189. package/dist/paperjs/examples/SVG Import/Multiple Paths Test 2.html +0 -33
  190. package/dist/paperjs/examples/SVG Import/Nested Groups Test.html +0 -78
  191. package/dist/paperjs/examples/SVG Import/Polybezier.html +0 -43
  192. package/dist/paperjs/examples/SVG Import/Rect Testing.html +0 -25
  193. package/dist/paperjs/examples/SVG Import/Symbols.html +0 -24
  194. package/dist/paperjs/examples/SVG Import/Testing.html +0 -40
  195. package/dist/paperjs/examples/SVG Import/Text Testing.html +0 -19
  196. package/dist/paperjs/examples/SVG Import/Tiger.html +0 -742
  197. package/dist/paperjs/examples/SVG Import/Transform Testing.html +0 -22
  198. package/dist/paperjs/examples/SVG Import/Viewbox.html +0 -38
  199. package/dist/paperjs/examples/Scripts/Arcs.html +0 -39
  200. package/dist/paperjs/examples/Scripts/BlendModes.html +0 -77
  201. package/dist/paperjs/examples/Scripts/BooleanOperations.html +0 -937
  202. package/dist/paperjs/examples/Scripts/CompoundPath.html +0 -19
  203. package/dist/paperjs/examples/Scripts/CurveTimeParameterization.html +0 -61
  204. package/dist/paperjs/examples/Scripts/HslColor.html +0 -53
  205. package/dist/paperjs/examples/Scripts/PathStructure.html +0 -82
  206. package/dist/paperjs/examples/Scripts/PathTangents.html +0 -73
  207. package/dist/paperjs/examples/Scripts/Resize.html +0 -42
  208. package/dist/paperjs/examples/Scripts/RoundRectangle.html +0 -28
  209. package/dist/paperjs/examples/Scripts/Shapes.html +0 -54
  210. package/dist/paperjs/examples/Scripts/StrokeBounds.html +0 -101
  211. package/dist/paperjs/examples/Scripts/StrokeScaling.html +0 -65
  212. package/dist/paperjs/examples/Tools/BezierTool.html +0 -90
  213. package/dist/paperjs/examples/Tools/Circles.html +0 -28
  214. package/dist/paperjs/examples/Tools/Clouds.html +0 -35
  215. package/dist/paperjs/examples/Tools/DrippingBrush.html +0 -73
  216. package/dist/paperjs/examples/Tools/FancyBrush.html +0 -82
  217. package/dist/paperjs/examples/Tools/Grid.html +0 -44
  218. package/dist/paperjs/examples/Tools/MultiLines.html +0 -44
  219. package/dist/paperjs/examples/Tools/MultipleTools.html +0 -44
  220. package/dist/paperjs/examples/Tools/PathEditing.html +0 -95
  221. package/dist/paperjs/examples/Tools/SquareRounded.html +0 -76
  222. package/dist/paperjs/examples/Tools/Stars.html +0 -38
  223. package/dist/paperjs/examples/Tools/Vektor.html +0 -200
  224. package/dist/paperjs/examples/Tools/Wave.html +0 -50
  225. package/dist/paperjs/examples/Tools/WormFarm.html +0 -88
  226. package/dist/paperjs/examples/Worker/Main.html +0 -53
  227. package/dist/paperjs/examples/Worker/Worker.js +0 -14
  228. package/dist/paperjs/examples/css/style.css +0 -12
@@ -1,2699 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Point</title>
6
- <base target="class-frame">
7
- <link href="../assets/css/docs.css" rel="stylesheet" type="text/css">
8
- <script src="../assets/js/paper.js"></script>
9
- <script src="../assets/js/jquery.js"></script>
10
- <script src="../assets/js/codemirror.js"></script>
11
- <script src="../assets/js/docs.js"></script>
12
- </head>
13
- <body>
14
- <article class="reference">
15
- <div class="reference-class">
16
- <h1>Point</h1>
17
-
18
- <p>The Point object represents a point in the two dimensional space of the Paper.js project. It is also used to represent two dimensional vector objects.</p>
19
- <h4>Example:<span class="description">Create a point at x: 10, y: 5</span></h4>
20
-
21
-
22
- <pre><code>var point = new Point(10, 5);
23
- console.log(point.x); // 10
24
- console.log(point.y); // 5</code></pre>
25
-
26
- </div>
27
-
28
- <!-- =============================== constructors ========================== -->
29
- <div class="reference-members">
30
- <h2>Constructors</h2>
31
-
32
-
33
- <div id="point-x-y" class="member">
34
- <div class="member-link">
35
- <a name="point-x-y" href="#point-x-y"><tt><b>Point</b>(x, y)</tt></a>
36
- </div>
37
- <div class="member-description hidden">
38
- <div class="member-text">
39
- <p>Creates a Point object with the given x and y coordinates.</p>
40
-
41
-
42
- <ul class="member-list">
43
- <h4>Parameters:</h4>
44
-
45
- <li>
46
- <tt>x:</tt>
47
- <tt>Number</tt>
48
- &mdash;&nbsp;the x coordinate
49
-
50
- </li>
51
-
52
- <li>
53
- <tt>y:</tt>
54
- <tt>Number</tt>
55
- &mdash;&nbsp;the y coordinate
56
-
57
- </li>
58
-
59
- </ul>
60
-
61
-
62
- <ul class="member-list">
63
- <h4>Returns:</h4>
64
-
65
- <li>
66
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
67
- </li>
68
-
69
-
70
- </ul>
71
-
72
-
73
-
74
-
75
- <h4>Example:<span class="description">Create a point at x: 10, y: 5</span></h4>
76
-
77
-
78
- <pre><code>var point = new Point(10, 5);
79
- console.log(point.x); // 10
80
- console.log(point.y); // 5</code></pre>
81
-
82
- </div>
83
- </div>
84
- </div>
85
-
86
-
87
- <div id="point-array" class="member">
88
- <div class="member-link">
89
- <a name="point-array" href="#point-array"><tt><b>Point</b>(array)</tt></a>
90
- </div>
91
- <div class="member-description hidden">
92
- <div class="member-text">
93
- <p>Creates a Point object using the numbers in the given array as coordinates.</p>
94
-
95
-
96
- <ul class="member-list">
97
- <h4>Parameters:</h4>
98
-
99
- <li>
100
- <tt>array:</tt>
101
- <tt>Array</tt>
102
-
103
-
104
- </li>
105
-
106
- </ul>
107
-
108
-
109
- <ul class="member-list">
110
- <h4>Returns:</h4>
111
-
112
- <li>
113
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
114
- </li>
115
-
116
-
117
- </ul>
118
-
119
-
120
-
121
-
122
- <h4>Example:<span class="description">Creating a point at x: 10, y: 5 using an array of numbers:</span></h4>
123
-
124
-
125
- <pre><code>var array = [10, 5];
126
- var point = new Point(array);
127
- console.log(point.x); // 10
128
- console.log(point.y); // 5</code></pre>
129
-
130
- <h4>Example:<span class="description">Passing an array to a functionality that expects a point:</span></h4>
131
-
132
-
133
- <pre><code>// Create a circle shaped path at x: 50, y: 50
134
- // with a radius of 30:
135
- var path = new Path.Circle([50, 50], 30);
136
- path.fillColor = 'red';
137
-
138
- // Which is the same as doing:
139
- var path = new Path.Circle(new Point(50, 50), 30);
140
- path.fillColor = 'red';</code></pre>
141
-
142
- </div>
143
- </div>
144
- </div>
145
-
146
-
147
- <div id="point-object" class="member">
148
- <div class="member-link">
149
- <a name="point-object" href="#point-object"><tt><b>Point</b>(object)</tt></a>
150
- </div>
151
- <div class="member-description hidden">
152
- <div class="member-text">
153
- <p>Creates a Point object using the properties in the given object.</p>
154
-
155
-
156
- <ul class="member-list">
157
- <h4>Parameters:</h4>
158
-
159
- <li>
160
- <tt>object:</tt>
161
- <tt>Object</tt>
162
- &mdash;&nbsp;the object describing the point&rsquo;s properties
163
-
164
- </li>
165
-
166
- </ul>
167
-
168
-
169
- <ul class="member-list">
170
- <h4>Returns:</h4>
171
-
172
- <li>
173
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
174
- </li>
175
-
176
-
177
- </ul>
178
-
179
-
180
-
181
-
182
- <h4>Example:<span class="description">Creating a point using an object literal with length and angle properties:</span></h4>
183
-
184
-
185
- <pre><code>var point = new Point({
186
- length: 10,
187
- angle: 90
188
- });
189
- console.log(point.length); // 10
190
- console.log(point.angle); // 90</code></pre>
191
-
192
- <h4>Example:<span class="description">Creating a point at x: 10, y: 20 using an object literal:</span></h4>
193
-
194
-
195
- <pre><code>var point = new Point({
196
- x: 10,
197
- y: 20
198
- });
199
- console.log(point.x); // 10
200
- console.log(point.y); // 20</code></pre>
201
-
202
- <h4>Example:<span class="description">Passing an object to a functionality that expects a point:</span></h4>
203
-
204
-
205
- <pre><code>var center = {
206
- x: 50,
207
- y: 50
208
- };
209
-
210
- // Creates a circle shaped path at x: 50, y: 50
211
- // with a radius of 30:
212
- var path = new Path.Circle(center, 30);
213
- path.fillColor = 'red';</code></pre>
214
-
215
- </div>
216
- </div>
217
- </div>
218
-
219
-
220
- <div id="point-size" class="member">
221
- <div class="member-link">
222
- <a name="point-size" href="#point-size"><tt><b>Point</b>(size)</tt></a>
223
- </div>
224
- <div class="member-description hidden">
225
- <div class="member-text">
226
- <p>Creates a Point object using the width and height values of the given Size object.</p>
227
-
228
-
229
- <ul class="member-list">
230
- <h4>Parameters:</h4>
231
-
232
- <li>
233
- <tt>size:</tt>
234
- <a href="../classes/Size.html"><tt>Size</tt></a>
235
-
236
-
237
- </li>
238
-
239
- </ul>
240
-
241
-
242
- <ul class="member-list">
243
- <h4>Returns:</h4>
244
-
245
- <li>
246
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
247
- </li>
248
-
249
-
250
- </ul>
251
-
252
-
253
-
254
-
255
- <h4>Example:<span class="description">Creating a point using a size object.</span></h4>
256
-
257
-
258
- <pre><code>// Create a Size with a width of 100pt and a height of 50pt
259
- var size = new Size(100, 50);
260
- console.log(size); // { width: 100, height: 50 }
261
- var point = new Point(size);
262
- console.log(point); // { x: 100, y: 50 }</code></pre>
263
-
264
- </div>
265
- </div>
266
- </div>
267
-
268
-
269
- <div id="point-point" class="member">
270
- <div class="member-link">
271
- <a name="point-point" href="#point-point"><tt><b>Point</b>(point)</tt></a>
272
- </div>
273
- <div class="member-description hidden">
274
- <div class="member-text">
275
- <p>Creates a Point object using the coordinates of the given Point object.</p>
276
-
277
-
278
- <ul class="member-list">
279
- <h4>Parameters:</h4>
280
-
281
- <li>
282
- <tt>point:</tt>
283
- <a href="../classes/Point.html"><tt>Point</tt></a>
284
-
285
-
286
- </li>
287
-
288
- </ul>
289
-
290
-
291
- <ul class="member-list">
292
- <h4>Returns:</h4>
293
-
294
- <li>
295
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
296
- </li>
297
-
298
-
299
- </ul>
300
-
301
-
302
-
303
-
304
-
305
- </div>
306
- </div>
307
- </div>
308
-
309
- </div>
310
-
311
-
312
-
313
- <!-- ================================ operators ============================ -->
314
- <div class="reference-members">
315
- <h2>Operators</h2>
316
-
317
- <div id="add" class="member">
318
- <div class="member-link">
319
- <a name="add" href="#add"><tt><tt><b>+</b>number</tt>, <tt><b>+</b>point</tt></tt></a>
320
- </div>
321
- <div class="member-description hidden">
322
-
323
-
324
- <div class="member-text">
325
- <p>Returns the addition of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
326
-
327
- <ul class="member-list">
328
- <h4>Parameters:</h4>
329
-
330
- <li>
331
- <tt>number:</tt>
332
- <tt>Number</tt>
333
- &mdash;&nbsp;the number to add
334
-
335
- </li>
336
-
337
- </ul>
338
-
339
-
340
- <ul class="member-list">
341
- <h4>Returns:</h4>
342
-
343
- <li>
344
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the addition of the point and the value as a new point
345
- </li>
346
-
347
-
348
- </ul>
349
-
350
-
351
-
352
-
353
- <h4>Example:</h4>
354
-
355
-
356
- <pre><code>var point = new Point(5, 10);
357
- var result = point + 20;
358
- console.log(result); // {x: 25, y: 30}</code></pre>
359
-
360
- </div>
361
-
362
-
363
-
364
- <div class="member-text">
365
- <p>Returns the addition of the supplied point to the point as a new point. The object itself is not modified!</p>
366
-
367
- <ul class="member-list">
368
- <h4>Parameters:</h4>
369
-
370
- <li>
371
- <tt>point:</tt>
372
- <a href="../classes/Point.html"><tt>Point</tt></a>
373
- &mdash;&nbsp;the point to add
374
-
375
- </li>
376
-
377
- </ul>
378
-
379
-
380
- <ul class="member-list">
381
- <h4>Returns:</h4>
382
-
383
- <li>
384
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the addition of the two points as a new point
385
- </li>
386
-
387
-
388
- </ul>
389
-
390
-
391
-
392
-
393
- <h4>Example:</h4>
394
-
395
-
396
- <pre><code>var point1 = new Point(5, 10);
397
- var point2 = new Point(10, 20);
398
- var result = point1 + point2;
399
- console.log(result); // {x: 15, y: 30}</code></pre>
400
-
401
- </div>
402
-
403
-
404
- </div>
405
- </div>
406
-
407
-
408
- <div id="subtract" class="member">
409
- <div class="member-link">
410
- <a name="subtract" href="#subtract"><tt><tt><b>-</b>number</tt>, <tt><b>-</b>point</tt></tt></a>
411
- </div>
412
- <div class="member-description hidden">
413
-
414
-
415
- <div class="member-text">
416
- <p>Returns the subtraction of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
417
-
418
- <ul class="member-list">
419
- <h4>Parameters:</h4>
420
-
421
- <li>
422
- <tt>number:</tt>
423
- <tt>Number</tt>
424
- &mdash;&nbsp;the number to subtract
425
-
426
- </li>
427
-
428
- </ul>
429
-
430
-
431
- <ul class="member-list">
432
- <h4>Returns:</h4>
433
-
434
- <li>
435
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the subtraction of the point and the value as a new point
436
- </li>
437
-
438
-
439
- </ul>
440
-
441
-
442
-
443
-
444
- <h4>Example:</h4>
445
-
446
-
447
- <pre><code>var point = new Point(10, 20);
448
- var result = point - 5;
449
- console.log(result); // {x: 5, y: 15}</code></pre>
450
-
451
- </div>
452
-
453
-
454
-
455
- <div class="member-text">
456
- <p>Returns the subtraction of the supplied point to the point as a new point. The object itself is not modified!</p>
457
-
458
- <ul class="member-list">
459
- <h4>Parameters:</h4>
460
-
461
- <li>
462
- <tt>point:</tt>
463
- <a href="../classes/Point.html"><tt>Point</tt></a>
464
- &mdash;&nbsp;the point to subtract
465
-
466
- </li>
467
-
468
- </ul>
469
-
470
-
471
- <ul class="member-list">
472
- <h4>Returns:</h4>
473
-
474
- <li>
475
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the subtraction of the two points as a new point
476
- </li>
477
-
478
-
479
- </ul>
480
-
481
-
482
-
483
-
484
- <h4>Example:</h4>
485
-
486
-
487
- <pre><code>var firstPoint = new Point(10, 20);
488
- var secondPoint = new Point(5, 5);
489
- var result = firstPoint - secondPoint;
490
- console.log(result); // {x: 5, y: 15}</code></pre>
491
-
492
- </div>
493
-
494
-
495
- </div>
496
- </div>
497
-
498
-
499
- <div id="multiply" class="member">
500
- <div class="member-link">
501
- <a name="multiply" href="#multiply"><tt><tt><b>*</b>number</tt>, <tt><b>*</b>point</tt></tt></a>
502
- </div>
503
- <div class="member-description hidden">
504
-
505
-
506
- <div class="member-text">
507
- <p>Returns the multiplication of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
508
-
509
- <ul class="member-list">
510
- <h4>Parameters:</h4>
511
-
512
- <li>
513
- <tt>number:</tt>
514
- <tt>Number</tt>
515
- &mdash;&nbsp;the number to multiply by
516
-
517
- </li>
518
-
519
- </ul>
520
-
521
-
522
- <ul class="member-list">
523
- <h4>Returns:</h4>
524
-
525
- <li>
526
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the multiplication of the point and the value as a new point
527
- </li>
528
-
529
-
530
- </ul>
531
-
532
-
533
-
534
-
535
- <h4>Example:</h4>
536
-
537
-
538
- <pre><code>var point = new Point(10, 20);
539
- var result = point * 2;
540
- console.log(result); // {x: 20, y: 40}</code></pre>
541
-
542
- </div>
543
-
544
-
545
-
546
- <div class="member-text">
547
- <p>Returns the multiplication of the supplied point to the point as a new point. The object itself is not modified!</p>
548
-
549
- <ul class="member-list">
550
- <h4>Parameters:</h4>
551
-
552
- <li>
553
- <tt>point:</tt>
554
- <a href="../classes/Point.html"><tt>Point</tt></a>
555
- &mdash;&nbsp;the point to multiply by
556
-
557
- </li>
558
-
559
- </ul>
560
-
561
-
562
- <ul class="member-list">
563
- <h4>Returns:</h4>
564
-
565
- <li>
566
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the multiplication of the two points as a new point
567
- </li>
568
-
569
-
570
- </ul>
571
-
572
-
573
-
574
-
575
- <h4>Example:</h4>
576
-
577
-
578
- <pre><code>var firstPoint = new Point(5, 10);
579
- var secondPoint = new Point(4, 2);
580
- var result = firstPoint * secondPoint;
581
- console.log(result); // {x: 20, y: 20}</code></pre>
582
-
583
- </div>
584
-
585
-
586
- </div>
587
- </div>
588
-
589
-
590
- <div id="divide" class="member">
591
- <div class="member-link">
592
- <a name="divide" href="#divide"><tt><tt><b>/</b>number</tt>, <tt><b>/</b>point</tt></tt></a>
593
- </div>
594
- <div class="member-description hidden">
595
-
596
-
597
- <div class="member-text">
598
- <p>Returns the division of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
599
-
600
- <ul class="member-list">
601
- <h4>Parameters:</h4>
602
-
603
- <li>
604
- <tt>number:</tt>
605
- <tt>Number</tt>
606
- &mdash;&nbsp;the number to divide by
607
-
608
- </li>
609
-
610
- </ul>
611
-
612
-
613
- <ul class="member-list">
614
- <h4>Returns:</h4>
615
-
616
- <li>
617
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the division of the point and the value as a new point
618
- </li>
619
-
620
-
621
- </ul>
622
-
623
-
624
-
625
-
626
- <h4>Example:</h4>
627
-
628
-
629
- <pre><code>var point = new Point(10, 20);
630
- var result = point / 2;
631
- console.log(result); // {x: 5, y: 10}</code></pre>
632
-
633
- </div>
634
-
635
-
636
-
637
- <div class="member-text">
638
- <p>Returns the division of the supplied point to the point as a new point. The object itself is not modified!</p>
639
-
640
- <ul class="member-list">
641
- <h4>Parameters:</h4>
642
-
643
- <li>
644
- <tt>point:</tt>
645
- <a href="../classes/Point.html"><tt>Point</tt></a>
646
- &mdash;&nbsp;the point to divide by
647
-
648
- </li>
649
-
650
- </ul>
651
-
652
-
653
- <ul class="member-list">
654
- <h4>Returns:</h4>
655
-
656
- <li>
657
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the division of the two points as a new point
658
- </li>
659
-
660
-
661
- </ul>
662
-
663
-
664
-
665
-
666
- <h4>Example:</h4>
667
-
668
-
669
- <pre><code>var firstPoint = new Point(8, 10);
670
- var secondPoint = new Point(2, 5);
671
- var result = firstPoint / secondPoint;
672
- console.log(result); // {x: 4, y: 2}</code></pre>
673
-
674
- </div>
675
-
676
-
677
- </div>
678
- </div>
679
-
680
-
681
- <div id="modulo" class="member">
682
- <div class="member-link">
683
- <a name="modulo" href="#modulo"><tt><tt><b>%</b>number</tt>, <tt><b>%</b>point</tt></tt></a>
684
- </div>
685
- <div class="member-description hidden">
686
-
687
-
688
- <div class="member-text">
689
- <p>The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point.</p>
690
-
691
- <ul class="member-list">
692
- <h4>Parameters:</h4>
693
-
694
- <li>
695
- <tt>value:</tt>
696
- <tt>Number</tt>
697
-
698
-
699
- </li>
700
-
701
- </ul>
702
-
703
-
704
- <ul class="member-list">
705
- <h4>Returns:</h4>
706
-
707
- <li>
708
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the integer remainders of dividing the point by the value as a new point
709
- </li>
710
-
711
-
712
- </ul>
713
-
714
-
715
-
716
-
717
- <h4>Example:</h4>
718
-
719
-
720
- <pre><code>var point = new Point(12, 6);
721
- console.log(point % 5); // {x: 2, y: 1}</code></pre>
722
-
723
- </div>
724
-
725
-
726
-
727
- <div class="member-text">
728
- <p>The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point.</p>
729
-
730
- <ul class="member-list">
731
- <h4>Parameters:</h4>
732
-
733
- <li>
734
- <tt>point:</tt>
735
- <a href="../classes/Point.html"><tt>Point</tt></a>
736
-
737
-
738
- </li>
739
-
740
- </ul>
741
-
742
-
743
- <ul class="member-list">
744
- <h4>Returns:</h4>
745
-
746
- <li>
747
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the integer remainders of dividing the points by each other as a new point
748
- </li>
749
-
750
-
751
- </ul>
752
-
753
-
754
-
755
-
756
- <h4>Example:</h4>
757
-
758
-
759
- <pre><code>var point = new Point(12, 6);
760
- console.log(point % new Point(5, 2)); // {x: 2, y: 0}</code></pre>
761
-
762
- </div>
763
-
764
-
765
- </div>
766
- </div>
767
-
768
-
769
- </div>
770
-
771
-
772
-
773
- <!-- ================================ properties =========================== -->
774
- <div class="reference-members">
775
- <h2>Properties</h2>
776
-
777
-
778
- <div id="x" class="member">
779
- <div class="member-link">
780
- <a name="x" href="#x"><tt><b>x</b></tt></a>
781
- </div>
782
- <div class="member-description hidden">
783
-
784
- <div class="member-text">
785
- <p>The x coordinate of the point</p>
786
-
787
-
788
-
789
- <ul class="member-list">
790
- <h4>Type:</h4>
791
- <li>
792
- <tt>Number</tt>
793
- </li>
794
- </ul>
795
-
796
-
797
-
798
- </div>
799
-
800
- </div>
801
- </div>
802
-
803
-
804
- <div id="y" class="member">
805
- <div class="member-link">
806
- <a name="y" href="#y"><tt><b>y</b></tt></a>
807
- </div>
808
- <div class="member-description hidden">
809
-
810
- <div class="member-text">
811
- <p>The y coordinate of the point</p>
812
-
813
-
814
-
815
- <ul class="member-list">
816
- <h4>Type:</h4>
817
- <li>
818
- <tt>Number</tt>
819
- </li>
820
- </ul>
821
-
822
-
823
-
824
- </div>
825
-
826
- </div>
827
- </div>
828
-
829
-
830
- <div id="length" class="member">
831
- <div class="member-link">
832
- <a name="length" href="#length"><tt><b>length</b></tt></a>
833
- </div>
834
- <div class="member-description hidden">
835
-
836
- <div class="member-text">
837
- <p>The length of the vector that is represented by this point&rsquo;s coordinates. Each point can be interpreted as a vector that points from the origin (<code>x
838
- = 0</code>, <code>y = 0</code>) to the point&rsquo;s location. Setting the length changes the location but keeps the vector&rsquo;s angle.</p>
839
-
840
-
841
-
842
- <ul class="member-list">
843
- <h4>Type:</h4>
844
- <li>
845
- <tt>Number</tt>
846
- </li>
847
- </ul>
848
-
849
-
850
-
851
- </div>
852
-
853
- </div>
854
- </div>
855
-
856
-
857
- <div id="angle" class="member">
858
- <div class="member-link">
859
- <a name="angle" href="#angle"><tt><b>angle</b></tt></a>
860
- </div>
861
- <div class="member-description hidden">
862
-
863
- <div class="member-text">
864
- <p>The vector&rsquo;s angle in degrees, measured from the x-axis to the vector.</p>
865
-
866
-
867
-
868
- <ul class="member-list">
869
- <h4>Type:</h4>
870
- <li>
871
- <tt>Number</tt>
872
- </li>
873
- </ul>
874
-
875
-
876
-
877
- </div>
878
-
879
- </div>
880
- </div>
881
-
882
-
883
- <div id="angleinradians" class="member">
884
- <div class="member-link">
885
- <a name="angleinradians" href="#angleinradians"><tt><b>angleInRadians</b></tt></a>
886
- </div>
887
- <div class="member-description hidden">
888
-
889
- <div class="member-text">
890
- <p>The vector&rsquo;s angle in radians, measured from the x-axis to the vector.</p>
891
-
892
-
893
-
894
- <ul class="member-list">
895
- <h4>Type:</h4>
896
- <li>
897
- <tt>Number</tt>
898
- </li>
899
- </ul>
900
-
901
-
902
-
903
- </div>
904
-
905
- </div>
906
- </div>
907
-
908
-
909
- <div id="quadrant" class="member">
910
- <div class="member-link">
911
- <a name="quadrant" href="#quadrant"><tt><b>quadrant</b></tt></a>
912
- </div>
913
- <div class="member-description hidden">
914
-
915
- <div class="member-text">
916
- <p>The quadrant of the <a href="../classes/Point.html#angle"><tt>angle</tt></a> of the point.</p>
917
- <p>Angles between 0 and 90 degrees are in quadrant <code>1</code>. Angles between 90 and 180 degrees are in quadrant <code>2</code>, angles between 180 and 270 degrees are in quadrant <code>3</code> and angles between 270 and 360 degrees are in quadrant <code>4</code>.</p>
918
-
919
- <p>Read only.</p>
920
-
921
-
922
-
923
- <ul class="member-list">
924
- <h4>Type:</h4>
925
- <li>
926
- <tt>Number</tt>
927
- </li>
928
- </ul>
929
-
930
-
931
- <h4>Example:</h4>
932
-
933
-
934
- <pre><code>var point = new Point({
935
- angle: 10,
936
- length: 20
937
- });
938
- console.log(point.quadrant); // 1
939
-
940
- point.angle = 100;
941
- console.log(point.quadrant); // 2
942
-
943
- point.angle = 190;
944
- console.log(point.quadrant); // 3
945
-
946
- point.angle = 280;
947
- console.log(point.quadrant); // 4</code></pre>
948
-
949
- </div>
950
-
951
- </div>
952
- </div>
953
-
954
-
955
- <div id="selected" class="member">
956
- <div class="member-link">
957
- <a name="selected" href="#selected"><tt><b>selected</b></tt></a>
958
- </div>
959
- <div class="member-description hidden">
960
-
961
- <div class="member-text">
962
- <p>This property is only valid if the point is an anchor or handle point of a <a href="../classes/Segment.html"><tt>Segment</tt></a> or a <a href="../classes/Curve.html"><tt>Curve</tt></a>, or the position of an <a href="../classes/Item.html"><tt>Item</tt></a>, as returned by <a href="../classes/Item.html#position"><tt>item.position</tt></a>, <a href="../classes/Segment.html#point"><tt>segment.point</tt></a>, <a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a>, <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>, <a href="../classes/Curve.html#point1"><tt>curve.point1</tt></a>, <a href="../classes/Curve.html#point2"><tt>curve.point2</tt></a>, <a href="../classes/Curve.html#handle1"><tt>curve.handle1</tt></a>, <a href="../classes/Curve.html#handle2"><tt>curve.handle2</tt></a>.</p>
963
- <p>In those cases, it returns <tt>true</tt> if it the point is selected, <tt>false</tt> otherwise.</p>
964
- <p>Paper.js renders selected points on top of your project. This is very useful when debugging.</p>
965
-
966
-
967
-
968
- <ul class="member-list">
969
- <h4>Default:</h4>
970
- <li><tt>false</tt></li>
971
- </ul>
972
-
973
- <ul class="member-list">
974
- <h4>Type:</h4>
975
- <li>
976
- <tt>Boolean</tt>
977
- </li>
978
- </ul>
979
-
980
-
981
- <h4>Example:</h4>
982
-
983
- <div class="paperscript split">
984
-
985
- <div class="buttons">
986
- <div class="button run">Run</div>
987
- </div>
988
-
989
- <script type="text/paperscript" canvas="canvas-0">
990
- var path = new Path.Circle({
991
- center: [80, 50],
992
- radius: 40
993
- });
994
-
995
- // Select the third segment point:
996
- path.segments[2].point.selected = true;
997
-
998
- // Select the item's position, which is the pivot point
999
- // around which it is transformed:
1000
- path.position.selected = true;
1001
- </script>
1002
- <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
1003
- </div>
1004
-
1005
-
1006
- </div>
1007
-
1008
- </div>
1009
- </div>
1010
-
1011
- </div>
1012
-
1013
-
1014
-
1015
-
1016
-
1017
- <!-- ============================== methods ================================ -->
1018
- <div class="reference-members">
1019
- <h2>Methods</h2>
1020
-
1021
-
1022
- <div id="set-values" class="member">
1023
- <div class="member-link">
1024
- <a name="set-values" href="#set-values"><tt><b>set</b>(...values)</tt></a>
1025
- </div>
1026
- <div class="member-description hidden">
1027
- <div class="member-text">
1028
- <p>Sets the point to the passed values. Note that any sequence of parameters that is supported by the various <a href="../classes/Point.html"><tt>Point</tt></a>() constructors also work for calls of <code>set()</code>.</p>
1029
-
1030
-
1031
- <ul class="member-list">
1032
- <h4>Parameters:</h4>
1033
-
1034
- <li>
1035
- <tt>values:</tt>
1036
- <tt>any value</tt>
1037
-
1038
-
1039
- </li>
1040
-
1041
- </ul>
1042
-
1043
-
1044
- <ul class="member-list">
1045
- <h4>Returns:</h4>
1046
-
1047
- <li>
1048
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
1049
- </li>
1050
-
1051
-
1052
- </ul>
1053
-
1054
-
1055
-
1056
-
1057
-
1058
- </div>
1059
- </div>
1060
- </div>
1061
-
1062
-
1063
- <div id="equals-point" class="member">
1064
- <div class="member-link">
1065
- <a name="equals-point" href="#equals-point"><tt><b>equals</b>(point)</tt></a>
1066
- </div>
1067
- <div class="member-description hidden">
1068
- <div class="member-text">
1069
- <p>Checks whether the coordinates of the point are equal to that of the supplied point.</p>
1070
-
1071
-
1072
- <ul class="member-list">
1073
- <h4>Parameters:</h4>
1074
-
1075
- <li>
1076
- <tt>point:</tt>
1077
- <a href="../classes/Point.html"><tt>Point</tt></a>
1078
-
1079
-
1080
- </li>
1081
-
1082
- </ul>
1083
-
1084
-
1085
- <ul class="member-list">
1086
- <h4>Returns:</h4>
1087
-
1088
- <li>
1089
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the points are equal, <tt>false</tt> otherwise
1090
- </li>
1091
-
1092
-
1093
- </ul>
1094
-
1095
-
1096
-
1097
-
1098
- <h4>Example:</h4>
1099
-
1100
-
1101
- <pre><code>var point = new Point(5, 10);
1102
- console.log(point == new Point(5, 10)); // true
1103
- console.log(point == new Point(1, 1)); // false
1104
- console.log(point != new Point(1, 1)); // true</code></pre>
1105
-
1106
- </div>
1107
- </div>
1108
- </div>
1109
-
1110
-
1111
- <div id="clone" class="member">
1112
- <div class="member-link">
1113
- <a name="clone" href="#clone"><tt><b>clone</b>()</tt></a>
1114
- </div>
1115
- <div class="member-description hidden">
1116
- <div class="member-text">
1117
- <p>Returns a copy of the point.</p>
1118
-
1119
-
1120
-
1121
- <ul class="member-list">
1122
- <h4>Returns:</h4>
1123
-
1124
- <li>
1125
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the cloned point
1126
- </li>
1127
-
1128
-
1129
- </ul>
1130
-
1131
-
1132
-
1133
-
1134
- <h4>Example:</h4>
1135
-
1136
-
1137
- <pre><code>var point1 = new Point();
1138
- var point2 = point1;
1139
- point2.x = 1; // also changes point1.x
1140
-
1141
- var point2 = point1.clone();
1142
- point2.x = 1; // doesn't change point1.x</code></pre>
1143
-
1144
- </div>
1145
- </div>
1146
- </div>
1147
-
1148
-
1149
- <div id="tostring" class="member">
1150
- <div class="member-link">
1151
- <a name="tostring" href="#tostring"><tt><b>toString</b>()</tt></a>
1152
- </div>
1153
- <div class="member-description hidden">
1154
- <div class="member-text">
1155
-
1156
-
1157
-
1158
-
1159
- <ul class="member-list">
1160
- <h4>Returns:</h4>
1161
-
1162
- <li>
1163
- <tt><tt>String</tt></tt>&nbsp;&mdash;&nbsp;a string representation of the point
1164
- </li>
1165
-
1166
-
1167
- </ul>
1168
-
1169
-
1170
-
1171
-
1172
-
1173
- </div>
1174
- </div>
1175
- </div>
1176
-
1177
-
1178
- <div id="getangle-point" class="member">
1179
- <div class="member-link">
1180
- <a name="getangle-point" href="#getangle-point"><tt><b>getAngle</b>(point)</tt></a>
1181
- </div>
1182
- <div class="member-description hidden">
1183
- <div class="member-text">
1184
- <p>Returns the smaller angle between two vectors. The angle is unsigned, no information about rotational direction is given.</p>
1185
-
1186
-
1187
- <ul class="member-list">
1188
- <h4>Parameters:</h4>
1189
-
1190
- <li>
1191
- <tt>point:</tt>
1192
- <a href="../classes/Point.html"><tt>Point</tt></a>
1193
-
1194
-
1195
- </li>
1196
-
1197
- </ul>
1198
-
1199
-
1200
- <ul class="member-list">
1201
- <h4>Returns:</h4>
1202
-
1203
- <li>
1204
- <tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;the angle in degrees
1205
- </li>
1206
-
1207
-
1208
- </ul>
1209
-
1210
-
1211
-
1212
-
1213
-
1214
- </div>
1215
- </div>
1216
- </div>
1217
-
1218
-
1219
- <div id="getangleinradians-point" class="member">
1220
- <div class="member-link">
1221
- <a name="getangleinradians-point" href="#getangleinradians-point"><tt><b>getAngleInRadians</b>(point)</tt></a>
1222
- </div>
1223
- <div class="member-description hidden">
1224
- <div class="member-text">
1225
- <p>Returns the smaller angle between two vectors in radians. The angle is unsigned, no information about rotational direction is given.</p>
1226
-
1227
-
1228
- <ul class="member-list">
1229
- <h4>Parameters:</h4>
1230
-
1231
- <li>
1232
- <tt>point:</tt>
1233
- <a href="../classes/Point.html"><tt>Point</tt></a>
1234
-
1235
-
1236
- </li>
1237
-
1238
- </ul>
1239
-
1240
-
1241
- <ul class="member-list">
1242
- <h4>Returns:</h4>
1243
-
1244
- <li>
1245
- <tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;the angle in radians
1246
- </li>
1247
-
1248
-
1249
- </ul>
1250
-
1251
-
1252
-
1253
-
1254
-
1255
- </div>
1256
- </div>
1257
- </div>
1258
-
1259
-
1260
- <div id="getdirectedangle-point" class="member">
1261
- <div class="member-link">
1262
- <a name="getdirectedangle-point" href="#getdirectedangle-point"><tt><b>getDirectedAngle</b>(point)</tt></a>
1263
- </div>
1264
- <div class="member-description hidden">
1265
- <div class="member-text">
1266
- <p>Returns the angle between two vectors. The angle is directional and signed, giving information about the rotational direction.</p>
1267
- <p>Read more about angle units and orientation in the description of the <a href="../classes/Point.html#angle"><tt>angle</tt></a> property.</p>
1268
-
1269
-
1270
- <ul class="member-list">
1271
- <h4>Parameters:</h4>
1272
-
1273
- <li>
1274
- <tt>point:</tt>
1275
- <a href="../classes/Point.html"><tt>Point</tt></a>
1276
-
1277
-
1278
- </li>
1279
-
1280
- </ul>
1281
-
1282
-
1283
- <ul class="member-list">
1284
- <h4>Returns:</h4>
1285
-
1286
- <li>
1287
- <tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;the angle between the two vectors
1288
- </li>
1289
-
1290
-
1291
- </ul>
1292
-
1293
-
1294
-
1295
-
1296
-
1297
- </div>
1298
- </div>
1299
- </div>
1300
-
1301
-
1302
- <div id="getdistance-point" class="member">
1303
- <div class="member-link">
1304
- <a name="getdistance-point" href="#getdistance-point"><tt><b>getDistance</b>(point[, squared])</tt></a>
1305
- </div>
1306
- <div class="member-description hidden">
1307
- <div class="member-text">
1308
- <p>Returns the distance between the point and another point.</p>
1309
-
1310
-
1311
- <ul class="member-list">
1312
- <h4>Parameters:</h4>
1313
-
1314
- <li>
1315
- <tt>point:</tt>
1316
- <a href="../classes/Point.html"><tt>Point</tt></a>
1317
-
1318
-
1319
- </li>
1320
-
1321
- <li>
1322
- <tt>squared:</tt>
1323
- <tt>Boolean</tt>
1324
- &mdash;&nbsp;Controls whether the distance should remain squared, or its square root should be calculated
1325
- &mdash;&nbsp;optional, default: <tt>false</tt>
1326
- </li>
1327
-
1328
- </ul>
1329
-
1330
-
1331
- <ul class="member-list">
1332
- <h4>Returns:</h4>
1333
-
1334
- <li>
1335
- <tt><tt>Number</tt></tt>
1336
- </li>
1337
-
1338
-
1339
- </ul>
1340
-
1341
-
1342
-
1343
-
1344
-
1345
- </div>
1346
- </div>
1347
- </div>
1348
-
1349
-
1350
- <div id="normalize" class="member">
1351
- <div class="member-link">
1352
- <a name="normalize" href="#normalize"><tt><b>normalize</b>([length])</tt></a>
1353
- </div>
1354
- <div class="member-description hidden">
1355
- <div class="member-text">
1356
- <p>Normalize modifies the <a href="../classes/Point.html#length"><tt>length</tt></a> of the vector to <code>1</code> without changing its angle and returns it as a new point. The optional <code>length</code> parameter defines the length to normalize to. The object itself is not modified!</p>
1357
-
1358
-
1359
- <ul class="member-list">
1360
- <h4>Parameters:</h4>
1361
-
1362
- <li>
1363
- <tt>length:</tt>
1364
- <tt>Number</tt>
1365
- &mdash;&nbsp;The length of the normalized vector
1366
- &mdash;&nbsp;optional, default: <tt>1</tt>
1367
- </li>
1368
-
1369
- </ul>
1370
-
1371
-
1372
- <ul class="member-list">
1373
- <h4>Returns:</h4>
1374
-
1375
- <li>
1376
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the normalized vector of the vector that is represented by this point&rsquo;s coordinates
1377
- </li>
1378
-
1379
-
1380
- </ul>
1381
-
1382
-
1383
-
1384
-
1385
-
1386
- </div>
1387
- </div>
1388
- </div>
1389
-
1390
-
1391
- <div id="rotate-angle-center" class="member">
1392
- <div class="member-link">
1393
- <a name="rotate-angle-center" href="#rotate-angle-center"><tt><b>rotate</b>(angle, center)</tt></a>
1394
- </div>
1395
- <div class="member-description hidden">
1396
- <div class="member-text">
1397
- <p>Rotates the point by the given angle around an optional center point. The object itself is not modified.</p>
1398
- <p>Read more about angle units and orientation in the description of the <a href="../classes/Point.html#angle"><tt>angle</tt></a> property.</p>
1399
-
1400
-
1401
- <ul class="member-list">
1402
- <h4>Parameters:</h4>
1403
-
1404
- <li>
1405
- <tt>angle:</tt>
1406
- <tt>Number</tt>
1407
- &mdash;&nbsp;the rotation angle
1408
-
1409
- </li>
1410
-
1411
- <li>
1412
- <tt>center:</tt>
1413
- <a href="../classes/Point.html"><tt>Point</tt></a>
1414
- &mdash;&nbsp;the center point of the rotation
1415
-
1416
- </li>
1417
-
1418
- </ul>
1419
-
1420
-
1421
- <ul class="member-list">
1422
- <h4>Returns:</h4>
1423
-
1424
- <li>
1425
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the rotated point
1426
- </li>
1427
-
1428
-
1429
- </ul>
1430
-
1431
-
1432
-
1433
-
1434
-
1435
- </div>
1436
- </div>
1437
- </div>
1438
-
1439
-
1440
- <div id="transform-matrix" class="member">
1441
- <div class="member-link">
1442
- <a name="transform-matrix" href="#transform-matrix"><tt><b>transform</b>(matrix)</tt></a>
1443
- </div>
1444
- <div class="member-description hidden">
1445
- <div class="member-text">
1446
- <p>Transforms the point by the matrix as a new point. The object itself is not modified!</p>
1447
-
1448
-
1449
- <ul class="member-list">
1450
- <h4>Parameters:</h4>
1451
-
1452
- <li>
1453
- <tt>matrix:</tt>
1454
- <a href="../classes/Matrix.html"><tt>Matrix</tt></a>
1455
-
1456
-
1457
- </li>
1458
-
1459
- </ul>
1460
-
1461
-
1462
- <ul class="member-list">
1463
- <h4>Returns:</h4>
1464
-
1465
- <li>
1466
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point
1467
- </li>
1468
-
1469
-
1470
- </ul>
1471
-
1472
-
1473
-
1474
-
1475
-
1476
- </div>
1477
- </div>
1478
- </div>
1479
-
1480
-
1481
- <h3>Tests</h3>
1482
-
1483
- <div id="isinside-rect" class="member">
1484
- <div class="member-link">
1485
- <a name="isinside-rect" href="#isinside-rect"><tt><b>isInside</b>(rect)</tt></a>
1486
- </div>
1487
- <div class="member-description hidden">
1488
- <div class="member-text">
1489
- <p>Checks whether the point is inside the boundaries of the rectangle.</p>
1490
-
1491
-
1492
- <ul class="member-list">
1493
- <h4>Parameters:</h4>
1494
-
1495
- <li>
1496
- <tt>rect:</tt>
1497
- <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
1498
- &mdash;&nbsp;the rectangle to check against
1499
-
1500
- </li>
1501
-
1502
- </ul>
1503
-
1504
-
1505
- <ul class="member-list">
1506
- <h4>Returns:</h4>
1507
-
1508
- <li>
1509
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the point is inside the rectangle, <tt>false</tt> otherwise
1510
- </li>
1511
-
1512
-
1513
- </ul>
1514
-
1515
-
1516
-
1517
-
1518
-
1519
- </div>
1520
- </div>
1521
- </div>
1522
-
1523
-
1524
- <div id="isclose-point-tolerance" class="member">
1525
- <div class="member-link">
1526
- <a name="isclose-point-tolerance" href="#isclose-point-tolerance"><tt><b>isClose</b>(point, tolerance)</tt></a>
1527
- </div>
1528
- <div class="member-description hidden">
1529
- <div class="member-text">
1530
- <p>Checks if the point is within a given distance of another point.</p>
1531
-
1532
-
1533
- <ul class="member-list">
1534
- <h4>Parameters:</h4>
1535
-
1536
- <li>
1537
- <tt>point:</tt>
1538
- <a href="../classes/Point.html"><tt>Point</tt></a>
1539
- &mdash;&nbsp;the point to check against
1540
-
1541
- </li>
1542
-
1543
- <li>
1544
- <tt>tolerance:</tt>
1545
- <tt>Number</tt>
1546
- &mdash;&nbsp;the maximum distance allowed
1547
-
1548
- </li>
1549
-
1550
- </ul>
1551
-
1552
-
1553
- <ul class="member-list">
1554
- <h4>Returns:</h4>
1555
-
1556
- <li>
1557
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if it is within the given distance, <tt>false</tt> otherwise
1558
- </li>
1559
-
1560
-
1561
- </ul>
1562
-
1563
-
1564
-
1565
-
1566
-
1567
- </div>
1568
- </div>
1569
- </div>
1570
-
1571
-
1572
- <div id="iscollinear-point" class="member">
1573
- <div class="member-link">
1574
- <a name="iscollinear-point" href="#iscollinear-point"><tt><b>isCollinear</b>(point)</tt></a>
1575
- </div>
1576
- <div class="member-description hidden">
1577
- <div class="member-text">
1578
- <p>Checks if the vector represented by this point is collinear (parallel) to another vector.</p>
1579
-
1580
-
1581
- <ul class="member-list">
1582
- <h4>Parameters:</h4>
1583
-
1584
- <li>
1585
- <tt>point:</tt>
1586
- <a href="../classes/Point.html"><tt>Point</tt></a>
1587
- &mdash;&nbsp;the vector to check against
1588
-
1589
- </li>
1590
-
1591
- </ul>
1592
-
1593
-
1594
- <ul class="member-list">
1595
- <h4>Returns:</h4>
1596
-
1597
- <li>
1598
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> it is collinear, <tt>false</tt> otherwise
1599
- </li>
1600
-
1601
-
1602
- </ul>
1603
-
1604
-
1605
-
1606
-
1607
-
1608
- </div>
1609
- </div>
1610
- </div>
1611
-
1612
-
1613
- <div id="isorthogonal-point" class="member">
1614
- <div class="member-link">
1615
- <a name="isorthogonal-point" href="#isorthogonal-point"><tt><b>isOrthogonal</b>(point)</tt></a>
1616
- </div>
1617
- <div class="member-description hidden">
1618
- <div class="member-text">
1619
- <p>Checks if the vector represented by this point is orthogonal (perpendicular) to another vector.</p>
1620
-
1621
-
1622
- <ul class="member-list">
1623
- <h4>Parameters:</h4>
1624
-
1625
- <li>
1626
- <tt>point:</tt>
1627
- <a href="../classes/Point.html"><tt>Point</tt></a>
1628
- &mdash;&nbsp;the vector to check against
1629
-
1630
- </li>
1631
-
1632
- </ul>
1633
-
1634
-
1635
- <ul class="member-list">
1636
- <h4>Returns:</h4>
1637
-
1638
- <li>
1639
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> it is orthogonal, <tt>false</tt> otherwise
1640
- </li>
1641
-
1642
-
1643
- </ul>
1644
-
1645
-
1646
-
1647
-
1648
-
1649
- </div>
1650
- </div>
1651
- </div>
1652
-
1653
-
1654
- <div id="iszero" class="member">
1655
- <div class="member-link">
1656
- <a name="iszero" href="#iszero"><tt><b>isZero</b>()</tt></a>
1657
- </div>
1658
- <div class="member-description hidden">
1659
- <div class="member-text">
1660
- <p>Checks if this point has both the x and y coordinate set to 0.</p>
1661
-
1662
-
1663
-
1664
- <ul class="member-list">
1665
- <h4>Returns:</h4>
1666
-
1667
- <li>
1668
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if both x and y are 0, <tt>false</tt> otherwise
1669
- </li>
1670
-
1671
-
1672
- </ul>
1673
-
1674
-
1675
-
1676
-
1677
-
1678
- </div>
1679
- </div>
1680
- </div>
1681
-
1682
-
1683
- <div id="isnan" class="member">
1684
- <div class="member-link">
1685
- <a name="isnan" href="#isnan"><tt><b>isNaN</b>()</tt></a>
1686
- </div>
1687
- <div class="member-description hidden">
1688
- <div class="member-text">
1689
- <p>Checks if this point has an undefined value for at least one of its coordinates.</p>
1690
-
1691
-
1692
-
1693
- <ul class="member-list">
1694
- <h4>Returns:</h4>
1695
-
1696
- <li>
1697
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if either x or y are not a number, <tt>false</tt> otherwise
1698
- </li>
1699
-
1700
-
1701
- </ul>
1702
-
1703
-
1704
-
1705
-
1706
-
1707
- </div>
1708
- </div>
1709
- </div>
1710
-
1711
-
1712
- <div id="isinquadrant-quadrant" class="member">
1713
- <div class="member-link">
1714
- <a name="isinquadrant-quadrant" href="#isinquadrant-quadrant"><tt><b>isInQuadrant</b>(quadrant)</tt></a>
1715
- </div>
1716
- <div class="member-description hidden">
1717
- <div class="member-text">
1718
- <p>Checks if the vector is within the specified quadrant. Note that if the vector lies on the boundary between two quadrants, <code>true</code> will be returned for both quadrants.</p>
1719
-
1720
-
1721
- <ul class="member-list">
1722
- <h4>Parameters:</h4>
1723
-
1724
- <li>
1725
- <tt>quadrant:</tt>
1726
- <tt>Number</tt>
1727
- &mdash;&nbsp;the quadrant to check against
1728
-
1729
- </li>
1730
-
1731
- </ul>
1732
-
1733
-
1734
- <ul class="member-list">
1735
- <h4>Returns:</h4>
1736
-
1737
- <li>
1738
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if either x or y are not a number, <tt>false</tt> otherwise
1739
- </li>
1740
-
1741
-
1742
- </ul>
1743
-
1744
-
1745
-
1746
-
1747
- <ul class="member-list">
1748
- <h4>See also:</h4>
1749
-
1750
- <li><tt><a href="../classes/Point.html#quadrant"><tt>quadrant</tt></a></tt></li>
1751
-
1752
- </ul>
1753
-
1754
-
1755
- </div>
1756
- </div>
1757
- </div>
1758
-
1759
-
1760
- <h3>Vector Math Functions</h3>
1761
-
1762
- <div id="dot-point" class="member">
1763
- <div class="member-link">
1764
- <a name="dot-point" href="#dot-point"><tt><b>dot</b>(point)</tt></a>
1765
- </div>
1766
- <div class="member-description hidden">
1767
- <div class="member-text">
1768
- <p>Returns the dot product of the point and another point.</p>
1769
-
1770
-
1771
- <ul class="member-list">
1772
- <h4>Parameters:</h4>
1773
-
1774
- <li>
1775
- <tt>point:</tt>
1776
- <a href="../classes/Point.html"><tt>Point</tt></a>
1777
-
1778
-
1779
- </li>
1780
-
1781
- </ul>
1782
-
1783
-
1784
- <ul class="member-list">
1785
- <h4>Returns:</h4>
1786
-
1787
- <li>
1788
- <tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;the dot product of the two points
1789
- </li>
1790
-
1791
-
1792
- </ul>
1793
-
1794
-
1795
-
1796
-
1797
-
1798
- </div>
1799
- </div>
1800
- </div>
1801
-
1802
-
1803
- <div id="cross-point" class="member">
1804
- <div class="member-link">
1805
- <a name="cross-point" href="#cross-point"><tt><b>cross</b>(point)</tt></a>
1806
- </div>
1807
- <div class="member-description hidden">
1808
- <div class="member-text">
1809
- <p>Returns the cross product of the point and another point.</p>
1810
-
1811
-
1812
- <ul class="member-list">
1813
- <h4>Parameters:</h4>
1814
-
1815
- <li>
1816
- <tt>point:</tt>
1817
- <a href="../classes/Point.html"><tt>Point</tt></a>
1818
-
1819
-
1820
- </li>
1821
-
1822
- </ul>
1823
-
1824
-
1825
- <ul class="member-list">
1826
- <h4>Returns:</h4>
1827
-
1828
- <li>
1829
- <tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;the cross product of the two points
1830
- </li>
1831
-
1832
-
1833
- </ul>
1834
-
1835
-
1836
-
1837
-
1838
-
1839
- </div>
1840
- </div>
1841
- </div>
1842
-
1843
-
1844
- <div id="project-point" class="member">
1845
- <div class="member-link">
1846
- <a name="project-point" href="#project-point"><tt><b>project</b>(point)</tt></a>
1847
- </div>
1848
- <div class="member-description hidden">
1849
- <div class="member-text">
1850
- <p>Returns the projection of the point onto another point. Both points are interpreted as vectors.</p>
1851
-
1852
-
1853
- <ul class="member-list">
1854
- <h4>Parameters:</h4>
1855
-
1856
- <li>
1857
- <tt>point:</tt>
1858
- <a href="../classes/Point.html"><tt>Point</tt></a>
1859
-
1860
-
1861
- </li>
1862
-
1863
- </ul>
1864
-
1865
-
1866
- <ul class="member-list">
1867
- <h4>Returns:</h4>
1868
-
1869
- <li>
1870
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the projection of the point onto another point
1871
- </li>
1872
-
1873
-
1874
- </ul>
1875
-
1876
-
1877
-
1878
-
1879
-
1880
- </div>
1881
- </div>
1882
- </div>
1883
-
1884
-
1885
- <h3>Math Functions</h3>
1886
-
1887
- <div id="round" class="member">
1888
- <div class="member-link">
1889
- <a name="round" href="#round"><tt><b>round</b>()</tt></a>
1890
- </div>
1891
- <div class="member-description hidden">
1892
- <div class="member-text">
1893
- <p>Returns a new point with rounded <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> values. The object itself is not modified!</p>
1894
-
1895
-
1896
-
1897
- <ul class="member-list">
1898
- <h4>Returns:</h4>
1899
-
1900
- <li>
1901
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
1902
- </li>
1903
-
1904
-
1905
- </ul>
1906
-
1907
-
1908
-
1909
-
1910
- <h4>Example:</h4>
1911
-
1912
-
1913
- <pre><code>var point = new Point(10.2, 10.9);
1914
- var roundPoint = point.round();
1915
- console.log(roundPoint); // {x: 10, y: 11}</code></pre>
1916
-
1917
- </div>
1918
- </div>
1919
- </div>
1920
-
1921
-
1922
- <div id="ceil" class="member">
1923
- <div class="member-link">
1924
- <a name="ceil" href="#ceil"><tt><b>ceil</b>()</tt></a>
1925
- </div>
1926
- <div class="member-description hidden">
1927
- <div class="member-text">
1928
- <p>Returns a new point with the nearest greater non-fractional values to the specified <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> values. The object itself is not modified!</p>
1929
-
1930
-
1931
-
1932
- <ul class="member-list">
1933
- <h4>Returns:</h4>
1934
-
1935
- <li>
1936
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
1937
- </li>
1938
-
1939
-
1940
- </ul>
1941
-
1942
-
1943
-
1944
-
1945
- <h4>Example:</h4>
1946
-
1947
-
1948
- <pre><code>var point = new Point(10.2, 10.9);
1949
- var ceilPoint = point.ceil();
1950
- console.log(ceilPoint); // {x: 11, y: 11}</code></pre>
1951
-
1952
- </div>
1953
- </div>
1954
- </div>
1955
-
1956
-
1957
- <div id="floor" class="member">
1958
- <div class="member-link">
1959
- <a name="floor" href="#floor"><tt><b>floor</b>()</tt></a>
1960
- </div>
1961
- <div class="member-description hidden">
1962
- <div class="member-text">
1963
- <p>Returns a new point with the nearest smaller non-fractional values to the specified <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> values. The object itself is not modified!</p>
1964
-
1965
-
1966
-
1967
- <ul class="member-list">
1968
- <h4>Returns:</h4>
1969
-
1970
- <li>
1971
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
1972
- </li>
1973
-
1974
-
1975
- </ul>
1976
-
1977
-
1978
-
1979
-
1980
- <h4>Example:</h4>
1981
-
1982
-
1983
- <pre><code>var point = new Point(10.2, 10.9);
1984
- var floorPoint = point.floor();
1985
- console.log(floorPoint); // {x: 10, y: 10}</code></pre>
1986
-
1987
- </div>
1988
- </div>
1989
- </div>
1990
-
1991
-
1992
- <div id="abs" class="member">
1993
- <div class="member-link">
1994
- <a name="abs" href="#abs"><tt><b>abs</b>()</tt></a>
1995
- </div>
1996
- <div class="member-description hidden">
1997
- <div class="member-text">
1998
- <p>Returns a new point with the absolute values of the specified <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> values. The object itself is not modified!</p>
1999
-
2000
-
2001
-
2002
- <ul class="member-list">
2003
- <h4>Returns:</h4>
2004
-
2005
- <li>
2006
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>
2007
- </li>
2008
-
2009
-
2010
- </ul>
2011
-
2012
-
2013
-
2014
-
2015
- <h4>Example:</h4>
2016
-
2017
-
2018
- <pre><code>var point = new Point(-5, 10);
2019
- var absPoint = point.abs();
2020
- console.log(absPoint); // {x: 5, y: 10}</code></pre>
2021
-
2022
- </div>
2023
- </div>
2024
- </div>
2025
-
2026
-
2027
-
2028
- <h3>Math Operator Functions</h3>
2029
-
2030
-
2031
-
2032
- <div id="add-number" class="member">
2033
- <div class="member-link">
2034
- <a name="add-number" href="#add-number"><tt><b>add</b>(number)</tt></a>
2035
- </div>
2036
- <div class="member-description hidden">
2037
- <div class="member-text">
2038
- <p>Returns the addition of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
2039
-
2040
-
2041
- <ul class="member-list">
2042
- <h4>Parameters:</h4>
2043
-
2044
- <li>
2045
- <tt>number:</tt>
2046
- <tt>Number</tt>
2047
- &mdash;&nbsp;the number to add
2048
-
2049
- </li>
2050
-
2051
- </ul>
2052
-
2053
-
2054
- <ul class="member-list">
2055
- <h4>Returns:</h4>
2056
-
2057
- <li>
2058
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the addition of the point and the value as a new point
2059
- </li>
2060
-
2061
-
2062
- </ul>
2063
-
2064
-
2065
-
2066
-
2067
- <h4>Example:</h4>
2068
-
2069
-
2070
- <pre><code>var point = new Point(5, 10);
2071
- var result = point + 20;
2072
- console.log(result); // {x: 25, y: 30}</code></pre>
2073
-
2074
- </div>
2075
- </div>
2076
- </div>
2077
-
2078
-
2079
- <div id="add-point" class="member">
2080
- <div class="member-link">
2081
- <a name="add-point" href="#add-point"><tt><b>add</b>(point)</tt></a>
2082
- </div>
2083
- <div class="member-description hidden">
2084
- <div class="member-text">
2085
- <p>Returns the addition of the supplied point to the point as a new point. The object itself is not modified!</p>
2086
-
2087
-
2088
- <ul class="member-list">
2089
- <h4>Parameters:</h4>
2090
-
2091
- <li>
2092
- <tt>point:</tt>
2093
- <a href="../classes/Point.html"><tt>Point</tt></a>
2094
- &mdash;&nbsp;the point to add
2095
-
2096
- </li>
2097
-
2098
- </ul>
2099
-
2100
-
2101
- <ul class="member-list">
2102
- <h4>Returns:</h4>
2103
-
2104
- <li>
2105
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the addition of the two points as a new point
2106
- </li>
2107
-
2108
-
2109
- </ul>
2110
-
2111
-
2112
-
2113
-
2114
- <h4>Example:</h4>
2115
-
2116
-
2117
- <pre><code>var point1 = new Point(5, 10);
2118
- var point2 = new Point(10, 20);
2119
- var result = point1 + point2;
2120
- console.log(result); // {x: 15, y: 30}</code></pre>
2121
-
2122
- </div>
2123
- </div>
2124
- </div>
2125
-
2126
-
2127
-
2128
-
2129
-
2130
- <div id="subtract-number" class="member">
2131
- <div class="member-link">
2132
- <a name="subtract-number" href="#subtract-number"><tt><b>subtract</b>(number)</tt></a>
2133
- </div>
2134
- <div class="member-description hidden">
2135
- <div class="member-text">
2136
- <p>Returns the subtraction of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
2137
-
2138
-
2139
- <ul class="member-list">
2140
- <h4>Parameters:</h4>
2141
-
2142
- <li>
2143
- <tt>number:</tt>
2144
- <tt>Number</tt>
2145
- &mdash;&nbsp;the number to subtract
2146
-
2147
- </li>
2148
-
2149
- </ul>
2150
-
2151
-
2152
- <ul class="member-list">
2153
- <h4>Returns:</h4>
2154
-
2155
- <li>
2156
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the subtraction of the point and the value as a new point
2157
- </li>
2158
-
2159
-
2160
- </ul>
2161
-
2162
-
2163
-
2164
-
2165
- <h4>Example:</h4>
2166
-
2167
-
2168
- <pre><code>var point = new Point(10, 20);
2169
- var result = point - 5;
2170
- console.log(result); // {x: 5, y: 15}</code></pre>
2171
-
2172
- </div>
2173
- </div>
2174
- </div>
2175
-
2176
-
2177
- <div id="subtract-point" class="member">
2178
- <div class="member-link">
2179
- <a name="subtract-point" href="#subtract-point"><tt><b>subtract</b>(point)</tt></a>
2180
- </div>
2181
- <div class="member-description hidden">
2182
- <div class="member-text">
2183
- <p>Returns the subtraction of the supplied point to the point as a new point. The object itself is not modified!</p>
2184
-
2185
-
2186
- <ul class="member-list">
2187
- <h4>Parameters:</h4>
2188
-
2189
- <li>
2190
- <tt>point:</tt>
2191
- <a href="../classes/Point.html"><tt>Point</tt></a>
2192
- &mdash;&nbsp;the point to subtract
2193
-
2194
- </li>
2195
-
2196
- </ul>
2197
-
2198
-
2199
- <ul class="member-list">
2200
- <h4>Returns:</h4>
2201
-
2202
- <li>
2203
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the subtraction of the two points as a new point
2204
- </li>
2205
-
2206
-
2207
- </ul>
2208
-
2209
-
2210
-
2211
-
2212
- <h4>Example:</h4>
2213
-
2214
-
2215
- <pre><code>var firstPoint = new Point(10, 20);
2216
- var secondPoint = new Point(5, 5);
2217
- var result = firstPoint - secondPoint;
2218
- console.log(result); // {x: 5, y: 15}</code></pre>
2219
-
2220
- </div>
2221
- </div>
2222
- </div>
2223
-
2224
-
2225
-
2226
-
2227
-
2228
- <div id="multiply-number" class="member">
2229
- <div class="member-link">
2230
- <a name="multiply-number" href="#multiply-number"><tt><b>multiply</b>(number)</tt></a>
2231
- </div>
2232
- <div class="member-description hidden">
2233
- <div class="member-text">
2234
- <p>Returns the multiplication of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
2235
-
2236
-
2237
- <ul class="member-list">
2238
- <h4>Parameters:</h4>
2239
-
2240
- <li>
2241
- <tt>number:</tt>
2242
- <tt>Number</tt>
2243
- &mdash;&nbsp;the number to multiply by
2244
-
2245
- </li>
2246
-
2247
- </ul>
2248
-
2249
-
2250
- <ul class="member-list">
2251
- <h4>Returns:</h4>
2252
-
2253
- <li>
2254
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the multiplication of the point and the value as a new point
2255
- </li>
2256
-
2257
-
2258
- </ul>
2259
-
2260
-
2261
-
2262
-
2263
- <h4>Example:</h4>
2264
-
2265
-
2266
- <pre><code>var point = new Point(10, 20);
2267
- var result = point * 2;
2268
- console.log(result); // {x: 20, y: 40}</code></pre>
2269
-
2270
- </div>
2271
- </div>
2272
- </div>
2273
-
2274
-
2275
- <div id="multiply-point" class="member">
2276
- <div class="member-link">
2277
- <a name="multiply-point" href="#multiply-point"><tt><b>multiply</b>(point)</tt></a>
2278
- </div>
2279
- <div class="member-description hidden">
2280
- <div class="member-text">
2281
- <p>Returns the multiplication of the supplied point to the point as a new point. The object itself is not modified!</p>
2282
-
2283
-
2284
- <ul class="member-list">
2285
- <h4>Parameters:</h4>
2286
-
2287
- <li>
2288
- <tt>point:</tt>
2289
- <a href="../classes/Point.html"><tt>Point</tt></a>
2290
- &mdash;&nbsp;the point to multiply by
2291
-
2292
- </li>
2293
-
2294
- </ul>
2295
-
2296
-
2297
- <ul class="member-list">
2298
- <h4>Returns:</h4>
2299
-
2300
- <li>
2301
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the multiplication of the two points as a new point
2302
- </li>
2303
-
2304
-
2305
- </ul>
2306
-
2307
-
2308
-
2309
-
2310
- <h4>Example:</h4>
2311
-
2312
-
2313
- <pre><code>var firstPoint = new Point(5, 10);
2314
- var secondPoint = new Point(4, 2);
2315
- var result = firstPoint * secondPoint;
2316
- console.log(result); // {x: 20, y: 20}</code></pre>
2317
-
2318
- </div>
2319
- </div>
2320
- </div>
2321
-
2322
-
2323
-
2324
-
2325
-
2326
- <div id="divide-number" class="member">
2327
- <div class="member-link">
2328
- <a name="divide-number" href="#divide-number"><tt><b>divide</b>(number)</tt></a>
2329
- </div>
2330
- <div class="member-description hidden">
2331
- <div class="member-text">
2332
- <p>Returns the division of the supplied value to both coordinates of the point as a new point. The object itself is not modified!</p>
2333
-
2334
-
2335
- <ul class="member-list">
2336
- <h4>Parameters:</h4>
2337
-
2338
- <li>
2339
- <tt>number:</tt>
2340
- <tt>Number</tt>
2341
- &mdash;&nbsp;the number to divide by
2342
-
2343
- </li>
2344
-
2345
- </ul>
2346
-
2347
-
2348
- <ul class="member-list">
2349
- <h4>Returns:</h4>
2350
-
2351
- <li>
2352
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the division of the point and the value as a new point
2353
- </li>
2354
-
2355
-
2356
- </ul>
2357
-
2358
-
2359
-
2360
-
2361
- <h4>Example:</h4>
2362
-
2363
-
2364
- <pre><code>var point = new Point(10, 20);
2365
- var result = point / 2;
2366
- console.log(result); // {x: 5, y: 10}</code></pre>
2367
-
2368
- </div>
2369
- </div>
2370
- </div>
2371
-
2372
-
2373
- <div id="divide-point" class="member">
2374
- <div class="member-link">
2375
- <a name="divide-point" href="#divide-point"><tt><b>divide</b>(point)</tt></a>
2376
- </div>
2377
- <div class="member-description hidden">
2378
- <div class="member-text">
2379
- <p>Returns the division of the supplied point to the point as a new point. The object itself is not modified!</p>
2380
-
2381
-
2382
- <ul class="member-list">
2383
- <h4>Parameters:</h4>
2384
-
2385
- <li>
2386
- <tt>point:</tt>
2387
- <a href="../classes/Point.html"><tt>Point</tt></a>
2388
- &mdash;&nbsp;the point to divide by
2389
-
2390
- </li>
2391
-
2392
- </ul>
2393
-
2394
-
2395
- <ul class="member-list">
2396
- <h4>Returns:</h4>
2397
-
2398
- <li>
2399
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the division of the two points as a new point
2400
- </li>
2401
-
2402
-
2403
- </ul>
2404
-
2405
-
2406
-
2407
-
2408
- <h4>Example:</h4>
2409
-
2410
-
2411
- <pre><code>var firstPoint = new Point(8, 10);
2412
- var secondPoint = new Point(2, 5);
2413
- var result = firstPoint / secondPoint;
2414
- console.log(result); // {x: 4, y: 2}</code></pre>
2415
-
2416
- </div>
2417
- </div>
2418
- </div>
2419
-
2420
-
2421
-
2422
-
2423
-
2424
- <div id="modulo-value" class="member">
2425
- <div class="member-link">
2426
- <a name="modulo-value" href="#modulo-value"><tt><b>modulo</b>(value)</tt></a>
2427
- </div>
2428
- <div class="member-description hidden">
2429
- <div class="member-text">
2430
- <p>The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point.</p>
2431
-
2432
-
2433
- <ul class="member-list">
2434
- <h4>Parameters:</h4>
2435
-
2436
- <li>
2437
- <tt>value:</tt>
2438
- <tt>Number</tt>
2439
-
2440
-
2441
- </li>
2442
-
2443
- </ul>
2444
-
2445
-
2446
- <ul class="member-list">
2447
- <h4>Returns:</h4>
2448
-
2449
- <li>
2450
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the integer remainders of dividing the point by the value as a new point
2451
- </li>
2452
-
2453
-
2454
- </ul>
2455
-
2456
-
2457
-
2458
-
2459
- <h4>Example:</h4>
2460
-
2461
-
2462
- <pre><code>var point = new Point(12, 6);
2463
- console.log(point % 5); // {x: 2, y: 1}</code></pre>
2464
-
2465
- </div>
2466
- </div>
2467
- </div>
2468
-
2469
-
2470
- <div id="modulo-point" class="member">
2471
- <div class="member-link">
2472
- <a name="modulo-point" href="#modulo-point"><tt><b>modulo</b>(point)</tt></a>
2473
- </div>
2474
- <div class="member-description hidden">
2475
- <div class="member-text">
2476
- <p>The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point.</p>
2477
-
2478
-
2479
- <ul class="member-list">
2480
- <h4>Parameters:</h4>
2481
-
2482
- <li>
2483
- <tt>point:</tt>
2484
- <a href="../classes/Point.html"><tt>Point</tt></a>
2485
-
2486
-
2487
- </li>
2488
-
2489
- </ul>
2490
-
2491
-
2492
- <ul class="member-list">
2493
- <h4>Returns:</h4>
2494
-
2495
- <li>
2496
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the integer remainders of dividing the points by each other as a new point
2497
- </li>
2498
-
2499
-
2500
- </ul>
2501
-
2502
-
2503
-
2504
-
2505
- <h4>Example:</h4>
2506
-
2507
-
2508
- <pre><code>var point = new Point(12, 6);
2509
- console.log(point % new Point(5, 2)); // {x: 2, y: 0}</code></pre>
2510
-
2511
- </div>
2512
- </div>
2513
- </div>
2514
-
2515
-
2516
-
2517
-
2518
- </div>
2519
-
2520
-
2521
- <div class="reference-members">
2522
- <h2>Static Methods</h2>
2523
-
2524
-
2525
- <div id="min-point1-point2" class="member">
2526
- <div class="member-link">
2527
- <a name="min-point1-point2" href="#min-point1-point2"><tt><b>Point.min</b>(point1, point2)</tt></a>
2528
- </div>
2529
- <div class="member-description hidden">
2530
- <div class="member-text">
2531
- <p>Returns a new point object with the smallest <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> of the supplied points.</p>
2532
-
2533
-
2534
- <ul class="member-list">
2535
- <h4>Parameters:</h4>
2536
-
2537
- <li>
2538
- <tt>point1:</tt>
2539
- <a href="../classes/Point.html"><tt>Point</tt></a>
2540
-
2541
-
2542
- </li>
2543
-
2544
- <li>
2545
- <tt>point2:</tt>
2546
- <a href="../classes/Point.html"><tt>Point</tt></a>
2547
-
2548
-
2549
- </li>
2550
-
2551
- </ul>
2552
-
2553
-
2554
- <ul class="member-list">
2555
- <h4>Returns:</h4>
2556
-
2557
- <li>
2558
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created point object
2559
- </li>
2560
-
2561
-
2562
- </ul>
2563
-
2564
-
2565
-
2566
-
2567
- <h4>Example:</h4>
2568
-
2569
-
2570
- <pre><code>var point1 = new Point(10, 100);
2571
- var point2 = new Point(200, 5);
2572
- var minPoint = Point.min(point1, point2);
2573
- console.log(minPoint); // {x: 10, y: 5}</code></pre>
2574
-
2575
- <h4>Example:<span class="description">Find the minimum of multiple points:</span></h4>
2576
-
2577
-
2578
- <pre><code>var point1 = new Point(60, 100);
2579
- var point2 = new Point(200, 5);
2580
- var point3 = new Point(250, 35);
2581
- [point1, point2, point3].reduce(Point.min) // {x: 60, y: 5}</code></pre>
2582
-
2583
- </div>
2584
- </div>
2585
- </div>
2586
-
2587
-
2588
- <div id="max-point1-point2" class="member">
2589
- <div class="member-link">
2590
- <a name="max-point1-point2" href="#max-point1-point2"><tt><b>Point.max</b>(point1, point2)</tt></a>
2591
- </div>
2592
- <div class="member-description hidden">
2593
- <div class="member-text">
2594
- <p>Returns a new point object with the largest <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> of the supplied points.</p>
2595
-
2596
-
2597
- <ul class="member-list">
2598
- <h4>Parameters:</h4>
2599
-
2600
- <li>
2601
- <tt>point1:</tt>
2602
- <a href="../classes/Point.html"><tt>Point</tt></a>
2603
-
2604
-
2605
- </li>
2606
-
2607
- <li>
2608
- <tt>point2:</tt>
2609
- <a href="../classes/Point.html"><tt>Point</tt></a>
2610
-
2611
-
2612
- </li>
2613
-
2614
- </ul>
2615
-
2616
-
2617
- <ul class="member-list">
2618
- <h4>Returns:</h4>
2619
-
2620
- <li>
2621
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created point object
2622
- </li>
2623
-
2624
-
2625
- </ul>
2626
-
2627
-
2628
-
2629
-
2630
- <h4>Example:</h4>
2631
-
2632
-
2633
- <pre><code>var point1 = new Point(10, 100);
2634
- var point2 = new Point(200, 5);
2635
- var maxPoint = Point.max(point1, point2);
2636
- console.log(maxPoint); // {x: 200, y: 100}</code></pre>
2637
-
2638
- <h4>Example:<span class="description">Find the maximum of multiple points:</span></h4>
2639
-
2640
-
2641
- <pre><code>var point1 = new Point(60, 100);
2642
- var point2 = new Point(200, 5);
2643
- var point3 = new Point(250, 35);
2644
- [point1, point2, point3].reduce(Point.max) // {x: 250, y: 100}</code></pre>
2645
-
2646
- </div>
2647
- </div>
2648
- </div>
2649
-
2650
-
2651
- <div id="random" class="member">
2652
- <div class="member-link">
2653
- <a name="random" href="#random"><tt><b>Point.random</b>()</tt></a>
2654
- </div>
2655
- <div class="member-description hidden">
2656
- <div class="member-text">
2657
- <p>Returns a point object with random <a href="../classes/Point.html#x"><tt>x</tt></a> and <a href="../classes/Point.html#y"><tt>y</tt></a> values between <code>0</code> and <code>1</code>.</p>
2658
-
2659
-
2660
-
2661
- <ul class="member-list">
2662
- <h4>Returns:</h4>
2663
-
2664
- <li>
2665
- <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created point object
2666
- </li>
2667
-
2668
-
2669
- </ul>
2670
-
2671
-
2672
-
2673
-
2674
- <h4>Example:</h4>
2675
-
2676
-
2677
- <pre><code>var maxPoint = new Point(100, 100);
2678
- var randomPoint = Point.random();
2679
-
2680
- // A point between {x:0, y:0} and {x:100, y:100}:
2681
- var point = maxPoint * randomPoint;</code></pre>
2682
-
2683
- </div>
2684
- </div>
2685
- </div>
2686
-
2687
- </div>
2688
-
2689
-
2690
-
2691
- <!-- =========================== copyright notice ========================== -->
2692
- <p class="footer">
2693
- Paper.js v0.12.17<br>
2694
- Copyright &#169; 2011—2022 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
2695
- <div class="content-end"></div>
2696
-
2697
-
2698
- </article>
2699
- </body>