Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider allowing Point to be expressed as [number, number] #110

Open
ianstormtaylor opened this issue Jun 1, 2022 · 0 comments
Open

consider allowing Point to be expressed as [number, number] #110

ianstormtaylor opened this issue Jun 1, 2022 · 0 comments

Comments

@ianstormtaylor
Copy link

ianstormtaylor commented Jun 1, 2022

I noticed that in the test files this pattern is already used, with inline poly and line helpers defined. It would be really nice to be able to use this out of the box, because defining polygons or lines gets tedious having to do new Point(...), new Point(...), new Point(...) manually.

Some actual code of mine:

let poly = new Polygon(
  new Point(rx, rh),
  new Point(lx, lh),
  new Point(lx, ly),
  new Point(rx, ry)
)

Would be nicely simplified to:

let poly = new Polygon(
  [rx, rh],
  [lx, lh],
  [lx, ly],
  [rx, ry]
)

It seems like this would be a variant of SimplePoint, as a tuple instead of an object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant