PolylinePipeline-3b5d6486.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /**
  2. * Cesium - https://github.com/CesiumGS/cesium
  3. *
  4. * Copyright 2011-2020 Cesium Contributors
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * Columbus View (Pat. Pend.)
  19. *
  20. * Portions licensed separately.
  21. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
  22. */
  23. define(['exports', './Matrix2-d35cf4b5', './defaultValue-81eec7ed', './RuntimeError-8952249c', './EllipsoidGeodesic-924f7301', './EllipsoidRhumbLine-d049f903', './IntersectionTests-a25e058d', './ComponentDatatype-9e86ac8f', './Plane-24f22488'], (function (exports, Matrix2, defaultValue, RuntimeError, EllipsoidGeodesic, EllipsoidRhumbLine, IntersectionTests, ComponentDatatype, Plane) { 'use strict';
  24. /**
  25. * @private
  26. */
  27. const PolylinePipeline = {};
  28. PolylinePipeline.numberOfPoints = function (p0, p1, minDistance) {
  29. const distance = Matrix2.Cartesian3.distance(p0, p1);
  30. return Math.ceil(distance / minDistance);
  31. };
  32. PolylinePipeline.numberOfPointsRhumbLine = function (p0, p1, granularity) {
  33. const radiansDistanceSquared =
  34. Math.pow(p0.longitude - p1.longitude, 2) +
  35. Math.pow(p0.latitude - p1.latitude, 2);
  36. return Math.max(
  37. 1,
  38. Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity)))
  39. );
  40. };
  41. const cartoScratch = new Matrix2.Cartographic();
  42. PolylinePipeline.extractHeights = function (positions, ellipsoid) {
  43. const length = positions.length;
  44. const heights = new Array(length);
  45. for (let i = 0; i < length; i++) {
  46. const p = positions[i];
  47. heights[i] = ellipsoid.cartesianToCartographic(p, cartoScratch).height;
  48. }
  49. return heights;
  50. };
  51. const wrapLongitudeInversMatrix = new Matrix2.Matrix4();
  52. const wrapLongitudeOrigin = new Matrix2.Cartesian3();
  53. const wrapLongitudeXZNormal = new Matrix2.Cartesian3();
  54. const wrapLongitudeXZPlane = new Plane.Plane(Matrix2.Cartesian3.UNIT_X, 0.0);
  55. const wrapLongitudeYZNormal = new Matrix2.Cartesian3();
  56. const wrapLongitudeYZPlane = new Plane.Plane(Matrix2.Cartesian3.UNIT_X, 0.0);
  57. const wrapLongitudeIntersection = new Matrix2.Cartesian3();
  58. const wrapLongitudeOffset = new Matrix2.Cartesian3();
  59. const subdivideHeightsScratchArray = [];
  60. function subdivideHeights(numPoints, h0, h1) {
  61. const heights = subdivideHeightsScratchArray;
  62. heights.length = numPoints;
  63. let i;
  64. if (h0 === h1) {
  65. for (i = 0; i < numPoints; i++) {
  66. heights[i] = h0;
  67. }
  68. return heights;
  69. }
  70. const dHeight = h1 - h0;
  71. const heightPerVertex = dHeight / numPoints;
  72. for (i = 0; i < numPoints; i++) {
  73. const h = h0 + i * heightPerVertex;
  74. heights[i] = h;
  75. }
  76. return heights;
  77. }
  78. const carto1 = new Matrix2.Cartographic();
  79. const carto2 = new Matrix2.Cartographic();
  80. const cartesian = new Matrix2.Cartesian3();
  81. const scaleFirst = new Matrix2.Cartesian3();
  82. const scaleLast = new Matrix2.Cartesian3();
  83. const ellipsoidGeodesic = new EllipsoidGeodesic.EllipsoidGeodesic();
  84. let ellipsoidRhumb = new EllipsoidRhumbLine.EllipsoidRhumbLine();
  85. //Returns subdivided line scaled to ellipsoid surface starting at p1 and ending at p2.
  86. //Result includes p1, but not include p2. This function is called for a sequence of line segments,
  87. //and this prevents duplication of end point.
  88. function generateCartesianArc(
  89. p0,
  90. p1,
  91. minDistance,
  92. ellipsoid,
  93. h0,
  94. h1,
  95. array,
  96. offset
  97. ) {
  98. const first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
  99. const last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
  100. const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);
  101. const start = ellipsoid.cartesianToCartographic(first, carto1);
  102. const end = ellipsoid.cartesianToCartographic(last, carto2);
  103. const heights = subdivideHeights(numPoints, h0, h1);
  104. ellipsoidGeodesic.setEndPoints(start, end);
  105. const surfaceDistanceBetweenPoints =
  106. ellipsoidGeodesic.surfaceDistance / numPoints;
  107. let index = offset;
  108. start.height = h0;
  109. let cart = ellipsoid.cartographicToCartesian(start, cartesian);
  110. Matrix2.Cartesian3.pack(cart, array, index);
  111. index += 3;
  112. for (let i = 1; i < numPoints; i++) {
  113. const carto = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
  114. i * surfaceDistanceBetweenPoints,
  115. carto2
  116. );
  117. carto.height = heights[i];
  118. cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  119. Matrix2.Cartesian3.pack(cart, array, index);
  120. index += 3;
  121. }
  122. return index;
  123. }
  124. //Returns subdivided line scaled to ellipsoid surface starting at p1 and ending at p2.
  125. //Result includes p1, but not include p2. This function is called for a sequence of line segments,
  126. //and this prevents duplication of end point.
  127. function generateCartesianRhumbArc(
  128. p0,
  129. p1,
  130. granularity,
  131. ellipsoid,
  132. h0,
  133. h1,
  134. array,
  135. offset
  136. ) {
  137. const start = ellipsoid.cartesianToCartographic(p0, carto1);
  138. const end = ellipsoid.cartesianToCartographic(p1, carto2);
  139. const numPoints = PolylinePipeline.numberOfPointsRhumbLine(
  140. start,
  141. end,
  142. granularity
  143. );
  144. start.height = 0.0;
  145. end.height = 0.0;
  146. const heights = subdivideHeights(numPoints, h0, h1);
  147. if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
  148. ellipsoidRhumb = new EllipsoidRhumbLine.EllipsoidRhumbLine(undefined, undefined, ellipsoid);
  149. }
  150. ellipsoidRhumb.setEndPoints(start, end);
  151. const surfaceDistanceBetweenPoints =
  152. ellipsoidRhumb.surfaceDistance / numPoints;
  153. let index = offset;
  154. start.height = h0;
  155. let cart = ellipsoid.cartographicToCartesian(start, cartesian);
  156. Matrix2.Cartesian3.pack(cart, array, index);
  157. index += 3;
  158. for (let i = 1; i < numPoints; i++) {
  159. const carto = ellipsoidRhumb.interpolateUsingSurfaceDistance(
  160. i * surfaceDistanceBetweenPoints,
  161. carto2
  162. );
  163. carto.height = heights[i];
  164. cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  165. Matrix2.Cartesian3.pack(cart, array, index);
  166. index += 3;
  167. }
  168. return index;
  169. }
  170. /**
  171. * Breaks a {@link Polyline} into segments such that it does not cross the &plusmn;180 degree meridian of an ellipsoid.
  172. *
  173. * @param {Cartesian3[]} positions The polyline's Cartesian positions.
  174. * @param {Matrix4} [modelMatrix=Matrix4.IDENTITY] The polyline's model matrix. Assumed to be an affine
  175. * transformation matrix, where the upper left 3x3 elements are a rotation matrix, and
  176. * the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1].
  177. * The matrix is not verified to be in the proper form.
  178. * @returns {Object} An object with a <code>positions</code> property that is an array of positions and a
  179. * <code>segments</code> property.
  180. *
  181. *
  182. * @example
  183. * const polylines = new Cesium.PolylineCollection();
  184. * const polyline = polylines.add(...);
  185. * const positions = polyline.positions;
  186. * const modelMatrix = polylines.modelMatrix;
  187. * const segments = Cesium.PolylinePipeline.wrapLongitude(positions, modelMatrix);
  188. *
  189. * @see PolygonPipeline.wrapLongitude
  190. * @see Polyline
  191. * @see PolylineCollection
  192. */
  193. PolylinePipeline.wrapLongitude = function (positions, modelMatrix) {
  194. const cartesians = [];
  195. const segments = [];
  196. if (defaultValue.defined(positions) && positions.length > 0) {
  197. modelMatrix = defaultValue.defaultValue(modelMatrix, Matrix2.Matrix4.IDENTITY);
  198. const inverseModelMatrix = Matrix2.Matrix4.inverseTransformation(
  199. modelMatrix,
  200. wrapLongitudeInversMatrix
  201. );
  202. const origin = Matrix2.Matrix4.multiplyByPoint(
  203. inverseModelMatrix,
  204. Matrix2.Cartesian3.ZERO,
  205. wrapLongitudeOrigin
  206. );
  207. const xzNormal = Matrix2.Cartesian3.normalize(
  208. Matrix2.Matrix4.multiplyByPointAsVector(
  209. inverseModelMatrix,
  210. Matrix2.Cartesian3.UNIT_Y,
  211. wrapLongitudeXZNormal
  212. ),
  213. wrapLongitudeXZNormal
  214. );
  215. const xzPlane = Plane.Plane.fromPointNormal(
  216. origin,
  217. xzNormal,
  218. wrapLongitudeXZPlane
  219. );
  220. const yzNormal = Matrix2.Cartesian3.normalize(
  221. Matrix2.Matrix4.multiplyByPointAsVector(
  222. inverseModelMatrix,
  223. Matrix2.Cartesian3.UNIT_X,
  224. wrapLongitudeYZNormal
  225. ),
  226. wrapLongitudeYZNormal
  227. );
  228. const yzPlane = Plane.Plane.fromPointNormal(
  229. origin,
  230. yzNormal,
  231. wrapLongitudeYZPlane
  232. );
  233. let count = 1;
  234. cartesians.push(Matrix2.Cartesian3.clone(positions[0]));
  235. let prev = cartesians[0];
  236. const length = positions.length;
  237. for (let i = 1; i < length; ++i) {
  238. const cur = positions[i];
  239. // intersects the IDL if either endpoint is on the negative side of the yz-plane
  240. if (
  241. Plane.Plane.getPointDistance(yzPlane, prev) < 0.0 ||
  242. Plane.Plane.getPointDistance(yzPlane, cur) < 0.0
  243. ) {
  244. // and intersects the xz-plane
  245. const intersection = IntersectionTests.IntersectionTests.lineSegmentPlane(
  246. prev,
  247. cur,
  248. xzPlane,
  249. wrapLongitudeIntersection
  250. );
  251. if (defaultValue.defined(intersection)) {
  252. // move point on the xz-plane slightly away from the plane
  253. const offset = Matrix2.Cartesian3.multiplyByScalar(
  254. xzNormal,
  255. 5.0e-9,
  256. wrapLongitudeOffset
  257. );
  258. if (Plane.Plane.getPointDistance(xzPlane, prev) < 0.0) {
  259. Matrix2.Cartesian3.negate(offset, offset);
  260. }
  261. cartesians.push(
  262. Matrix2.Cartesian3.add(intersection, offset, new Matrix2.Cartesian3())
  263. );
  264. segments.push(count + 1);
  265. Matrix2.Cartesian3.negate(offset, offset);
  266. cartesians.push(
  267. Matrix2.Cartesian3.add(intersection, offset, new Matrix2.Cartesian3())
  268. );
  269. count = 1;
  270. }
  271. }
  272. cartesians.push(Matrix2.Cartesian3.clone(positions[i]));
  273. count++;
  274. prev = cur;
  275. }
  276. segments.push(count);
  277. }
  278. return {
  279. positions: cartesians,
  280. lengths: segments,
  281. };
  282. };
  283. /**
  284. * Subdivides polyline and raises all points to the specified height. Returns an array of numbers to represent the positions.
  285. * @param {Object} options Object with the following properties:
  286. * @param {Cartesian3[]} options.positions The array of type {Cartesian3} representing positions.
  287. * @param {Number|Number[]} [options.height=0.0] A number or array of numbers representing the heights of each position.
  288. * @param {Number} [options.granularity = CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
  289. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the positions lie.
  290. * @returns {Number[]} A new array of positions of type {Number} that have been subdivided and raised to the surface of the ellipsoid.
  291. *
  292. * @example
  293. * const positions = Cesium.Cartesian3.fromDegreesArray([
  294. * -105.0, 40.0,
  295. * -100.0, 38.0,
  296. * -105.0, 35.0,
  297. * -100.0, 32.0
  298. * ]);
  299. * const surfacePositions = Cesium.PolylinePipeline.generateArc({
  300. * positons: positions
  301. * });
  302. */
  303. PolylinePipeline.generateArc = function (options) {
  304. if (!defaultValue.defined(options)) {
  305. options = {};
  306. }
  307. const positions = options.positions;
  308. //>>includeStart('debug', pragmas.debug);
  309. if (!defaultValue.defined(positions)) {
  310. throw new RuntimeError.DeveloperError("options.positions is required.");
  311. }
  312. //>>includeEnd('debug');
  313. const length = positions.length;
  314. const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix2.Ellipsoid.WGS84);
  315. let height = defaultValue.defaultValue(options.height, 0);
  316. const hasHeightArray = Array.isArray(height);
  317. if (length < 1) {
  318. return [];
  319. } else if (length === 1) {
  320. const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
  321. height = hasHeightArray ? height[0] : height;
  322. if (height !== 0) {
  323. const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
  324. Matrix2.Cartesian3.multiplyByScalar(n, height, n);
  325. Matrix2.Cartesian3.add(p, n, p);
  326. }
  327. return [p.x, p.y, p.z];
  328. }
  329. let minDistance = options.minDistance;
  330. if (!defaultValue.defined(minDistance)) {
  331. const granularity = defaultValue.defaultValue(
  332. options.granularity,
  333. ComponentDatatype.CesiumMath.RADIANS_PER_DEGREE
  334. );
  335. minDistance = ComponentDatatype.CesiumMath.chordLength(granularity, ellipsoid.maximumRadius);
  336. }
  337. let numPoints = 0;
  338. let i;
  339. for (i = 0; i < length - 1; i++) {
  340. numPoints += PolylinePipeline.numberOfPoints(
  341. positions[i],
  342. positions[i + 1],
  343. minDistance
  344. );
  345. }
  346. const arrayLength = (numPoints + 1) * 3;
  347. const newPositions = new Array(arrayLength);
  348. let offset = 0;
  349. for (i = 0; i < length - 1; i++) {
  350. const p0 = positions[i];
  351. const p1 = positions[i + 1];
  352. const h0 = hasHeightArray ? height[i] : height;
  353. const h1 = hasHeightArray ? height[i + 1] : height;
  354. offset = generateCartesianArc(
  355. p0,
  356. p1,
  357. minDistance,
  358. ellipsoid,
  359. h0,
  360. h1,
  361. newPositions,
  362. offset
  363. );
  364. }
  365. subdivideHeightsScratchArray.length = 0;
  366. const lastPoint = positions[length - 1];
  367. const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
  368. carto.height = hasHeightArray ? height[length - 1] : height;
  369. const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  370. Matrix2.Cartesian3.pack(cart, newPositions, arrayLength - 3);
  371. return newPositions;
  372. };
  373. const scratchCartographic0 = new Matrix2.Cartographic();
  374. const scratchCartographic1 = new Matrix2.Cartographic();
  375. /**
  376. * Subdivides polyline and raises all points to the specified height using Rhumb lines. Returns an array of numbers to represent the positions.
  377. * @param {Object} options Object with the following properties:
  378. * @param {Cartesian3[]} options.positions The array of type {Cartesian3} representing positions.
  379. * @param {Number|Number[]} [options.height=0.0] A number or array of numbers representing the heights of each position.
  380. * @param {Number} [options.granularity = CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
  381. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the positions lie.
  382. * @returns {Number[]} A new array of positions of type {Number} that have been subdivided and raised to the surface of the ellipsoid.
  383. *
  384. * @example
  385. * const positions = Cesium.Cartesian3.fromDegreesArray([
  386. * -105.0, 40.0,
  387. * -100.0, 38.0,
  388. * -105.0, 35.0,
  389. * -100.0, 32.0
  390. * ]);
  391. * const surfacePositions = Cesium.PolylinePipeline.generateRhumbArc({
  392. * positons: positions
  393. * });
  394. */
  395. PolylinePipeline.generateRhumbArc = function (options) {
  396. if (!defaultValue.defined(options)) {
  397. options = {};
  398. }
  399. const positions = options.positions;
  400. //>>includeStart('debug', pragmas.debug);
  401. if (!defaultValue.defined(positions)) {
  402. throw new RuntimeError.DeveloperError("options.positions is required.");
  403. }
  404. //>>includeEnd('debug');
  405. const length = positions.length;
  406. const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix2.Ellipsoid.WGS84);
  407. let height = defaultValue.defaultValue(options.height, 0);
  408. const hasHeightArray = Array.isArray(height);
  409. if (length < 1) {
  410. return [];
  411. } else if (length === 1) {
  412. const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
  413. height = hasHeightArray ? height[0] : height;
  414. if (height !== 0) {
  415. const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
  416. Matrix2.Cartesian3.multiplyByScalar(n, height, n);
  417. Matrix2.Cartesian3.add(p, n, p);
  418. }
  419. return [p.x, p.y, p.z];
  420. }
  421. const granularity = defaultValue.defaultValue(
  422. options.granularity,
  423. ComponentDatatype.CesiumMath.RADIANS_PER_DEGREE
  424. );
  425. let numPoints = 0;
  426. let i;
  427. let c0 = ellipsoid.cartesianToCartographic(
  428. positions[0],
  429. scratchCartographic0
  430. );
  431. let c1;
  432. for (i = 0; i < length - 1; i++) {
  433. c1 = ellipsoid.cartesianToCartographic(
  434. positions[i + 1],
  435. scratchCartographic1
  436. );
  437. numPoints += PolylinePipeline.numberOfPointsRhumbLine(c0, c1, granularity);
  438. c0 = Matrix2.Cartographic.clone(c1, scratchCartographic0);
  439. }
  440. const arrayLength = (numPoints + 1) * 3;
  441. const newPositions = new Array(arrayLength);
  442. let offset = 0;
  443. for (i = 0; i < length - 1; i++) {
  444. const p0 = positions[i];
  445. const p1 = positions[i + 1];
  446. const h0 = hasHeightArray ? height[i] : height;
  447. const h1 = hasHeightArray ? height[i + 1] : height;
  448. offset = generateCartesianRhumbArc(
  449. p0,
  450. p1,
  451. granularity,
  452. ellipsoid,
  453. h0,
  454. h1,
  455. newPositions,
  456. offset
  457. );
  458. }
  459. subdivideHeightsScratchArray.length = 0;
  460. const lastPoint = positions[length - 1];
  461. const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
  462. carto.height = hasHeightArray ? height[length - 1] : height;
  463. const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  464. Matrix2.Cartesian3.pack(cart, newPositions, arrayLength - 3);
  465. return newPositions;
  466. };
  467. /**
  468. * Subdivides polyline and raises all points to the specified height. Returns an array of new {Cartesian3} positions.
  469. * @param {Object} options Object with the following properties:
  470. * @param {Cartesian3[]} options.positions The array of type {Cartesian3} representing positions.
  471. * @param {Number|Number[]} [options.height=0.0] A number or array of numbers representing the heights of each position.
  472. * @param {Number} [options.granularity = CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
  473. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the positions lie.
  474. * @returns {Cartesian3[]} A new array of cartesian3 positions that have been subdivided and raised to the surface of the ellipsoid.
  475. *
  476. * @example
  477. * const positions = Cesium.Cartesian3.fromDegreesArray([
  478. * -105.0, 40.0,
  479. * -100.0, 38.0,
  480. * -105.0, 35.0,
  481. * -100.0, 32.0
  482. * ]);
  483. * const surfacePositions = Cesium.PolylinePipeline.generateCartesianArc({
  484. * positons: positions
  485. * });
  486. */
  487. PolylinePipeline.generateCartesianArc = function (options) {
  488. const numberArray = PolylinePipeline.generateArc(options);
  489. const size = numberArray.length / 3;
  490. const newPositions = new Array(size);
  491. for (let i = 0; i < size; i++) {
  492. newPositions[i] = Matrix2.Cartesian3.unpack(numberArray, i * 3);
  493. }
  494. return newPositions;
  495. };
  496. /**
  497. * Subdivides polyline and raises all points to the specified height using Rhumb Lines. Returns an array of new {Cartesian3} positions.
  498. * @param {Object} options Object with the following properties:
  499. * @param {Cartesian3[]} options.positions The array of type {Cartesian3} representing positions.
  500. * @param {Number|Number[]} [options.height=0.0] A number or array of numbers representing the heights of each position.
  501. * @param {Number} [options.granularity = CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
  502. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the positions lie.
  503. * @returns {Cartesian3[]} A new array of cartesian3 positions that have been subdivided and raised to the surface of the ellipsoid.
  504. *
  505. * @example
  506. * const positions = Cesium.Cartesian3.fromDegreesArray([
  507. * -105.0, 40.0,
  508. * -100.0, 38.0,
  509. * -105.0, 35.0,
  510. * -100.0, 32.0
  511. * ]);
  512. * const surfacePositions = Cesium.PolylinePipeline.generateCartesianRhumbArc({
  513. * positons: positions
  514. * });
  515. */
  516. PolylinePipeline.generateCartesianRhumbArc = function (options) {
  517. const numberArray = PolylinePipeline.generateRhumbArc(options);
  518. const size = numberArray.length / 3;
  519. const newPositions = new Array(size);
  520. for (let i = 0; i < size; i++) {
  521. newPositions[i] = Matrix2.Cartesian3.unpack(numberArray, i * 3);
  522. }
  523. return newPositions;
  524. };
  525. exports.PolylinePipeline = PolylinePipeline;
  526. }));
  527. //# sourceMappingURL=PolylinePipeline-3b5d6486.js.map