diff options
Diffstat (limited to 'Build/source/utils/asymptote/examples/floor.asy')
-rw-r--r-- | Build/source/utils/asymptote/examples/floor.asy | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/examples/floor.asy b/Build/source/utils/asymptote/examples/floor.asy new file mode 100644 index 00000000000..96e71812c01 --- /dev/null +++ b/Build/source/utils/asymptote/examples/floor.asy @@ -0,0 +1,28 @@ +import graph; +unitsize(1cm); + +real Floor(real x) {return floor(x);} + +pair[] Close; +pair[] Open; + +bool3 branch(real x) { + static real lasty; + static bool first=true; + real y=floor(x); + bool samebranch=first || lasty == y; + first=false; + if(samebranch) lasty=x; + else { + Close.push((x,lasty)); + Open.push((x,y)); + } + lasty=y; + return samebranch ? true : default; +}; + +draw(graph(Floor,-5.5,5.5,500,branch)); +axes("$x$","$\lfloor x\rfloor$",red); + +dot(Close); +dot(Open,UnFill); |