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

Rectangles not rotated correctly #133

Open
darwindarak opened this issue Jul 21, 2015 · 2 comments · May be fixed by #338
Open

Rectangles not rotated correctly #133

darwindarak opened this issue Jul 21, 2015 · 2 comments · May be fixed by #338

Comments

@darwindarak
Copy link
Contributor

Rotation changes the corner coordinates of the rectangle, but the rectangle is still parallel with axes of the outermost context. Maybe we can have the rectangle() methods create PolygonPrimitive's instead?

@bjarthur
Copy link
Member

is this still a problem? if so, could you please provide code to demonstrate?

@Mattriks
Copy link
Member

rect::Float64) =  (context(rotation=Rotation(θ, 0.5, 0.5)), rectangle(0.3, 0.4, 0.4, 0.2), stroke("red"), fill(nothing))

img = compose(context(),
    (context(), circle(0.5, 0.5, 0.01), stroke("black"), fill(nothing)),
    (context(), circle(0.5, 0.5, 0.224), stroke("grey"), fill(nothing)),
    (context(), rectangle(0.3, 0.4, 0.4, 0.2), stroke("black"), fill(nothing)),
    (context(rotation=Rotation(-0.1π, 0.5,0.5)), stroke("blue"), linewidth(1pt),
        line([(0.5,0.276),(0.5,0.726)]) ), rect/4), rect(5π/4),
    (context(), line([(0.3,0.4),(0.5,0.5)]), stroke("green"))
)

issue133
The top left corner point of the black rectangle is correctly rotated around the grey circle, but the other 3 points are not rotated. This is because rotation is performed at the Compose level, but the other 3 points are explicitly calculated at backend level. As the OP states, the easiest way to fix this is to have the rectangle() methods create PolygonPrimitives rather than RectanglePrimitives.

@Mattriks Mattriks linked a pull request Dec 29, 2018 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants