You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we add an Alignable instance for P2 (which we should probably have anyway):
instance Alignable (Point V2 Double) where defaultBoundary = envelopeBoundary
then we should be able to align lists of points, via the Alignable [b] instance. However, this doesn't seem to do the right thing. If we call envelopeBoundary directly (which goes via the Enveloped instance for lists), it works fine:
combineBoundaries
:: (InSpace v n a, Metric v, Ord n, F.Foldable f)
=> (v n -> a -> Point v n) -> v n -> f a -> Point v n
combineBoundaries b v fa
= b v $ F.maximumBy (comparing (quadrance . (.-. origin) . b v)) fa
Comparing the resulting points by their absolute distance from the origin makes no sense. We want the point which is furthest in the direction of v, so we should be comparing them by projecting onto v and comparing the (signed) magnitude of the results.
See https://github.com/diagrams/diagrams-lib/blob/master/src/Diagrams/Align.hs#L96 .
If we add an
Alignable
instance forP2
(which we should probably have anyway):then we should be able to align lists of points, via the
Alignable [b]
instance. However, this doesn't seem to do the right thing. If we callenvelopeBoundary
directly (which goes via theEnveloped
instance for lists), it works fine:But if we call
defaultBoundary
, which goes via theAlignable [b]
instance and hence thecombineBoundaries
function, we get this:Notice we get the same boundary point no matter which direction we query.
The text was updated successfully, but these errors were encountered: