Skip to content

Commit 26a0886

Browse files
Only extend regions in uncertain-sample plot to the actual neighbours.
1 parent c047941 commit 26a0886

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

  • Graphics/Dynamic/Plot

Graphics/Dynamic/Plot/R2.hs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -531,39 +531,43 @@ instance Plottable (PointsWeb ℝ (Shade' ℝ)) where
531531
where plot grWS@(GraphWindowSpecR2{..}) = mkPlot $
532532
foldMap parallelogram trivs
533533
<> foldMap vbar divis
534-
where parallelogram ((x,δx), ((y,δy), j))
535-
= lLoop [ (x+δx)^&(y+δy+jδx), (x-δx)^&(y+δy-jδx)
536-
, (x-δx)^&(y-δy-jδx), (x+δx)^&(y-δy+jδx) ]
534+
where parallelogram ((x,(δxl,δxr)), ((y,δy), j))
535+
= lLoop [ (x+δxr)^&(y+δy+jδxr), (x-δxl)^&(y+δy-jδxl)
536+
, (x-δxl)^&(y-δy-jδxl), (x+δxr)^&(y-δy+jδxr) ]
537537
& Dia.strokeLocLoop
538538
& Dia.opacity 0.3
539-
where jδx = j $ δx
540-
vbar (x,δx) = Dia.fromVertices
541-
[ (x-δx)^&tBound, (x-δx)^&bBound
542-
, (x+δx)^&bBound, (x+δx)^&tBound ]
539+
where jδxl = j $ δxl
540+
jδxr = j $ δxr
541+
vbar (x,(δxl,δxr)) = Dia.fromVertices
542+
[ (x-δxl)^&tBound, (x-δxl)^&bBound
543+
, (x+δxr)^&bBound, (x+δxr)^&tBound ]
543544

544-
trivs :: [((, Diff ), ((, Diff ), LocalLinear ))]
545-
divis :: [(, Diff )]
545+
trivs :: [((, (Diff ,Diff )), ((, Diff ), LocalLinear ))]
546+
divis :: [(, (Diff ,Diff ))]
546547
(trivs,divis) = concat***concat $ unzip (map mkTriv locals)
547548
where mkTriv ((xc,Shade' yc yce), [(δxo, Shade' yo _)])
548549
= case tryMetricAsLength yce of
549550
Option (Just ry) ->
550-
( [ ( (xc, δxo)
551+
( [ ( (xc, dirSort 0 δxo)
551552
, ( (yc, ry)
552553
, denseLinear $ \δx -> δx * (yo-yc)/δxo ) ) ], [] )
553554
Option Nothing ->
554-
( [], [(xc, δxo)] )
555+
( [], [(xc, dirSort 0 δxo)] )
555556
mkTriv ((xc,Shade' yc yce), [(δxl, Shade' yl _), (δxr, Shade' yr _)])
556557
= case tryMetricAsLength yce of
557558
Option (Just ry) ->
558-
( [ ( (xc, δxg)
559+
( [ ( (xc, dirSort δxl δxr)
559560
, ( (yc, ry)
560561
, denseLinear $ \δx -> δx * η ) ) ], [] )
561562
Option Nothing ->
562-
( [], [(xc, δxg)] )
563+
( [], [(xc, dirSort δxl δxr)] )
563564
where δxg = (δxr - δxl)/2
564565
η = (yr - yl)/(2*δxg)
565566
mkTriv (p,lrs) = concat***concat $ unzip [mkTriv (p,[l,r]) | l<-ls, r<-rs]
566567
where (ls,rs) = partition ((<0) . fst) lrs
568+
569+
dirSort δ₁ δ₂ | δ₁ < δ₂ = (-δ₁, δ₂)
570+
| otherwise = (-δ₂, δ₁)
567571

568572
lLoop ps@(p:_) = Dia.fromVertices $ ps++[p]
569573

0 commit comments

Comments
 (0)