1
- const ϵmach = eps ( ) # machine epsilon
2
- const N_PLOT_SAMPLING_POINTS = 100
1
+ const ϵrel = Base . rtoldefault (Float64 ) # machine epsilon
2
+ const N_PLOT_SAMPLING_POINTS = 101
3
3
4
4
# Define drawshape() and drawshape!() functions.
5
5
@recipe (DrawShape) do scene
27
27
# Define the new signature of contour!() used in drawshape!() for 2D shapes.
28
28
function Makie. convert_arguments (P:: SurfaceLike , shp:: Shape{2} )
29
29
lower, upper = bounds (shp)
30
+ ∆ = upper - lower
30
31
31
- xs = range (lower[1 ] - ϵmach , upper[1 ] + ϵmach , length= N_PLOT_SAMPLING_POINTS)
32
- ys = range (lower[2 ] - ϵmach , upper[2 ] + ϵmach , length= N_PLOT_SAMPLING_POINTS)
32
+ nw = 1 ; xs = range (lower[nw] - ϵrel * ∆[nw] , upper[nw] + ϵrel * ∆[nw] , length= N_PLOT_SAMPLING_POINTS)
33
+ nw = 2 ; ys = range (lower[nw] - ϵrel * ∆[nw] , upper[nw] + ϵrel * ∆[nw] , length= N_PLOT_SAMPLING_POINTS)
33
34
34
35
lvs = [level (@SVector ([x,y]), shp) for x = xs, y = ys]
35
36
@@ -51,9 +52,10 @@ function Makie.convert_arguments(P::SurfaceLike, shp::Shape{3},
51
52
ŵ = SVector (ntuple (identity,Val (3 ))) .== nw
52
53
53
54
lower, upper = bounds (shp)
55
+ ∆ = upper - lower
54
56
55
- us = range (lower[nu]- ϵmach , upper[nu]+ ϵmach , length= N_PLOT_SAMPLING_POINTS)
56
- vs = range (lower[nv]- ϵmach , upper[nv]+ ϵmach , length= N_PLOT_SAMPLING_POINTS)
57
+ us = range (lower[nu] - ϵrel * ∆[nu] , upper[nu] + ϵrel * ∆[nu] , length= N_PLOT_SAMPLING_POINTS)
58
+ vs = range (lower[nv] - ϵrel * ∆[nv] , upper[nv] + ϵrel * ∆[nv] , length= N_PLOT_SAMPLING_POINTS)
57
59
58
60
lvs = [level (u* û + v* v̂ + cept* ŵ, shp) for u = us, v = vs]
59
61
0 commit comments