imageproc icon indicating copy to clipboard operation
imageproc copied to clipboard

Support drawing oblique ellipse

Open J-F-Liu opened this issue 5 years ago • 3 comments

For an ellipse with center (u, v), semi-axis (a, b), angle θ, the circum points can be calculated from parametric equation and 2D rotation:

x = a cost cosθ - b sint sinθ + u
y = a cost sinθ + b sint cosθ + v
t ∈ [0, 2π)

To draw elliptic arc, set t ∈ [start_angle, end_angle].

J-F-Liu avatar Feb 27 '20 13:02 J-F-Liu

I was going to raise an issue for supporting angle on ellipse - is this the same feature request or something different?

RReverser avatar Feb 22 '21 02:02 RReverser

I think it's the same feature.

J-F-Liu avatar Feb 22 '21 02:02 J-F-Liu

Thinking about this more - the same would probably apply to e.g. rectangles.

I wonder if a better solution would be to allow to wrap Canvas into a cheap newtype combined with Projection (https://docs.rs/imageproc/0.22.0/imageproc/geometric_transformations/struct.Projection.html) so that any drawings onto such wrapper would be automatically translated before drawn onto the inner canvas (actual image).

RReverser avatar Feb 22 '21 02:02 RReverser