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

Add a convenient way to set (mutate) the value of a Point #86

Open
davjhan opened this issue Mar 3, 2022 · 1 comment
Open

Add a convenient way to set (mutate) the value of a Point #86

davjhan opened this issue Mar 3, 2022 · 1 comment

Comments

@davjhan
Copy link

davjhan commented Mar 3, 2022

Currently, if I have a circle, there is no way to change the origin of the point to a given point.

There is translate(Point) and shift(x,y), but translate just invokes shift, and it moves the point, not sets it at the new point.

The current solution is to use the verbose constructor and go myCircle = new Circle(new Point(x,y),myCircle.radius).

Either offer a new interface method like Circle.setOrigin(Point) or Circle.setOrigin(x,y) or offer a Point.set(x,y) which will mutate the x and y variables in place.

@davjhan davjhan changed the title Add a way to set (mutate) the value of a Point Add a convenient way to set (mutate) the value of a Point Mar 3, 2022
@plegner
Copy link
Member

plegner commented Mar 4, 2022

Thanks for suggesting this, @davjhan! Right now, all geometry objects are intentionally immutable, to make it easier to work with observable utilities and watching for changes. However, we'll definitely keep this in mind as we continue working on it.

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

2 participants