-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
Ellipse
representation and improve helpers (#11435)
# Objective Currently, the `Ellipse` primitive is represented by a `half_width` and `half_height`. To improve consistency (similarly to #11434), it might make more sense to use a `Vec2` `half_size` instead. Alternatively, to make the elliptical nature clearer, the properties could also be called `radius_x` and `radius_y`. Secondly, `Ellipse::new` currently takes a *full* width and height instead of two radii. I would expect it to take the half-width and half-height because ellipses and circles are almost always defined using radii. I wouldn't expect `Circle::new` to take a diameter (if we had that method). ## Solution Change `Ellipse` to store a `half_size` and `new` to take the half-width and half-height. I also added a `from_size` method similar to `Rectangle::from_size`, and added the `semi_minor` and `semi_major` helpers to get the semi-minor/major radius.
- Loading branch information
Showing
2 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters