/usr/share/axiom-20170501/src/algebra/PLOTTOOL.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | )abbrev package PLOTTOOL PlotTools
++ Description:
++ This package exports plotting tools
PlotTools() : SIG == CODE where
L ==> List
SEG ==> Segment
SF ==> DoubleFloat
Pt ==> Point(SF)
PLOT ==> Plot
DROP ==> DrawOption
S ==> String
VIEW2D ==> TwoDimensionalViewport
SIG ==> with
calcRanges : L L Pt -> L SEG SF
++ calcRanges(l) \undocumented
CODE ==> add
import GraphicsDefaults
import PLOT
import TwoDimensionalPlotClipping
import DrawOptionFunctions0
import ViewportPackage
import POINT
import PointPackage(SF)
--%Local functions
xRange0: L Pt -> SEG SF
xRange: L L Pt -> SEG SF
yRange0: L Pt -> SEG SF
yRange: L L Pt -> SEG SF
drawToScaleRanges: (SEG SF,SEG SF) -> L SEG SF
drawToScaleRanges(xVals,yVals) ==
xDiff := (xHi := hi xVals) - (xLo := lo xVals)
yDiff := (yHi := hi yVals) - (yLo := lo yVals)
pad := abs(yDiff - xDiff)/2
yDiff > xDiff => [segment(xLo - pad,xHi + pad),yVals]
[xVals,segment(yLo - pad,yHi + pad)]
select : (L Pt,Pt -> SF,(SF,SF) -> SF) -> SF
select(l,f,g) ==
m := f first l
for p in rest l repeat m := g(m,f p)
m
xRange0(list:L Pt) == select(list,xCoord,min) .. select(list,xCoord,max)
yRange0(list:L Pt) == select(list,yCoord,min) .. select(list,yCoord,max)
select2: (L L Pt,L Pt -> SF,(SF,SF) -> SF) -> SF
select2(l,f,g) ==
m := f first l
for p in rest l repeat m := g(m,f p)
m
xRange(list:L L Pt) ==
select2(list,(u1:L(Pt)):SF +-> lo(xRange0(u1)),min) _
.. select2(list,(v1:L(Pt)):SF +-> hi(xRange0(v1)),max)
yRange(list:L L Pt) ==
select2(list,(u1:L(Pt)):SF +-> lo(yRange0(u1)),min) _
.. select2(list,(v1:L(Pt)):SF +-> hi(yRange0(v1)),max)
--%Exported Functions
calcRanges(llp) ==
drawToScale() => drawToScaleRanges(xRange llp, yRange llp)
[xRange llp, yRange llp]
|