{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Diagrams.Trace
(
Trace, Traced
, trace, setTrace, withTrace
, traceV, traceP, maxTraceV, maxTraceP
, boundaryFrom, boundaryFromMay
) where
import Diagrams.Core (OrderedField, Point, Subdiagram, location,
origin, setTrace, trace)
import Diagrams.Core.Trace
import Data.Maybe
import Data.Semigroup
import Diagrams.Combinators (withTrace)
import Linear.Metric
import Linear.Vector
boundaryFrom :: (OrderedField n, Metric v, Semigroup m)
=> Subdiagram b v n m -> v n -> Point v n
boundaryFrom :: forall n (v :: * -> *) m b.
(OrderedField n, Metric v, Semigroup m) =>
Subdiagram b v n m -> v n -> Point v n
boundaryFrom Subdiagram b v n m
s v n
v = forall a. a -> Maybe a -> a
fromMaybe forall (f :: * -> *) a. (Additive f, Num a) => Point f a
origin forall a b. (a -> b) -> a -> b
$ forall (v :: * -> *) n m b.
(Metric v, OrderedField n, Semigroup m) =>
Subdiagram b v n m -> v n -> Maybe (Point v n)
boundaryFromMay Subdiagram b v n m
s v n
v
boundaryFromMay :: (Metric v, OrderedField n, Semigroup m)
=> Subdiagram b v n m -> v n -> Maybe (Point v n)
boundaryFromMay :: forall (v :: * -> *) n m b.
(Metric v, OrderedField n, Semigroup m) =>
Subdiagram b v n m -> v n -> Maybe (Point v n)
boundaryFromMay Subdiagram b v n m
s v n
v = forall n a.
(n ~ N a, Traced a, Num n) =>
Point (V a) n -> V a n -> a -> Maybe (Point (V a) n)
traceP (forall (v :: * -> *) n b m.
(Additive v, Num n) =>
Subdiagram b v n m -> Point v n
location Subdiagram b v n m
s) (forall (f :: * -> *) a. (Functor f, Num a) => f a -> f a
negated v n
v) Subdiagram b v n m
s