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

Handle rect with zero arguments. #43

Closed
fryguybob opened this issue Aug 7, 2012 · 1 comment
Closed

Handle rect with zero arguments. #43

fryguybob opened this issue Aug 7, 2012 · 1 comment

Comments

@fryguybob
Copy link
Member

Right now rect is implemented by scaling a unitSquare, but if given zero as an argument that scaling will not have a valid inverse. This shows up later as a NaN with doubles. Semantically a rect with zero is fine, however, as a line or four lines, depending on how we want to go about it.

Ryan

Sönke Hahn wrote:

Hi!

Is this wanted behaviour?

Prelude> import Diagrams.Prelude
Prelude Diagrams.Prelude> import Diagrams.Backend.Cairo
Prelude Diagrams.Prelude Diagrams.Backend.Cairo> size2D (rect 0 10 ::
QDiagram Cairo R2 Any)
[snip]
Loading package diagrams-cairo-0.5.0.2 ... linking ... done.
(NaN,NaN)

I would have expected (0, 10).

Thanks,
Sönke

@byorgey
Copy link
Member

byorgey commented Aug 7, 2012

Note that this works as expected:

Diagrams.Prelude> size2D (rect 0 10 :: Path R2)
(0.0,10.0)

Perhaps instead of scaling unitSquare we could call pathLike directly?

@byorgey byorgey closed this as completed in 479821b Jan 1, 2013
fryguybob added a commit that referenced this issue Jan 1, 2013
do scaling on a Path before constructing PathLike in 'rect' (fixes #43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants