Skip to content

Commit

Permalink
Merge pull request #102 from diagrams/parametric-Located
Browse files Browse the repository at this point in the history
change Codomain of Located to Point (Codomain a)
  • Loading branch information
fryguybob committed Sep 5, 2013
2 parents a1886b3 + e7a5fa7 commit f3d0a6b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Diagrams/Located.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,18 @@ instance Traced a => Traced (Located a) where
instance Qualifiable a => Qualifiable (Located a) where
n |> (Loc p a) = Loc p (n |> a)

type instance Codomain (Located a) = Located (Codomain a)
type instance Codomain (Located a) = Point (Codomain a)

instance (V a ~ V (Codomain a), Parametric a) => Parametric (Located a) where
(Loc x a) `atParam` p = Loc x (a `atParam` p)
instance (Codomain a ~ V a, AdditiveGroup (V a), Parametric a)
=> Parametric (Located a) where
(Loc x a) `atParam` p = x .+^ (a `atParam` p)

instance DomainBounds a => DomainBounds (Located a) where
domainLower (Loc _ a) = domainLower a
domainUpper (Loc _ a) = domainUpper a

instance (V a ~ V (Codomain a), EndValues a) => EndValues (Located a)
instance (Codomain a ~ V a, AdditiveGroup (V a), EndValues a)
=> EndValues (Located a)

instance ( Codomain a ~ V a, Fractional (Scalar (V a)), AdditiveGroup (V a)
, Sectionable a, Parametric a
Expand All @@ -140,7 +142,9 @@ instance ( Codomain a ~ V a, Fractional (Scalar (V a)), AdditiveGroup (V a)
reverseDomain (Loc x a) = Loc (x .+^ y) (reverseDomain a)
where y = a `atParam` (domainUpper a)

instance (HasArcLength a, Fractional (Scalar (V a)), V a ~ V (Codomain a))
instance ( Codomain a ~ V a, AdditiveGroup (V a), Fractional (Scalar (V a))
, HasArcLength a
)
=> HasArcLength (Located a) where
arcLengthBounded eps (Loc _ a) = arcLengthBounded eps a
arcLengthToParam eps (Loc _ a) l = arcLengthToParam eps a l

0 comments on commit f3d0a6b

Please sign in to comment.