PolylinePipeline-e67c0760.js 21 KB

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