EllipsoidTangentPlane-85280670.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['exports', './when-e6985d2a', './Check-24cae389', './Cartesian2-a5d6dde9', './Transforms-81680c41', './IntersectionTests-f17c84f0', './Plane-ac6a1d3e'], function (exports, when, Check, Cartesian2, Transforms, IntersectionTests, Plane) { 'use strict';
  3. /**
  4. * Creates an instance of an AxisAlignedBoundingBox from the minimum and maximum points along the x, y, and z axes.
  5. * @alias AxisAlignedBoundingBox
  6. * @constructor
  7. *
  8. * @param {Cartesian3} [minimum=Cartesian3.ZERO] The minimum point along the x, y, and z axes.
  9. * @param {Cartesian3} [maximum=Cartesian3.ZERO] The maximum point along the x, y, and z axes.
  10. * @param {Cartesian3} [center] The center of the box; automatically computed if not supplied.
  11. *
  12. * @see BoundingSphere
  13. * @see BoundingRectangle
  14. */
  15. function AxisAlignedBoundingBox(minimum, maximum, center) {
  16. /**
  17. * The minimum point defining the bounding box.
  18. * @type {Cartesian3}
  19. * @default {@link Cartesian3.ZERO}
  20. */
  21. this.minimum = Cartesian2.Cartesian3.clone(when.defaultValue(minimum, Cartesian2.Cartesian3.ZERO));
  22. /**
  23. * The maximum point defining the bounding box.
  24. * @type {Cartesian3}
  25. * @default {@link Cartesian3.ZERO}
  26. */
  27. this.maximum = Cartesian2.Cartesian3.clone(when.defaultValue(maximum, Cartesian2.Cartesian3.ZERO));
  28. //If center was not defined, compute it.
  29. if (!when.defined(center)) {
  30. center = Cartesian2.Cartesian3.midpoint(this.minimum, this.maximum, new Cartesian2.Cartesian3());
  31. } else {
  32. center = Cartesian2.Cartesian3.clone(center);
  33. }
  34. /**
  35. * The center point of the bounding box.
  36. * @type {Cartesian3}
  37. */
  38. this.center = center;
  39. }
  40. /**
  41. * Computes an instance of an AxisAlignedBoundingBox. The box is determined by
  42. * finding the points spaced the farthest apart on the x, y, and z axes.
  43. *
  44. * @param {Cartesian3[]} positions List of points that the bounding box will enclose. Each point must have a <code>x</code>, <code>y</code>, and <code>z</code> properties.
  45. * @param {AxisAlignedBoundingBox} [result] The object onto which to store the result.
  46. * @returns {AxisAlignedBoundingBox} The modified result parameter or a new AxisAlignedBoundingBox instance if one was not provided.
  47. *
  48. * @example
  49. * // Compute an axis aligned bounding box enclosing two points.
  50. * var box = Cesium.AxisAlignedBoundingBox.fromPoints([new Cesium.Cartesian3(2, 0, 0), new Cesium.Cartesian3(-2, 0, 0)]);
  51. */
  52. AxisAlignedBoundingBox.fromPoints = function (positions, result) {
  53. if (!when.defined(result)) {
  54. result = new AxisAlignedBoundingBox();
  55. }
  56. if (!when.defined(positions) || positions.length === 0) {
  57. result.minimum = Cartesian2.Cartesian3.clone(Cartesian2.Cartesian3.ZERO, result.minimum);
  58. result.maximum = Cartesian2.Cartesian3.clone(Cartesian2.Cartesian3.ZERO, result.maximum);
  59. result.center = Cartesian2.Cartesian3.clone(Cartesian2.Cartesian3.ZERO, result.center);
  60. return result;
  61. }
  62. var minimumX = positions[0].x;
  63. var minimumY = positions[0].y;
  64. var minimumZ = positions[0].z;
  65. var maximumX = positions[0].x;
  66. var maximumY = positions[0].y;
  67. var maximumZ = positions[0].z;
  68. var length = positions.length;
  69. for (var i = 1; i < length; i++) {
  70. var p = positions[i];
  71. var x = p.x;
  72. var y = p.y;
  73. var z = p.z;
  74. minimumX = Math.min(x, minimumX);
  75. maximumX = Math.max(x, maximumX);
  76. minimumY = Math.min(y, minimumY);
  77. maximumY = Math.max(y, maximumY);
  78. minimumZ = Math.min(z, minimumZ);
  79. maximumZ = Math.max(z, maximumZ);
  80. }
  81. var minimum = result.minimum;
  82. minimum.x = minimumX;
  83. minimum.y = minimumY;
  84. minimum.z = minimumZ;
  85. var maximum = result.maximum;
  86. maximum.x = maximumX;
  87. maximum.y = maximumY;
  88. maximum.z = maximumZ;
  89. result.center = Cartesian2.Cartesian3.midpoint(minimum, maximum, result.center);
  90. return result;
  91. };
  92. /**
  93. * Duplicates a AxisAlignedBoundingBox instance.
  94. *
  95. * @param {AxisAlignedBoundingBox} box The bounding box to duplicate.
  96. * @param {AxisAlignedBoundingBox} [result] The object onto which to store the result.
  97. * @returns {AxisAlignedBoundingBox} The modified result parameter or a new AxisAlignedBoundingBox instance if none was provided. (Returns undefined if box is undefined)
  98. */
  99. AxisAlignedBoundingBox.clone = function (box, result) {
  100. if (!when.defined(box)) {
  101. return undefined;
  102. }
  103. if (!when.defined(result)) {
  104. return new AxisAlignedBoundingBox(box.minimum, box.maximum, box.center);
  105. }
  106. result.minimum = Cartesian2.Cartesian3.clone(box.minimum, result.minimum);
  107. result.maximum = Cartesian2.Cartesian3.clone(box.maximum, result.maximum);
  108. result.center = Cartesian2.Cartesian3.clone(box.center, result.center);
  109. return result;
  110. };
  111. /**
  112. * Compares the provided AxisAlignedBoundingBox componentwise and returns
  113. * <code>true</code> if they are equal, <code>false</code> otherwise.
  114. *
  115. * @param {AxisAlignedBoundingBox} [left] The first AxisAlignedBoundingBox.
  116. * @param {AxisAlignedBoundingBox} [right] The second AxisAlignedBoundingBox.
  117. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
  118. */
  119. AxisAlignedBoundingBox.equals = function (left, right) {
  120. return (
  121. left === right ||
  122. (when.defined(left) &&
  123. when.defined(right) &&
  124. Cartesian2.Cartesian3.equals(left.center, right.center) &&
  125. Cartesian2.Cartesian3.equals(left.minimum, right.minimum) &&
  126. Cartesian2.Cartesian3.equals(left.maximum, right.maximum))
  127. );
  128. };
  129. var intersectScratch = new Cartesian2.Cartesian3();
  130. /**
  131. * Determines which side of a plane a box is located.
  132. *
  133. * @param {AxisAlignedBoundingBox} box The bounding box to test.
  134. * @param {Plane} plane The plane to test against.
  135. * @returns {Intersect} {@link Intersect.INSIDE} if the entire box is on the side of the plane
  136. * the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is
  137. * on the opposite side, and {@link Intersect.INTERSECTING} if the box
  138. * intersects the plane.
  139. */
  140. AxisAlignedBoundingBox.intersectPlane = function (box, plane) {
  141. //>>includeStart('debug', pragmas.debug);
  142. Check.Check.defined("box", box);
  143. Check.Check.defined("plane", plane);
  144. //>>includeEnd('debug');
  145. intersectScratch = Cartesian2.Cartesian3.subtract(
  146. box.maximum,
  147. box.minimum,
  148. intersectScratch
  149. );
  150. var h = Cartesian2.Cartesian3.multiplyByScalar(intersectScratch, 0.5, intersectScratch); //The positive half diagonal
  151. var normal = plane.normal;
  152. var e =
  153. h.x * Math.abs(normal.x) +
  154. h.y * Math.abs(normal.y) +
  155. h.z * Math.abs(normal.z);
  156. var s = Cartesian2.Cartesian3.dot(box.center, normal) + plane.distance; //signed distance from center
  157. if (s - e > 0) {
  158. return Transforms.Intersect.INSIDE;
  159. }
  160. if (s + e < 0) {
  161. //Not in front because normals point inward
  162. return Transforms.Intersect.OUTSIDE;
  163. }
  164. return Transforms.Intersect.INTERSECTING;
  165. };
  166. /**
  167. * Duplicates this AxisAlignedBoundingBox instance.
  168. *
  169. * @param {AxisAlignedBoundingBox} [result] The object onto which to store the result.
  170. * @returns {AxisAlignedBoundingBox} The modified result parameter or a new AxisAlignedBoundingBox instance if one was not provided.
  171. */
  172. AxisAlignedBoundingBox.prototype.clone = function (result) {
  173. return AxisAlignedBoundingBox.clone(this, result);
  174. };
  175. /**
  176. * Determines which side of a plane this box is located.
  177. *
  178. * @param {Plane} plane The plane to test against.
  179. * @returns {Intersect} {@link Intersect.INSIDE} if the entire box is on the side of the plane
  180. * the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is
  181. * on the opposite side, and {@link Intersect.INTERSECTING} if the box
  182. * intersects the plane.
  183. */
  184. AxisAlignedBoundingBox.prototype.intersectPlane = function (plane) {
  185. return AxisAlignedBoundingBox.intersectPlane(this, plane);
  186. };
  187. /**
  188. * Compares this AxisAlignedBoundingBox against the provided AxisAlignedBoundingBox componentwise and returns
  189. * <code>true</code> if they are equal, <code>false</code> otherwise.
  190. *
  191. * @param {AxisAlignedBoundingBox} [right] The right hand side AxisAlignedBoundingBox.
  192. * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
  193. */
  194. AxisAlignedBoundingBox.prototype.equals = function (right) {
  195. return AxisAlignedBoundingBox.equals(this, right);
  196. };
  197. var scratchCart4 = new Transforms.Cartesian4();
  198. /**
  199. * A plane tangent to the provided ellipsoid at the provided origin.
  200. * If origin is not on the surface of the ellipsoid, it's surface projection will be used.
  201. * If origin is at the center of the ellipsoid, an exception will be thrown.
  202. * @alias EllipsoidTangentPlane
  203. * @constructor
  204. *
  205. * @param {Cartesian3} origin The point on the surface of the ellipsoid where the tangent plane touches.
  206. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to use.
  207. *
  208. * @exception {DeveloperError} origin must not be at the center of the ellipsoid.
  209. */
  210. function EllipsoidTangentPlane(origin, ellipsoid) {
  211. //>>includeStart('debug', pragmas.debug);
  212. Check.Check.defined("origin", origin);
  213. //>>includeEnd('debug');
  214. ellipsoid = when.defaultValue(ellipsoid, Cartesian2.Ellipsoid.WGS84);
  215. origin = ellipsoid.scaleToGeodeticSurface(origin);
  216. //>>includeStart('debug', pragmas.debug);
  217. if (!when.defined(origin)) {
  218. throw new Check.DeveloperError(
  219. "origin must not be at the center of the ellipsoid."
  220. );
  221. }
  222. //>>includeEnd('debug');
  223. var eastNorthUp = Transforms.Transforms.eastNorthUpToFixedFrame(origin, ellipsoid);
  224. this._ellipsoid = ellipsoid;
  225. this._origin = origin;
  226. this._xAxis = Cartesian2.Cartesian3.fromCartesian4(
  227. Transforms.Matrix4.getColumn(eastNorthUp, 0, scratchCart4)
  228. );
  229. this._yAxis = Cartesian2.Cartesian3.fromCartesian4(
  230. Transforms.Matrix4.getColumn(eastNorthUp, 1, scratchCart4)
  231. );
  232. var normal = Cartesian2.Cartesian3.fromCartesian4(
  233. Transforms.Matrix4.getColumn(eastNorthUp, 2, scratchCart4)
  234. );
  235. this._plane = Plane.Plane.fromPointNormal(origin, normal);
  236. }
  237. Object.defineProperties(EllipsoidTangentPlane.prototype, {
  238. /**
  239. * Gets the ellipsoid.
  240. * @memberof EllipsoidTangentPlane.prototype
  241. * @type {Ellipsoid}
  242. */
  243. ellipsoid: {
  244. get: function () {
  245. return this._ellipsoid;
  246. },
  247. },
  248. /**
  249. * Gets the origin.
  250. * @memberof EllipsoidTangentPlane.prototype
  251. * @type {Cartesian3}
  252. */
  253. origin: {
  254. get: function () {
  255. return this._origin;
  256. },
  257. },
  258. /**
  259. * Gets the plane which is tangent to the ellipsoid.
  260. * @memberof EllipsoidTangentPlane.prototype
  261. * @readonly
  262. * @type {Plane}
  263. */
  264. plane: {
  265. get: function () {
  266. return this._plane;
  267. },
  268. },
  269. /**
  270. * Gets the local X-axis (east) of the tangent plane.
  271. * @memberof EllipsoidTangentPlane.prototype
  272. * @readonly
  273. * @type {Cartesian3}
  274. */
  275. xAxis: {
  276. get: function () {
  277. return this._xAxis;
  278. },
  279. },
  280. /**
  281. * Gets the local Y-axis (north) of the tangent plane.
  282. * @memberof EllipsoidTangentPlane.prototype
  283. * @readonly
  284. * @type {Cartesian3}
  285. */
  286. yAxis: {
  287. get: function () {
  288. return this._yAxis;
  289. },
  290. },
  291. /**
  292. * Gets the local Z-axis (up) of the tangent plane.
  293. * @memberof EllipsoidTangentPlane.prototype
  294. * @readonly
  295. * @type {Cartesian3}
  296. */
  297. zAxis: {
  298. get: function () {
  299. return this._plane.normal;
  300. },
  301. },
  302. });
  303. var tmp = new AxisAlignedBoundingBox();
  304. /**
  305. * Creates a new instance from the provided ellipsoid and the center
  306. * point of the provided Cartesians.
  307. *
  308. * @param {Cartesian3[]} cartesians The list of positions surrounding the center point.
  309. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to use.
  310. */
  311. EllipsoidTangentPlane.fromPoints = function (cartesians, ellipsoid) {
  312. //>>includeStart('debug', pragmas.debug);
  313. Check.Check.defined("cartesians", cartesians);
  314. //>>includeEnd('debug');
  315. var box = AxisAlignedBoundingBox.fromPoints(cartesians, tmp);
  316. return new EllipsoidTangentPlane(box.center, ellipsoid);
  317. };
  318. var scratchProjectPointOntoPlaneRay = new IntersectionTests.Ray();
  319. var scratchProjectPointOntoPlaneCartesian3 = new Cartesian2.Cartesian3();
  320. /**
  321. * Computes the projection of the provided 3D position onto the 2D plane, radially outward from the {@link EllipsoidTangentPlane.ellipsoid} coordinate system origin.
  322. *
  323. * @param {Cartesian3} cartesian The point to project.
  324. * @param {Cartesian2} [result] The object onto which to store the result.
  325. * @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if none was provided. Undefined if there is no intersection point
  326. */
  327. EllipsoidTangentPlane.prototype.projectPointOntoPlane = function (
  328. cartesian,
  329. result
  330. ) {
  331. //>>includeStart('debug', pragmas.debug);
  332. Check.Check.defined("cartesian", cartesian);
  333. //>>includeEnd('debug');
  334. var ray = scratchProjectPointOntoPlaneRay;
  335. ray.origin = cartesian;
  336. Cartesian2.Cartesian3.normalize(cartesian, ray.direction);
  337. var intersectionPoint = IntersectionTests.IntersectionTests.rayPlane(
  338. ray,
  339. this._plane,
  340. scratchProjectPointOntoPlaneCartesian3
  341. );
  342. if (!when.defined(intersectionPoint)) {
  343. Cartesian2.Cartesian3.negate(ray.direction, ray.direction);
  344. intersectionPoint = IntersectionTests.IntersectionTests.rayPlane(
  345. ray,
  346. this._plane,
  347. scratchProjectPointOntoPlaneCartesian3
  348. );
  349. }
  350. if (when.defined(intersectionPoint)) {
  351. var v = Cartesian2.Cartesian3.subtract(
  352. intersectionPoint,
  353. this._origin,
  354. intersectionPoint
  355. );
  356. var x = Cartesian2.Cartesian3.dot(this._xAxis, v);
  357. var y = Cartesian2.Cartesian3.dot(this._yAxis, v);
  358. if (!when.defined(result)) {
  359. return new Cartesian2.Cartesian2(x, y);
  360. }
  361. result.x = x;
  362. result.y = y;
  363. return result;
  364. }
  365. return undefined;
  366. };
  367. /**
  368. * Computes the projection of the provided 3D positions onto the 2D plane (where possible), radially outward from the global origin.
  369. * The resulting array may be shorter than the input array - if a single projection is impossible it will not be included.
  370. *
  371. * @see EllipsoidTangentPlane.projectPointOntoPlane
  372. *
  373. * @param {Cartesian3[]} cartesians The array of points to project.
  374. * @param {Cartesian2[]} [result] The array of Cartesian2 instances onto which to store results.
  375. * @returns {Cartesian2[]} The modified result parameter or a new array of Cartesian2 instances if none was provided.
  376. */
  377. EllipsoidTangentPlane.prototype.projectPointsOntoPlane = function (
  378. cartesians,
  379. result
  380. ) {
  381. //>>includeStart('debug', pragmas.debug);
  382. Check.Check.defined("cartesians", cartesians);
  383. //>>includeEnd('debug');
  384. if (!when.defined(result)) {
  385. result = [];
  386. }
  387. var count = 0;
  388. var length = cartesians.length;
  389. for (var i = 0; i < length; i++) {
  390. var p = this.projectPointOntoPlane(cartesians[i], result[count]);
  391. if (when.defined(p)) {
  392. result[count] = p;
  393. count++;
  394. }
  395. }
  396. result.length = count;
  397. return result;
  398. };
  399. /**
  400. * Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
  401. *
  402. * @param {Cartesian3} cartesian The point to project.
  403. * @param {Cartesian2} [result] The object onto which to store the result.
  404. * @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if none was provided.
  405. */
  406. EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane = function (
  407. cartesian,
  408. result
  409. ) {
  410. //>>includeStart('debug', pragmas.debug);
  411. Check.Check.defined("cartesian", cartesian);
  412. //>>includeEnd('debug');
  413. if (!when.defined(result)) {
  414. result = new Cartesian2.Cartesian2();
  415. }
  416. var ray = scratchProjectPointOntoPlaneRay;
  417. ray.origin = cartesian;
  418. Cartesian2.Cartesian3.clone(this._plane.normal, ray.direction);
  419. var intersectionPoint = IntersectionTests.IntersectionTests.rayPlane(
  420. ray,
  421. this._plane,
  422. scratchProjectPointOntoPlaneCartesian3
  423. );
  424. if (!when.defined(intersectionPoint)) {
  425. Cartesian2.Cartesian3.negate(ray.direction, ray.direction);
  426. intersectionPoint = IntersectionTests.IntersectionTests.rayPlane(
  427. ray,
  428. this._plane,
  429. scratchProjectPointOntoPlaneCartesian3
  430. );
  431. }
  432. var v = Cartesian2.Cartesian3.subtract(
  433. intersectionPoint,
  434. this._origin,
  435. intersectionPoint
  436. );
  437. var x = Cartesian2.Cartesian3.dot(this._xAxis, v);
  438. var y = Cartesian2.Cartesian3.dot(this._yAxis, v);
  439. result.x = x;
  440. result.y = y;
  441. return result;
  442. };
  443. /**
  444. * Computes the projection of the provided 3D positions onto the 2D plane, along the plane normal.
  445. *
  446. * @see EllipsoidTangentPlane.projectPointToNearestOnPlane
  447. *
  448. * @param {Cartesian3[]} cartesians The array of points to project.
  449. * @param {Cartesian2[]} [result] The array of Cartesian2 instances onto which to store results.
  450. * @returns {Cartesian2[]} The modified result parameter or a new array of Cartesian2 instances if none was provided. This will have the same length as <code>cartesians</code>.
  451. */
  452. EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane = function (
  453. cartesians,
  454. result
  455. ) {
  456. //>>includeStart('debug', pragmas.debug);
  457. Check.Check.defined("cartesians", cartesians);
  458. //>>includeEnd('debug');
  459. if (!when.defined(result)) {
  460. result = [];
  461. }
  462. var length = cartesians.length;
  463. result.length = length;
  464. for (var i = 0; i < length; i++) {
  465. result[i] = this.projectPointToNearestOnPlane(cartesians[i], result[i]);
  466. }
  467. return result;
  468. };
  469. var projectPointsOntoEllipsoidScratch = new Cartesian2.Cartesian3();
  470. /**
  471. * Computes the projection of the provided 2D position onto the 3D ellipsoid.
  472. *
  473. * @param {Cartesian2} cartesian The points to project.
  474. * @param {Cartesian3} [result] The Cartesian3 instance to store result.
  475. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
  476. */
  477. EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid = function (
  478. cartesian,
  479. result
  480. ) {
  481. //>>includeStart('debug', pragmas.debug);
  482. Check.Check.defined("cartesian", cartesian);
  483. //>>includeEnd('debug');
  484. if (!when.defined(result)) {
  485. result = new Cartesian2.Cartesian3();
  486. }
  487. var ellipsoid = this._ellipsoid;
  488. var origin = this._origin;
  489. var xAxis = this._xAxis;
  490. var yAxis = this._yAxis;
  491. var tmp = projectPointsOntoEllipsoidScratch;
  492. Cartesian2.Cartesian3.multiplyByScalar(xAxis, cartesian.x, tmp);
  493. result = Cartesian2.Cartesian3.add(origin, tmp, result);
  494. Cartesian2.Cartesian3.multiplyByScalar(yAxis, cartesian.y, tmp);
  495. Cartesian2.Cartesian3.add(result, tmp, result);
  496. ellipsoid.scaleToGeocentricSurface(result, result);
  497. return result;
  498. };
  499. /**
  500. * Computes the projection of the provided 2D positions onto the 3D ellipsoid.
  501. *
  502. * @param {Cartesian2[]} cartesians The array of points to project.
  503. * @param {Cartesian3[]} [result] The array of Cartesian3 instances onto which to store results.
  504. * @returns {Cartesian3[]} The modified result parameter or a new array of Cartesian3 instances if none was provided.
  505. */
  506. EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid = function (
  507. cartesians,
  508. result
  509. ) {
  510. //>>includeStart('debug', pragmas.debug);
  511. Check.Check.defined("cartesians", cartesians);
  512. //>>includeEnd('debug');
  513. var length = cartesians.length;
  514. if (!when.defined(result)) {
  515. result = new Array(length);
  516. } else {
  517. result.length = length;
  518. }
  519. for (var i = 0; i < length; ++i) {
  520. result[i] = this.projectPointOntoEllipsoid(cartesians[i], result[i]);
  521. }
  522. return result;
  523. };
  524. exports.AxisAlignedBoundingBox = AxisAlignedBoundingBox;
  525. exports.EllipsoidTangentPlane = EllipsoidTangentPlane;
  526. });