Skip to content

Commit 5526200

Browse files
committed
Wind Extent.polygon() counterclockwise
(re: #296) This also adds "@esbuild/darwin-arm64" optional dependency
1 parent 0724fa8 commit 5526200

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

package-lock.json

Lines changed: 23 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
"typescript": "^5.7.3",
3737
"typescript-eslint": "^8.21.0"
3838
},
39+
"optionalDependencies": {
40+
"@esbuild/darwin-arm64": "^0.25.6"
41+
},
3942
"scripts": {
4043
"all": "run-s clean build test",
4144
"build": "npm run build --workspaces",

packages/math/src/Extent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ export class Extent {
119119
return { minX: this.min[0], minY: this.min[1], maxX: this.max[0], maxY: this.max[1] };
120120
}
121121

122-
/** Returns a polygon representing the extent wound clockwise.
122+
/** Returns a polygon representing the extent wound counterclockwise.
123123
* @returns Polygon array
124124
* @example
125-
* new Extent([0, 0], [5, 10]).polygon(); // returns [[0, 0], [0, 10], [5, 10], [5, 0], [0, 0]]
125+
* new Extent([0, 0], [5, 10]).polygon(); // returns [[0, 0], [5, 0], [5, 10], [0, 10], [0, 0]]
126126
*/
127127
polygon(): Vec2[] {
128128
return [
129129
[this.min[0], this.min[1]],
130-
[this.min[0], this.max[1]],
131-
[this.max[0], this.max[1]],
132130
[this.max[0], this.min[1]],
131+
[this.max[0], this.max[1]],
132+
[this.min[0], this.max[1]],
133133
[this.min[0], this.min[1]]
134134
];
135135
}

packages/math/test/Extent.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('math/extent', () => {
100100
const e = new Extent([0, 0], [5, 10]);
101101
const result = e.polygon();
102102
assert.ok(result instanceof Array);
103-
assert.deepEqual(result, [ [0, 0], [0, 10], [5, 10], [5, 0], [0, 0] ]);
103+
assert.deepEqual(result, [[0, 0], [5, 0], [5, 10], [0, 10], [0, 0]]);
104104
});
105105
});
106106

packages/math/test/geom.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ describe('math/geom', () => {
281281
const points = [[0, -1], [5, 1], [10, -1], [15, 1]];
282282
const ssr = test.geomGetSmallestSurroundingRectangle(points);
283283
assert.ok(ssr instanceof Object);
284-
assert.deepEqual(ssr.poly, [[0, -1], [0, 1], [15, 1], [15, -1], [0, -1]]);
284+
assert.deepEqual(ssr.poly, [[0, -1], [15, -1], [15, 1], [0, 1], [0, -1]]);
285285
assert.equal(ssr.angle, 0);
286286
});
287287
});

0 commit comments

Comments
 (0)