Closed nikochiko closed 7 months ago
The problem is that the current rectangle representation only has a center, width, and height. It doesn't have room for information about its orientation.
Polygon as a collection of points is a general solution that will work with other polygons too.
@Sudha247 @AryanGodara
With the current representation of ellipse/rectangles, there's no way to rotate them. This is a problem, and we should correct for it.
We can keep the API the same but change the representation internally so that we can then rotate these shapes.
I'm thinking that we should use a general
Polygon
shape that would keep track of all points of the shape. In the rectangle constructor, we can calculate these initial points from the center, width, and height.Rotating the ellipse would still be hard because the graphics library doesn't have an API that would account for its rotation. https://v2.ocaml.org/releases/4.03/htmlman/libref/Graphics.html
Hi @nikochiko, @Sudha247, @AryanGodara
I have two propositions regarding the representation for the ellipse, it's rotation and complexity.
With the current representation of ellipse/rectangles, there's no way to rotate them. This is a problem, and we should correct for it.
We can keep the API the same but change the representation internally so that we can then rotate these shapes.
I'm thinking that we should use a general
Polygon
shape that would keep track of all points of the shape. In the rectangle constructor, we can calculate these initial points from the center, width, and height.Rotating the ellipse would still be hard because the graphics library doesn't have an API that would account for its rotation. https://v2.ocaml.org/releases/4.03/htmlman/libref/Graphics.html