How to use coordinates method in root

Best JavaScript code snippet using root

simplifyflatgeom.js

Source:simplifyflatgeom.js Github

copy

Full Screen

1// Based on simplify-js https://github.com/mourner/simplify-js2// Copyright (c) 2012, Vladimir Agafonkin3// All rights reserved.4//5// Redistribution and use in source and binary forms, with or without6// modification, are permitted provided that the following conditions are met:7//8// 1. Redistributions of source code must retain the above copyright notice,9// this list of conditions and the following disclaimer.10//11// 2. Redistributions in binary form must reproduce the above copyright12// notice, this list of conditions and the following disclaimer in the13// documentation and/or other materials provided with the distribution.14//15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"16// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE19// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR20// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF21// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS22// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN23// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)24// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE25// POSSIBILITY OF SUCH DAMAGE.26goog.provide('ol.geom.flat.simplify');27goog.require('ol.math');28/**29 * @param {Array.<number>} flatCoordinates Flat coordinates.30 * @param {number} offset Offset.31 * @param {number} end End.32 * @param {number} stride Stride.33 * @param {number} squaredTolerance Squared tolerance.34 * @param {boolean} highQuality Highest quality.35 * @param {Array.<number>=} opt_simplifiedFlatCoordinates Simplified flat36 * coordinates.37 * @return {Array.<number>} Simplified line string.38 */39ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,40 stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {41 var simplifiedFlatCoordinates = goog.isDef(opt_simplifiedFlatCoordinates) ?42 opt_simplifiedFlatCoordinates : [];43 if (!highQuality) {44 end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,45 stride, squaredTolerance,46 simplifiedFlatCoordinates, 0);47 flatCoordinates = simplifiedFlatCoordinates;48 offset = 0;49 stride = 2;50 }51 simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker(52 flatCoordinates, offset, end, stride, squaredTolerance,53 simplifiedFlatCoordinates, 0);54 return simplifiedFlatCoordinates;55};56/**57 * @param {Array.<number>} flatCoordinates Flat coordinates.58 * @param {number} offset Offset.59 * @param {number} end End.60 * @param {number} stride Stride.61 * @param {number} squaredTolerance Squared tolerance.62 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat63 * coordinates.64 * @param {number} simplifiedOffset Simplified offset.65 * @return {number} Simplified offset.66 */67ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,68 stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {69 var n = (end - offset) / stride;70 if (n < 3) {71 for (; offset < end; offset += stride) {72 simplifiedFlatCoordinates[simplifiedOffset++] =73 flatCoordinates[offset];74 simplifiedFlatCoordinates[simplifiedOffset++] =75 flatCoordinates[offset + 1];76 }77 return simplifiedOffset;78 }79 /** @type {Array.<number>} */80 var markers = new Array(n);81 markers[0] = 1;82 markers[n - 1] = 1;83 /** @type {Array.<number>} */84 var stack = [offset, end - stride];85 var index = 0;86 var i;87 while (stack.length > 0) {88 var last = stack.pop();89 var first = stack.pop();90 var maxSquaredDistance = 0;91 var x1 = flatCoordinates[first];92 var y1 = flatCoordinates[first + 1];93 var x2 = flatCoordinates[last];94 var y2 = flatCoordinates[last + 1];95 for (i = first + stride; i < last; i += stride) {96 var x = flatCoordinates[i];97 var y = flatCoordinates[i + 1];98 var squaredDistance = ol.math.squaredSegmentDistance(99 x, y, x1, y1, x2, y2);100 if (squaredDistance > maxSquaredDistance) {101 index = i;102 maxSquaredDistance = squaredDistance;103 }104 }105 if (maxSquaredDistance > squaredTolerance) {106 markers[(index - offset) / stride] = 1;107 if (first + stride < index) {108 stack.push(first, index);109 }110 if (index + stride < last) {111 stack.push(index, last);112 }113 }114 }115 for (i = 0; i < n; ++i) {116 if (markers[i]) {117 simplifiedFlatCoordinates[simplifiedOffset++] =118 flatCoordinates[offset + i * stride];119 simplifiedFlatCoordinates[simplifiedOffset++] =120 flatCoordinates[offset + i * stride + 1];121 }122 }123 return simplifiedOffset;124};125/**126 * @param {Array.<number>} flatCoordinates Flat coordinates.127 * @param {number} offset Offset.128 * @param {Array.<number>} ends Ends.129 * @param {number} stride Stride.130 * @param {number} squaredTolerance Squared tolerance.131 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat132 * coordinates.133 * @param {number} simplifiedOffset Simplified offset.134 * @param {Array.<number>} simplifiedEnds Simplified ends.135 * @return {number} Simplified offset.136 */137ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset,138 ends, stride, squaredTolerance, simplifiedFlatCoordinates,139 simplifiedOffset, simplifiedEnds) {140 var i, ii;141 for (i = 0, ii = ends.length; i < ii; ++i) {142 var end = ends[i];143 simplifiedOffset = ol.geom.flat.simplify.douglasPeucker(144 flatCoordinates, offset, end, stride, squaredTolerance,145 simplifiedFlatCoordinates, simplifiedOffset);146 simplifiedEnds.push(simplifiedOffset);147 offset = end;148 }149 return simplifiedOffset;150};151/**152 * @param {Array.<number>} flatCoordinates Flat coordinates.153 * @param {number} offset Offset.154 * @param {Array.<Array.<number>>} endss Endss.155 * @param {number} stride Stride.156 * @param {number} squaredTolerance Squared tolerance.157 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat158 * coordinates.159 * @param {number} simplifiedOffset Simplified offset.160 * @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.161 * @return {number} Simplified offset.162 */163ol.geom.flat.simplify.douglasPeuckerss = function(164 flatCoordinates, offset, endss, stride, squaredTolerance,165 simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {166 var i, ii;167 for (i = 0, ii = endss.length; i < ii; ++i) {168 var ends = endss[i];169 var simplifiedEnds = [];170 simplifiedOffset = ol.geom.flat.simplify.douglasPeuckers(171 flatCoordinates, offset, ends, stride, squaredTolerance,172 simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);173 simplifiedEndss.push(simplifiedEnds);174 offset = ends[ends.length - 1];175 }176 return simplifiedOffset;177};178/**179 * @param {Array.<number>} flatCoordinates Flat coordinates.180 * @param {number} offset Offset.181 * @param {number} end End.182 * @param {number} stride Stride.183 * @param {number} squaredTolerance Squared tolerance.184 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat185 * coordinates.186 * @param {number} simplifiedOffset Simplified offset.187 * @return {number} Simplified offset.188 */189ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,190 stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {191 if (end <= offset + stride) {192 // zero or one point, no simplification possible, so copy and return193 for (; offset < end; offset += stride) {194 simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];195 simplifiedFlatCoordinates[simplifiedOffset++] =196 flatCoordinates[offset + 1];197 }198 return simplifiedOffset;199 }200 var x1 = flatCoordinates[offset];201 var y1 = flatCoordinates[offset + 1];202 // copy first point203 simplifiedFlatCoordinates[simplifiedOffset++] = x1;204 simplifiedFlatCoordinates[simplifiedOffset++] = y1;205 var x2 = x1;206 var y2 = y1;207 for (offset += stride; offset < end; offset += stride) {208 x2 = flatCoordinates[offset];209 y2 = flatCoordinates[offset + 1];210 if (ol.math.squaredDistance(x1, y1, x2, y2) > squaredTolerance) {211 // copy point at offset212 simplifiedFlatCoordinates[simplifiedOffset++] = x2;213 simplifiedFlatCoordinates[simplifiedOffset++] = y2;214 x1 = x2;215 y1 = y2;216 }217 }218 if (x2 != x1 || y2 != y1) {219 // copy last point220 simplifiedFlatCoordinates[simplifiedOffset++] = x2;221 simplifiedFlatCoordinates[simplifiedOffset++] = y2;222 }223 return simplifiedOffset;224};225/**226 * @param {number} value Value.227 * @param {number} tolerance Tolerance.228 * @return {number} Rounded value.229 */230ol.geom.flat.simplify.snap = function(value, tolerance) {231 return tolerance * Math.round(value / tolerance);232};233/**234 * Simplifies a line string using an algorithm designed by Tim Schaub.235 * Coordinates are snapped to the nearest value in a virtual grid and236 * consecutive duplicate coordinates are discarded. This effectively preserves237 * topology as the simplification of any subsection of a line string is238 * independent of the rest of the line string. This means that, for examples,239 * the common edge between two polygons will be simplified to the same line240 * string independently in both polygons. This implementation uses a single241 * pass over the coordinates and eliminates intermediate collinear points.242 * @param {Array.<number>} flatCoordinates Flat coordinates.243 * @param {number} offset Offset.244 * @param {number} end End.245 * @param {number} stride Stride.246 * @param {number} tolerance Tolerance.247 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat248 * coordinates.249 * @param {number} simplifiedOffset Simplified offset.250 * @return {number} Simplified offset.251 */252ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,253 tolerance, simplifiedFlatCoordinates, simplifiedOffset) {254 // do nothing if the line is empty255 if (offset == end) {256 return simplifiedOffset;257 }258 // snap the first coordinate (P1)259 var x1 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);260 var y1 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);261 offset += stride;262 // add the first coordinate to the output263 simplifiedFlatCoordinates[simplifiedOffset++] = x1;264 simplifiedFlatCoordinates[simplifiedOffset++] = y1;265 // find the next coordinate that does not snap to the same value as the first266 // coordinate (P2)267 var x2, y2;268 do {269 x2 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);270 y2 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);271 offset += stride;272 if (offset == end) {273 // all coordinates snap to the same value, the line collapses to a point274 // push the last snapped value anyway to ensure that the output contains275 // at least two points276 // FIXME should we really return at least two points anyway?277 simplifiedFlatCoordinates[simplifiedOffset++] = x2;278 simplifiedFlatCoordinates[simplifiedOffset++] = y2;279 return simplifiedOffset;280 }281 } while (x2 == x1 && y2 == y1);282 while (offset < end) {283 var x3, y3;284 // snap the next coordinate (P3)285 x3 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);286 y3 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);287 offset += stride;288 // skip P3 if it is equal to P2289 if (x3 == x2 && y3 == y2) {290 continue;291 }292 // calculate the delta between P1 and P2293 var dx1 = x2 - x1;294 var dy1 = y2 - y1;295 // calculate the delta between P3 and P1296 var dx2 = x3 - x1;297 var dy2 = y3 - y1;298 // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from299 // P1 in the same direction then P2 is on the straight line between P1 and300 // P3301 if ((dx1 * dy2 == dy1 * dx2) &&302 ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&303 ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) {304 // discard P2 and set P2 = P3305 x2 = x3;306 y2 = y3;307 continue;308 }309 // either P1, P2, and P3 are not colinear, or they are colinear but P3 is310 // between P3 and P1 or on the opposite half of the line to P2. add P2,311 // and continue with P1 = P2 and P2 = P3312 simplifiedFlatCoordinates[simplifiedOffset++] = x2;313 simplifiedFlatCoordinates[simplifiedOffset++] = y2;314 x1 = x2;315 y1 = y2;316 x2 = x3;317 y2 = y3;318 }319 // add the last point (P2)320 simplifiedFlatCoordinates[simplifiedOffset++] = x2;321 simplifiedFlatCoordinates[simplifiedOffset++] = y2;322 return simplifiedOffset;323};324/**325 * @param {Array.<number>} flatCoordinates Flat coordinates.326 * @param {number} offset Offset.327 * @param {Array.<number>} ends Ends.328 * @param {number} stride Stride.329 * @param {number} tolerance Tolerance.330 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat331 * coordinates.332 * @param {number} simplifiedOffset Simplified offset.333 * @param {Array.<number>} simplifiedEnds Simplified ends.334 * @return {number} Simplified offset.335 */336ol.geom.flat.simplify.quantizes = function(337 flatCoordinates, offset, ends, stride,338 tolerance,339 simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {340 var i, ii;341 for (i = 0, ii = ends.length; i < ii; ++i) {342 var end = ends[i];343 simplifiedOffset = ol.geom.flat.simplify.quantize(344 flatCoordinates, offset, end, stride,345 tolerance,346 simplifiedFlatCoordinates, simplifiedOffset);347 simplifiedEnds.push(simplifiedOffset);348 offset = end;349 }350 return simplifiedOffset;351};352/**353 * @param {Array.<number>} flatCoordinates Flat coordinates.354 * @param {number} offset Offset.355 * @param {Array.<Array.<number>>} endss Endss.356 * @param {number} stride Stride.357 * @param {number} tolerance Tolerance.358 * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat359 * coordinates.360 * @param {number} simplifiedOffset Simplified offset.361 * @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.362 * @return {number} Simplified offset.363 */364ol.geom.flat.simplify.quantizess = function(365 flatCoordinates, offset, endss, stride,366 tolerance,367 simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {368 var i, ii;369 for (i = 0, ii = endss.length; i < ii; ++i) {370 var ends = endss[i];371 var simplifiedEnds = [];372 simplifiedOffset = ol.geom.flat.simplify.quantizes(373 flatCoordinates, offset, ends, stride,374 tolerance,375 simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);376 simplifiedEndss.push(simplifiedEnds);377 offset = ends[ends.length - 1];378 }379 return simplifiedOffset;...

Full Screen

Full Screen

test.js

Source:test.js Github

copy

Full Screen

1const test = require('ava')2const { CSG } = require('@jscad/csg')3const serializer = require('./index.js')4test('serialize csg to amf', function (t) {5 const emptyShape = new CSG()6 const observed1 = serializer.serialize({}, emptyShape)7 t.deepEqual(observed1, expected1)8 const testCube = new CSG.cube()9 const observed2 = serializer.serialize(testCube)10 t.deepEqual(observed2, expected2)11 const coloredCube = testCube.setColor([1.0, 0.0, 0.5, 0.8])12 const observed3 = serializer.serialize({unit: 'inch'}, coloredCube)13 t.deepEqual(observed3, expected3)14})15const expected1 = [16 `<?xml version="1.0" encoding="UTF-8"?>17<amf unit=\"millimeter\" version=\"1.1\">18 <metadata type=\"author\">Created using JSCAD</metadata>19</amf>20`21]22const expected2 = [23 `<?xml version="1.0" encoding="UTF-8"?>24<amf unit=\"millimeter\" version=\"1.1\">25 <metadata type=\"author\">Created using JSCAD</metadata>26 <object id="0">27 <mesh>28 <vertices>29 <vertex>30 <coordinates>31 <x>-1</x>32 <y>-1</y>33 <z>-1</z>34 </coordinates>35 </vertex>36 <vertex>37 <coordinates>38 <x>-1</x>39 <y>-1</y>40 <z>1</z>41 </coordinates>42 </vertex>43 <vertex>44 <coordinates>45 <x>-1</x>46 <y>1</y>47 <z>1</z>48 </coordinates>49 </vertex>50 <vertex>51 <coordinates>52 <x>-1</x>53 <y>1</y>54 <z>-1</z>55 </coordinates>56 </vertex>57 <vertex>58 <coordinates>59 <x>1</x>60 <y>-1</y>61 <z>-1</z>62 </coordinates>63 </vertex>64 <vertex>65 <coordinates>66 <x>1</x>67 <y>1</y>68 <z>-1</z>69 </coordinates>70 </vertex>71 <vertex>72 <coordinates>73 <x>1</x>74 <y>1</y>75 <z>1</z>76 </coordinates>77 </vertex>78 <vertex>79 <coordinates>80 <x>1</x>81 <y>-1</y>82 <z>1</z>83 </coordinates>84 </vertex>85 <vertex>86 <coordinates>87 <x>-1</x>88 <y>-1</y>89 <z>-1</z>90 </coordinates>91 </vertex>92 <vertex>93 <coordinates>94 <x>1</x>95 <y>-1</y>96 <z>-1</z>97 </coordinates>98 </vertex>99 <vertex>100 <coordinates>101 <x>1</x>102 <y>-1</y>103 <z>1</z>104 </coordinates>105 </vertex>106 <vertex>107 <coordinates>108 <x>-1</x>109 <y>-1</y>110 <z>1</z>111 </coordinates>112 </vertex>113 <vertex>114 <coordinates>115 <x>-1</x>116 <y>1</y>117 <z>-1</z>118 </coordinates>119 </vertex>120 <vertex>121 <coordinates>122 <x>-1</x>123 <y>1</y>124 <z>1</z>125 </coordinates>126 </vertex>127 <vertex>128 <coordinates>129 <x>1</x>130 <y>1</y>131 <z>1</z>132 </coordinates>133 </vertex>134 <vertex>135 <coordinates>136 <x>1</x>137 <y>1</y>138 <z>-1</z>139 </coordinates>140 </vertex>141 <vertex>142 <coordinates>143 <x>-1</x>144 <y>-1</y>145 <z>-1</z>146 </coordinates>147 </vertex>148 <vertex>149 <coordinates>150 <x>-1</x>151 <y>1</y>152 <z>-1</z>153 </coordinates>154 </vertex>155 <vertex>156 <coordinates>157 <x>1</x>158 <y>1</y>159 <z>-1</z>160 </coordinates>161 </vertex>162 <vertex>163 <coordinates>164 <x>1</x>165 <y>-1</y>166 <z>-1</z>167 </coordinates>168 </vertex>169 <vertex>170 <coordinates>171 <x>-1</x>172 <y>-1</y>173 <z>1</z>174 </coordinates>175 </vertex>176 <vertex>177 <coordinates>178 <x>1</x>179 <y>-1</y>180 <z>1</z>181 </coordinates>182 </vertex>183 <vertex>184 <coordinates>185 <x>1</x>186 <y>1</y>187 <z>1</z>188 </coordinates>189 </vertex>190 <vertex>191 <coordinates>192 <x>-1</x>193 <y>1</y>194 <z>1</z>195 </coordinates>196 </vertex>197 </vertices>198 <volume>199 <triangle>200 <v1>0</v1>201 <v2>1</v2>202 <v3>2</v3>203 </triangle>204 <triangle>205 <v1>0</v1>206 <v2>2</v2>207 <v3>3</v3>208 </triangle>209 </volume>210 <volume>211 <triangle>212 <v1>4</v1>213 <v2>5</v2>214 <v3>6</v3>215 </triangle>216 <triangle>217 <v1>4</v1>218 <v2>6</v2>219 <v3>7</v3>220 </triangle>221 </volume>222 <volume>223 <triangle>224 <v1>8</v1>225 <v2>9</v2>226 <v3>10</v3>227 </triangle>228 <triangle>229 <v1>8</v1>230 <v2>10</v2>231 <v3>11</v3>232 </triangle>233 </volume>234 <volume>235 <triangle>236 <v1>12</v1>237 <v2>13</v2>238 <v3>14</v3>239 </triangle>240 <triangle>241 <v1>12</v1>242 <v2>14</v2>243 <v3>15</v3>244 </triangle>245 </volume>246 <volume>247 <triangle>248 <v1>16</v1>249 <v2>17</v2>250 <v3>18</v3>251 </triangle>252 <triangle>253 <v1>16</v1>254 <v2>18</v2>255 <v3>19</v3>256 </triangle>257 </volume>258 <volume>259 <triangle>260 <v1>20</v1>261 <v2>21</v2>262 <v3>22</v3>263 </triangle>264 <triangle>265 <v1>20</v1>266 <v2>22</v2>267 <v3>23</v3>268 </triangle>269 </volume>270 </mesh>271 </object>272</amf>273`274]275const expected3 = [276 `<?xml version="1.0" encoding="UTF-8"?>277<amf unit=\"inch\" version=\"1.1\">278 <metadata type=\"author\">Created using JSCAD</metadata>279 <object id="0">280 <mesh>281 <vertices>282 <vertex>283 <coordinates>284 <x>-1</x>285 <y>-1</y>286 <z>-1</z>287 </coordinates>288 </vertex>289 <vertex>290 <coordinates>291 <x>-1</x>292 <y>-1</y>293 <z>1</z>294 </coordinates>295 </vertex>296 <vertex>297 <coordinates>298 <x>-1</x>299 <y>1</y>300 <z>1</z>301 </coordinates>302 </vertex>303 <vertex>304 <coordinates>305 <x>-1</x>306 <y>1</y>307 <z>-1</z>308 </coordinates>309 </vertex>310 <vertex>311 <coordinates>312 <x>1</x>313 <y>-1</y>314 <z>-1</z>315 </coordinates>316 </vertex>317 <vertex>318 <coordinates>319 <x>1</x>320 <y>1</y>321 <z>-1</z>322 </coordinates>323 </vertex>324 <vertex>325 <coordinates>326 <x>1</x>327 <y>1</y>328 <z>1</z>329 </coordinates>330 </vertex>331 <vertex>332 <coordinates>333 <x>1</x>334 <y>-1</y>335 <z>1</z>336 </coordinates>337 </vertex>338 <vertex>339 <coordinates>340 <x>-1</x>341 <y>-1</y>342 <z>-1</z>343 </coordinates>344 </vertex>345 <vertex>346 <coordinates>347 <x>1</x>348 <y>-1</y>349 <z>-1</z>350 </coordinates>351 </vertex>352 <vertex>353 <coordinates>354 <x>1</x>355 <y>-1</y>356 <z>1</z>357 </coordinates>358 </vertex>359 <vertex>360 <coordinates>361 <x>-1</x>362 <y>-1</y>363 <z>1</z>364 </coordinates>365 </vertex>366 <vertex>367 <coordinates>368 <x>-1</x>369 <y>1</y>370 <z>-1</z>371 </coordinates>372 </vertex>373 <vertex>374 <coordinates>375 <x>-1</x>376 <y>1</y>377 <z>1</z>378 </coordinates>379 </vertex>380 <vertex>381 <coordinates>382 <x>1</x>383 <y>1</y>384 <z>1</z>385 </coordinates>386 </vertex>387 <vertex>388 <coordinates>389 <x>1</x>390 <y>1</y>391 <z>-1</z>392 </coordinates>393 </vertex>394 <vertex>395 <coordinates>396 <x>-1</x>397 <y>-1</y>398 <z>-1</z>399 </coordinates>400 </vertex>401 <vertex>402 <coordinates>403 <x>-1</x>404 <y>1</y>405 <z>-1</z>406 </coordinates>407 </vertex>408 <vertex>409 <coordinates>410 <x>1</x>411 <y>1</y>412 <z>-1</z>413 </coordinates>414 </vertex>415 <vertex>416 <coordinates>417 <x>1</x>418 <y>-1</y>419 <z>-1</z>420 </coordinates>421 </vertex>422 <vertex>423 <coordinates>424 <x>-1</x>425 <y>-1</y>426 <z>1</z>427 </coordinates>428 </vertex>429 <vertex>430 <coordinates>431 <x>1</x>432 <y>-1</y>433 <z>1</z>434 </coordinates>435 </vertex>436 <vertex>437 <coordinates>438 <x>1</x>439 <y>1</y>440 <z>1</z>441 </coordinates>442 </vertex>443 <vertex>444 <coordinates>445 <x>-1</x>446 <y>1</y>447 <z>1</z>448 </coordinates>449 </vertex>450 </vertices>451 <volume>452 <color>453 <r>1</r>454 <g>0</g>455 <b>0.5</b>456 <a>0.8</a>457 </color>458 <triangle>459 <v1>0</v1>460 <v2>1</v2>461 <v3>2</v3>462 </triangle>463 <triangle>464 <v1>0</v1>465 <v2>2</v2>466 <v3>3</v3>467 </triangle>468 </volume>469 <volume>470 <color>471 <r>1</r>472 <g>0</g>473 <b>0.5</b>474 <a>0.8</a>475 </color>476 <triangle>477 <v1>4</v1>478 <v2>5</v2>479 <v3>6</v3>480 </triangle>481 <triangle>482 <v1>4</v1>483 <v2>6</v2>484 <v3>7</v3>485 </triangle>486 </volume>487 <volume>488 <color>489 <r>1</r>490 <g>0</g>491 <b>0.5</b>492 <a>0.8</a>493 </color>494 <triangle>495 <v1>8</v1>496 <v2>9</v2>497 <v3>10</v3>498 </triangle>499 <triangle>500 <v1>8</v1>501 <v2>10</v2>502 <v3>11</v3>503 </triangle>504 </volume>505 <volume>506 <color>507 <r>1</r>508 <g>0</g>509 <b>0.5</b>510 <a>0.8</a>511 </color>512 <triangle>513 <v1>12</v1>514 <v2>13</v2>515 <v3>14</v3>516 </triangle>517 <triangle>518 <v1>12</v1>519 <v2>14</v2>520 <v3>15</v3>521 </triangle>522 </volume>523 <volume>524 <color>525 <r>1</r>526 <g>0</g>527 <b>0.5</b>528 <a>0.8</a>529 </color>530 <triangle>531 <v1>16</v1>532 <v2>17</v2>533 <v3>18</v3>534 </triangle>535 <triangle>536 <v1>16</v1>537 <v2>18</v2>538 <v3>19</v3>539 </triangle>540 </volume>541 <volume>542 <color>543 <r>1</r>544 <g>0</g>545 <b>0.5</b>546 <a>0.8</a>547 </color>548 <triangle>549 <v1>20</v1>550 <v2>21</v2>551 <v3>22</v3>552 </triangle>553 <triangle>554 <v1>20</v1>555 <v2>22</v2>556 <v3>23</v3>557 </triangle>558 </volume>559 </mesh>560 </object>561</amf>562`...

Full Screen

Full Screen

multipoint.js

Source:multipoint.js Github

copy

Full Screen

...76 * @return {Array.<ol.Coordinate>} Coordinates.77 * @api stable78 */79ol.geom.MultiPoint.prototype.getCoordinates = function() {80 return ol.geom.flat.inflate.coordinates(81 this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);82};83/**84 * @param {number} index Index.85 * @return {ol.geom.Point} Point.86 * @api stable87 */88ol.geom.MultiPoint.prototype.getPoint = function(index) {89 var n = goog.isNull(this.flatCoordinates) ?90 0 : this.flatCoordinates.length / this.stride;91 goog.asserts.assert(0 <= index && index < n);92 if (index < 0 || n <= index) {93 return null;94 }95 var point = new ol.geom.Point(null);96 point.setFlatCoordinates(this.layout, this.flatCoordinates.slice(97 index * this.stride, (index + 1) * this.stride));98 return point;99};100/**101 * @return {Array.<ol.geom.Point>} Points.102 * @api stable103 */104ol.geom.MultiPoint.prototype.getPoints = function() {105 var flatCoordinates = this.flatCoordinates;106 var layout = this.layout;107 var stride = this.stride;108 /** @type {Array.<ol.geom.Point>} */109 var points = [];110 var i, ii;111 for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) {112 var point = new ol.geom.Point(null);113 point.setFlatCoordinates(layout, flatCoordinates.slice(i, i + stride));114 points.push(point);115 }116 return points;117};118/**119 * @inheritDoc120 * @api stable121 */122ol.geom.MultiPoint.prototype.getType = function() {123 return ol.geom.GeometryType.MULTI_POINT;124};125/**126 * @param {Array.<ol.Coordinate>} coordinates Coordinates.127 * @param {ol.geom.GeometryLayout=} opt_layout Layout.128 * @api stable129 */130ol.geom.MultiPoint.prototype.setCoordinates =131 function(coordinates, opt_layout) {132 if (goog.isNull(coordinates)) {133 this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);134 } else {135 this.setLayout(opt_layout, coordinates, 1);136 if (goog.isNull(this.flatCoordinates)) {137 this.flatCoordinates = [];138 }139 this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(140 this.flatCoordinates, 0, coordinates, this.stride);141 this.dispatchChangeEvent();142 }143};144/**145 * @param {ol.geom.GeometryLayout} layout Layout.146 * @param {Array.<number>} flatCoordinates Flat coordinates.147 */148ol.geom.MultiPoint.prototype.setFlatCoordinates =149 function(layout, flatCoordinates) {150 this.setFlatCoordinatesInternal(layout, flatCoordinates);151 this.dispatchChangeEvent();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var x = root.coordinates(0,0);2var y = root.coordinates(1,1);3var z = root.coordinates(2,2);4var w = root.coordinates(3,3);5var v = root.coordinates(4,4);6var u = root.coordinates(5,5);7var t = root.coordinates(6,6);8var s = root.coordinates(7,7);9var r = root.coordinates(8,8);10var q = root.coordinates(9,9);11var p = root.coordinates(10,10);12var o = root.coordinates(11,11);13var n = root.coordinates(12,12);14var m = root.coordinates(13,13);15var l = root.coordinates(14,14);16var k = root.coordinates(15,15);17var j = root.coordinates(16,16);18var i = root.coordinates(17,17);19var h = root.coordinates(18,18);20var g = root.coordinates(19,19);21var f = root.coordinates(20,20);22var e = root.coordinates(21,21);23var d = root.coordinates(22,22);24var c = root.coordinates(23,23);25var b = root.coordinates(24,24);26var a = root.coordinates(25,25);27var x = root.coordinates(0,0);28var y = root.coordinates(1,1);29var z = root.coordinates(2,2);30var w = root.coordinates(3,3);31var v = root.coordinates(4,4);32var u = root.coordinates(5,5);33var t = root.coordinates(6,6);34var s = root.coordinates(7,7);35var r = root.coordinates(8,8);36var q = root.coordinates(9,9);37var p = root.coordinates(10,10);38var o = root.coordinates(11,11);39var n = root.coordinates(12,12);40var m = root.coordinates(13,13);41var l = root.coordinates(14,14);42var k = root.coordinates(15,15);43var j = root.coordinates(16,16);44var i = root.coordinates(17,17);45var h = root.coordinates(18,18);46var g = root.coordinates(19,19);47var f = root.coordinates(20,20);48var e = root.coordinates(21,21);

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = this;2root.coordinates = function() {3 return [root.x, root.y];4}5var root = this;6root.coordinates = function() {7 return [root.x, root.y];8}9var root = this;10root.coordinates = function() {11 return [root.x, root.y];12}13var root = this;14root.coordinates = function() {15 return [root.x, root.y];16}17var root = this;18root.coordinates = function() {19 return [root.x, root.y];20}21var root = this;22root.coordinates = function() {23 return [root.x, root.y];24}25var root = this;26root.coordinates = function() {27 return [root.x, root.y];28}29var root = this;30root.coordinates = function() {31 return [root.x, root.y];32}33var root = this;34root.coordinates = function() {35 return [root.x, root.y];36}37var root = this;38root.coordinates = function() {39 return [root.x, root.y];40}41var root = this;42root.coordinates = function() {43 return [root.x, root.y];44}45var root = this;46root.coordinates = function() {47 return [root.x, root.y];48}49var root = this;50root.coordinates = function() {51 return [root.x, root.y];52}

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('./root');2console.log(root.coordinates(1, 2));3module.exports = {4 coordinates: function(x, y) {5 return [x, y];6 }7};8## 4.4.4. Asynchronous Module Definition (AMD)9require(['root'], function(root) {10 console.log(root.coordinates(1, 2));11});12define(function() {13 return {14 coordinates: function(x, y) {15 return [x, y];16 }17 };18});19ES6 modules are the new standard for defining modules in JavaScript. They are designed for use in browsers and in Node.js. ES6 modules are very similar to CommonJS modules, but they are designed to be used by browsers as well as Node.js. ES6 modules use the `import` and `export` keywords to load and define modules. The following code shows how to use ES6 modules:20import { coordinates } from './root';21console.log(coordinates(1, 2));22export function coordinates(x, y) {23 return [x, y];24}

Full Screen

Using AI Code Generation

copy

Full Screen

1var node = root.coordinates(0, 0, 0);2var node2 = root.coordinates(0, 0, 0);3var node3 = root.coordinates(0, 0, 0);4var node4 = root.coordinates(0, 0, 0);5var node5 = root.coordinates(0, 0, 0);6var node6 = root.coordinates(0, 0, 0);7var node7 = root.coordinates(0, 0, 0);8var node8 = root.coordinates(0, 0, 0);9var node9 = root.coordinates(0, 0, 0);10var node10 = root.coordinates(0, 0, 0);11var node11 = root.coordinates(0, 0, 0);12var node12 = root.coordinates(0, 0, 0);13var node13 = root.coordinates(0, 0, 0);14var node14 = root.coordinates(0, 0, 0);15var node15 = root.coordinates(0, 0, 0);16var node16 = root.coordinates(0, 0, 0);17var node17 = root.coordinates(0, 0, 0);

Full Screen

Using AI Code Generation

copy

Full Screen

1var coordinates = root.coordinates();2var coordinates2 = coordinates.map(function(coordinate) {3 var x = coordinate.x;4 var y = coordinate.y;5 return {6 };7});8root.coordinates(coordinates2);9var coordinates3 = root.coordinates();10console.log(coordinates3);

Full Screen

Using AI Code Generation

copy

Full Screen

1var rootCoordinates = root.coordinates();2var x = rootCoordinates.x;3var y = rootCoordinates.y;4var z = rootCoordinates.z;5var rotation = rootCoordinates.rotation;6var scale = rootCoordinates.scale;7root.setCoordinates(x, y, z, rotation, scale);8root.scale(1.0);9root.rotation(0.0);10root.position(0.0, 0.0, 0.0);11root.translate(0.0, 0.0, 0.0);12root.setParent(parent);13var parent = root.parent();14root.addChild(child);15root.removeChild(child);

Full Screen

Using AI Code Generation

copy

Full Screen

1var coordinates = root.coordinates;2var x = coordinates.x;3var y = coordinates.y;4var z = coordinates.z;5 {6 callback: function() {7 console.log('custom event 1 triggered');8 }9 },10 {11 callback: function() {12 console.log('custom event 2 triggered');13 }14 }15];16root.trigger('customEvent1');17root.trigger('customEvent2');18 {19 },20 {21 }22];23var value1 = root.get('customProperty1

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful