Skip to content

Commit

Permalink
rename Rectangle to GeoRectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
sraimund committed Jan 6, 2025
1 parent 5c2bd42 commit ae5cef2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {OrientedBoundingBox} from "../bounding-volumes/oriented-bounding-box";
import {degrees, Vector2, Vector3, _MathUtils} from "@math.gl/core";
// @ts-ignore
// eslint-disable-next-line import/no-unresolved
import {Ellipsoid, Rectangle} from '@math.gl/geospatial';
import {Ellipsoid, GeoRectangle} from '@math.gl/geospatial';
import {EllipsoidTangentPlane} from "../ellipsoid-tangent-plane";
import {Plane} from "../plane";

Expand Down Expand Up @@ -61,14 +61,14 @@ export function makeOrientedBoundingBoxFromRegion (region: number[]) {

let maxX: number; let maxY: number; let maxZ: number; let minX: number; let minY: number; let minZ: number; let plane: Plane;

const rectangle = new Rectangle(west, south, east, north);
const tangentPoint = Rectangle.center(rectangle, scratchTangentPoint);
const geoRectangle = new GeoRectangle(west, south, east, north);
const tangentPoint = GeoRectangle.center(geoRectangle, scratchTangentPoint);
const tangentPointCartographic = new Vector3([degrees(tangentPoint.x), degrees(tangentPoint.y), 0.0]);

const lonCenter = tangentPoint.x;
const lonCenterDeg = tangentPointCartographic.x;

if (rectangle.width <= _MathUtils.PI) {
if (geoRectangle.width <= _MathUtils.PI) {
const westDeg = degrees(west);

const tangentPoint = Ellipsoid.WGS84.cartographicToCartesian(tangentPointCartographic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {Vector3, negativePiToPi, _MathUtils} from '@math.gl/core'

/** A two dimensional region specified as longitude and latitude coordinates. */
export class Rectangle {
export class GeoRectangle {
west: number;
south: number;
east: number;
Expand Down Expand Up @@ -36,7 +36,7 @@ export class Rectangle {
* @param [result] The object onto which to store the result.
* @returns The modified result parameter or a new Cartographic instance if none was provided.
*/
static center(rectangle: Rectangle, result?: Vector3) {
static center(rectangle: GeoRectangle, result?: Vector3) {
if (!result)
result = new Vector3()

Expand Down
2 changes: 1 addition & 1 deletion modules/geospatial/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// Copyright (c) vis.gl contributors

export {Ellipsoid} from './ellipsoid/ellipsoid';
export {Rectangle} from './rectangle';
export {GeoRectangle} from './geo-rectangle';
export {isWGS84} from './type-utils';

0 comments on commit ae5cef2

Please # to comment.