Skip to content

Commit

Permalink
Rename bound with bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Dec 1, 2023
1 parent 451aca9 commit 2e8bd47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/examples/primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ stroke(b, 'plum')
// All property functions for paths will be memoized.
// Thus, the path is immutable.
Path.length(path)
Path.bound(path)
Path.bounds(path)
Path.area(path)

// Manipulating and combining paths
Expand Down
4 changes: 2 additions & 2 deletions src/Bezier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ describe('Bezier', () => {
})

it('should compute the `bound` correctly', () => {
expect(Bezier.bound(a)).toEqual([
expect(Bezier.bounds(a)).toEqual([
[0, 0],
[1, 0.75],
])
expect(Bezier.bound(b)).toEqual([
expect(Bezier.bounds(b)).toEqual([
[0, 0],
[1.25, 0.444444],
])
Expand Down
20 changes: 11 additions & 9 deletions src/Bezier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ export namespace Bezier {
/**
* Calculates the bounding box of this Bezier curve.
*/
export const bound = memoizeBezierFunction((bezier: Bezier): [vec2, vec2] => {
const bezierJS = toBezierJS(bezier)
const {x, y} = bezierJS.bbox()

return [
[x.min, y.min],
[x.max, y.max],
]
})
export const bounds = memoizeBezierFunction(
(bezier: Bezier): [vec2, vec2] => {
const bezierJS = toBezierJS(bezier)
const {x, y} = bezierJS.bbox()

return [
[x.min, y.min],
[x.max, y.max],
]
}
)

/**
* Calculates the point on the curve at the specified `t` value.
Expand Down

0 comments on commit 2e8bd47

Please sign in to comment.