Skip to content

Commit badf47f

Browse files
committed
refactor(s2): various small fixes
1 parent 15e5e63 commit badf47f

4 files changed

Lines changed: 3 additions & 6 deletions

File tree

s2/CellUnion.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export class CellUnion extends Array<CellID> implements Region {
4343
* @category Constructors
4444
*/
4545
static fromUnion(...cellUnions: CellUnion[]): CellUnion {
46-
const cu = new CellUnion()
47-
for (const cellUnion of cellUnions) cu.push(...cellUnion)
46+
const cu = new CellUnion(...cellUnions.flat(1))
4847
cu.normalize()
4948
return cu
5049
}

s2/LatLng.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class LatLng {
2727
* Returns a LatLng for the coordinates given in degrees.
2828
* @category Constructors
2929
*/
30-
static fromDegrees(lat: Angle, lng: Angle): LatLng {
30+
static fromDegrees(lat: number, lng: number): LatLng {
3131
return new LatLng(lat * DEGREE, lng * DEGREE)
3232
}
3333

s2/Point.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class Point implements Region {
223223

224224
for (let i = 0; i < numVertices; i++) {
225225
const angle = i * radianStep
226-
const p = Point.fromVector(new Vector(r * Math.cos(angle), r * Math.sin(angle), z))
226+
const p = new Point(r * Math.cos(angle), r * Math.sin(angle), z)
227227
vertices.push(Point.fromVector(fromFrame(frame, p).vector.normalize()))
228228
}
229229

s2/cellid.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,6 @@ export const prevWrap = (ci: CellID): CellID => {
633633

634634
/**
635635
* Returns the level of the common ancestor of the two S2 CellIDs.
636-
* @param other The other CellID to compare with.
637-
* @returns A tuple where the first element is the level and the second element is a boolean indicating success.
638636
*/
639637
export const commonAncestorLevel = (ci: CellID, other: CellID): [number, boolean] => {
640638
let bits = ci ^ other

0 commit comments

Comments
 (0)