Skip to content

Commit

Permalink
Merge pull request #328 from bacchanalia/master
Browse files Browse the repository at this point in the history
fix for: section producing incorrect results #322
  • Loading branch information
byorgey committed Mar 7, 2019
2 parents 9febf32 + c0da81d commit 7ff9922
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Diagrams/Located.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ instance (InSpace v n a, Fractional n, Parametric a, Sectionable a, Codomain a ~
splitAtParam (Loc x a) p = (Loc x a1, Loc (x .+^ (a `atParam` p)) a2)
where (a1,a2) = splitAtParam a p

section (Loc x a) p1 p2 = Loc (x .+^ (a `atParam` p1)) (section a p1 p2)

reverseDomain (Loc x a) = Loc (x .+^ y) (reverseDomain a)
where y = a `atParam` domainUpper a

Expand Down
4 changes: 4 additions & 0 deletions src/Diagrams/Trail.hs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ instance (Metric v, OrderedField n, Real n)
where
(t1, t2) = splitAtParam t p

section (Line t) p1 p2 = Line (section t p1 p2)

reverseDomain = reverseLine

instance (Metric v, OrderedField n, Real n)
Expand Down Expand Up @@ -768,6 +770,8 @@ instance (Metric v, OrderedField n, Real n) => EndValues (Trail v n)
instance (Metric v, OrderedField n, Real n) => Sectionable (Trail v n) where
splitAtParam t p = withLine ((wrapLine *** wrapLine) . (`splitAtParam` p)) t

section t p1 p2 = withLine (wrapLine . (\l -> section l p1 p2)) t

reverseDomain = reverseTrail

instance (Metric v, OrderedField n, Real n)
Expand Down

0 comments on commit 7ff9922

Please sign in to comment.