Fixed `arc` and `arcT` so they are always CCW. #56

Merged
merged 4 commits into from Nov 2, 2012

Conversation

Projects
None yet
2 participants
Owner

fryguybob commented Oct 30, 2012

Also added a few new functions for making arcs. I still have to fix roundedRect, but that should be fast once I have some tests. Wait to pull until then.

src/Diagrams/TwoD/Arc.hs
arcT :: Angle a => a -> a -> Trail R2
-arcT start end = Trail bs (sweep >= tau)
+arcT start end
+ | e < s = arcT s (e + 1) -- Try again closer to CCW
@byorgey

byorgey Oct 30, 2012

Owner

Wouldn't arcT s (e + ceiling (s - e)) be better in the (admittedly rare) case when s and e differ by much more than 1?

@fryguybob

fryguybob Oct 31, 2012

Owner

Yeah, I'll switch to that.

@fryguybob

fryguybob Oct 31, 2012

Owner

I'm assuming there isn't some edge case with Double where e < s and ceiling (s - e) == 0.

@byorgey

byorgey Oct 31, 2012

Owner

If there is, it serves people right for calling arcT with those arguments. I doubt such an arc would be visible anyway.

byorgey added a commit that referenced this pull request Nov 2, 2012

Merge pull request #56 from fryguybob/arc-enhancements
Fixed `arc` and `arcT` so they are always CCW.

@byorgey byorgey merged commit 8d79138 into diagrams:master Nov 2, 2012

1 check passed

default The Travis build passed
Details

@byorgey byorgey referenced this pull request Nov 2, 2012

Closed

Enhancements for `arc`s. #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment