\documentclass{article} \usepackage{open-axiom} \begin{document} \title{src/algebra drawopt.spad} \author{Stephen M. Watt, Jim Wen} \maketitle \begin{abstract} \end{abstract} \tableofcontents \eject \section{domain DROPT DrawOption} <>= )abbrev domain DROPT DrawOption ++ Author: Stephen Watt ++ Date Created: 1 March 1990 ++ Date Last Updated: 31 Oct 1990, Jim Wen ++ Basic Operations: adaptive, clip, title, style, toScale, coordinates, ++ pointColor, curveColor, colorFunction, tubeRadius, range, ranges, ++ var1Steps, var2Steps, tubePoints, unit ++ Related Constructors: ++ Also See: ++ AMS Classifications: ++ Keywords: ++ References: ++ Description: DrawOption allows the user to specify defaults for the ++ creation and rendering of plots. DrawOption(): Exports == Implementation where RANGE ==> List Segment Float UNIT ==> List Float PAL ==> Palette POINT ==> Point(DoubleFloat) SEG ==> Segment Float SF ==> DoubleFloat SPACE3 ==> ThreeSpace(DoubleFloat) VIEWPT ==> Record( theta:SF, phi:SF, scale:SF, scaleX:SF, scaleY:SF, scaleZ:SF, deltaX:SF, deltaY:SF ) Exports ==> SetCategory with adaptive : Boolean -> % ++ adaptive(b) turns adaptive 2D plotting on if b is true, or off if b is ++ false. This option is expressed in the form \spad{adaptive == b}. clip : Boolean -> % ++ clip(b) turns 2D clipping on if b is true, or off if b is false. This option ++ is expressed in the form \spad{clip == b}. viewpoint : VIEWPT -> % ++ viewpoint(vp) creates a viewpoint data structure corresponding to the list ++ of values. The values are interpreted as [theta, phi, scale, scaleX, scaleY, ++ scaleZ, deltaX, deltaY]. This option is expressed in the form ++ \spad{viewpoint == ls}. title : String -> % ++ title(s) specifies a title for a plot by the indicated string s. This option ++ is expressed in the form \spad{title == s}. style : String -> % ++ style(s) specifies the drawing style in which the graph will be plotted ++ by the indicated string s. This option is expressed in the form \spad{style == s}. toScale : Boolean -> % ++ toScale(b) specifies whether or not a plot is to be drawn to scale; ++ if b is true it is drawn to scale, if b is false it is not. This option ++ is expressed in the form \spad{toScale == b}. clip : List SEG -> % ++ clip([l]) provides ranges for user-defined clipping as specified ++ in the list l. This option is expressed in the form \spad{clip == [l]}. coordinates : (POINT -> POINT) -> % ++ coordinates(p) specifies a change of coordinate systems of point p. ++ This option is expressed in the form \spad{coordinates == p}. pointColor : Float -> % ++ pointColor(v) specifies a color, v, for 2D graph points. This option ++ is expressed in the form \spad{pointColor == v}. pointColor : PAL -> % ++ pointColor(p) specifies a color index for 2D graph points from the spadcolors ++ palette p. This option is expressed in the form \spad{pointColor == p}. curveColor : Float -> % ++ curveColor(v) specifies a color, v, for 2D graph curves. This option is expressed ++ in the form \spad{curveColor == v}. curveColor : PAL -> % ++ curveColor(p) specifies a color index for 2D graph curves from the ++ spadcolors palette p. This option is expressed in the form \spad{curveColor ==p}. colorFunction : (SF -> SF) -> % ++ colorFunction(f(z)) specifies the color based upon the z-component of ++ three dimensional plots. This option is expressed in the form \spad{colorFunction == f(z)}. colorFunction : ((SF,SF) -> SF) -> % ++ colorFunction(f(u,v)) specifies the color for three dimensional plots ++ as a function based upon the two parametric variables. This option is expressed ++ in the form \spad{colorFunction == f(u,v)}. colorFunction : ((SF,SF,SF) -> SF) -> % ++ colorFunction(f(x,y,z)) specifies the color for three dimensional ++ plots as a function of x, y, and z coordinates. This option is expressed in the ++ form \spad{colorFunction == f(x,y,z)}. tubeRadius : Float -> % ++ tubeRadius(r) specifies a radius, r, for a tube plot around a 3D curve; ++ is expressed in the form \spad{tubeRadius == 4}. range : List SEG -> % ++ range([l]) provides a user-specified range l. This option is expressed in the ++ form \spad{range == [l]}. range : List Segment Fraction Integer -> % ++ range([i]) provides a user-specified range i. This option is expressed in the ++ form \spad{range == [i]}. ranges : RANGE -> % ++ ranges(l) provides a list of user-specified ranges l. This option is expressed ++ in the form \spad{ranges == l}. space : SPACE3 -> % ++ space specifies the space into which we will draw. If none is given ++ then a new space is created. var1Steps : PositiveInteger -> % ++ var1Steps(n) indicates the number of subdivisions, n, of the first ++ range variable. This option is expressed in the form \spad{var1Steps == n}. var2Steps : PositiveInteger -> % ++ var2Steps(n) indicates the number of subdivisions, n, of the second ++ range variable. This option is expressed in the form \spad{var2Steps == n}. tubePoints : PositiveInteger -> % ++ tubePoints(n) specifies the number of points, n, defining the circle ++ which creates the tube around a 3D curve, the default is 6. This option is ++ expressed in the form \spad{tubePoints == n}. coord : (POINT->POINT) -> % ++ coord(p) specifies a change of coordinates of point p. This option is expressed ++ in the form \spad{coord == p}. unit : UNIT -> % ++ unit(lf) will mark off the units according to the indicated list lf. ++ This option is expressed in the form \spad{unit == [f1,f2]}. option : (List %, Symbol) -> Union(Any, "failed") ++ option() is not to be used at the top level; ++ option determines internally which drawing options are indicated in ++ a draw command. option?: (List %, Symbol) -> Boolean ++ option?() is not to be used at the top level; ++ option? internally returns true for drawing options which are ++ indicated in a draw command, or false for those which are not. Implementation ==> add import AnyFunctions1(String) import AnyFunctions1(Segment Float) import AnyFunctions1(VIEWPT) import AnyFunctions1(List Segment Float) import AnyFunctions1(List Segment Fraction Integer) import AnyFunctions1(List Integer) import AnyFunctions1(PositiveInteger) import AnyFunctions1(Boolean) import AnyFunctions1(RANGE) import AnyFunctions1(UNIT) import AnyFunctions1(Float) import AnyFunctions1(POINT -> POINT) import AnyFunctions1(SF -> SF) import AnyFunctions1((SF,SF) -> SF) import AnyFunctions1((SF,SF,SF) -> SF) import AnyFunctions1(POINT) import AnyFunctions1(PAL) import AnyFunctions1(SPACE3) Rep := Record(keyword:Symbol, value:Any) length:List SEG -> NonNegativeInteger -- these lists will become tuples in a later version length tup == # tup lengthR:List Segment Fraction Integer -> NonNegativeInteger -- these lists will become tuples in a later version lengthR tup == # tup lengthI:List Integer -> NonNegativeInteger -- these lists will become tuples in a later version lengthI tup == # tup viewpoint vp == ['viewpoint, vp::Any] title s == ['title, s::Any] style s == ['style, s::Any] toScale b == ['toScale, b::Any] clip(b:Boolean) == ['clipBoolean, b::Any] adaptive b == ['adaptive, b::Any] pointColor(x:Float) == ['pointColorFloat, x::Any] pointColor(c:PAL) == ['pointColorPalette, c::Any] curveColor(x:Float) == ['curveColorFloat, x::Any] curveColor(c:PAL) == ['curveColorPalette, c::Any] colorFunction(f:SF -> SF) == ['colorFunction1, f::Any] colorFunction(f:(SF,SF) -> SF) == ['colorFunction2, f::Any] colorFunction(f:(SF,SF,SF) -> SF) == ['colorFunction3, f::Any] clip(tup:List SEG) == length tup > 3 => error "clip: at most 3 segments may be specified" ['clipSegment, tup::Any] coordinates f == ['coordinates, f::Any] tubeRadius x == ['tubeRadius, x::Any] range(tup:List Segment Float) == ((n := length tup) > 3) => error "range: at most 3 segments may be specified" n < 2 => error "range: at least 2 segments may be specified" ['rangeFloat, tup::Any] range(tup:List Segment Fraction Integer) == ((n := lengthR tup) > 3) => error "range: at most 3 segments may be specified" n < 2 => error "range: at least 2 segments may be specified" ['rangeRat, tup::Any] ranges s == ['ranges, s::Any] space s == ['space, s::Any] var1Steps s == ['var1Steps, s::Any] var2Steps s == ['var2Steps, s::Any] tubePoints s == ['tubePoints, s::Any] coord s == ['coord, s::Any] unit s == ['unit, s::Any] coerce(x:%):OutputForm == x.keyword::OutputForm = x.value::OutputForm x:% = y:% == x.keyword = y.keyword and x.value = y.value option?(l, s) == for x in l repeat x.keyword = s => return true false option(l, s) == for x in l repeat x.keyword = s => return(x.value) "failed" @ \section{package DROPT1 DrawOptionFunctions1} <>= import Type import Symbol import List DrawOption )abbrev package DROPT1 DrawOptionFunctions1 ++ This package \undocumented{} DrawOptionFunctions1(S:Type): Exports == Implementation where RANGE ==> List Segment Float UNIT ==> List Float PAL ==> Palette POINT ==> Point(DoubleFloat) SEG ==> Segment Float SF ==> DoubleFloat SPACE3 ==> ThreeSpace(DoubleFloat) VIEWPT ==> Record( theta:SF, phi:SF, scale:SF, scaleX:SF, scaleY:SF, scaleZ:SF, deltaX:SF, deltaY:SF ) Exports ==> with option: (List DrawOption, Symbol) -> Union(S, "failed") ++ option(l,s) determines whether the indicated drawing option, s, ++ is contained in the list of drawing options, l, which is defined ++ by the draw command. Implementation ==> add import DrawOption option(l, s) == (u := option(l, s)@Union(Any, "failed")) case "failed" => "failed" retract(u::Any)$AnyFunctions1(S) @ \section{package DROPT0 DrawOptionFunctions0} <>= )abbrev package DROPT0 DrawOptionFunctions0 -- The functions here are not in DrawOptions since they are not -- visible to the interpreter. ++ This package \undocumented{} DrawOptionFunctions0(): Exports == Implementation where RANGE ==> List Segment Float UNIT ==> List Float PAL ==> Palette POINT ==> Point(DoubleFloat) SEG ==> Segment Float SF ==> DoubleFloat SPACE3 ==> ThreeSpace(DoubleFloat) VIEWPT ==> Record( theta:SF, phi:SF, scale:SF, scaleX:SF, scaleY:SF, scaleZ:SF, deltaX:SF, deltaY:SF ) Exports ==> with adaptive: (List DrawOption, Boolean) -> Boolean ++ adaptive(l,b) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{adaptive}. ++ If the option does not exist the value, b is returned. clipBoolean: (List DrawOption, Boolean) -> Boolean ++ clipBoolean(l,b) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{clipBoolean}. ++ If the option does not exist the value, b is returned. viewpoint: (List DrawOption, VIEWPT) -> VIEWPT ++ viewpoint(l,ls) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{viewpoint}. ++ IF the option does not exist, the value ls is returned. title: (List DrawOption, String) -> String ++ title(l,s) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{title}. ++ If the option does not exist the value, s is returned. style: (List DrawOption, String) -> String ++ style(l,s) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{style}. ++ If the option does not exist the value, s is returned. toScale: (List DrawOption, Boolean) -> Boolean ++ toScale(l,b) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{toScale}. ++ If the option does not exist the value, b is returned. pointColorPalette: (List DrawOption,PAL) -> PAL ++ pointColorPalette(l,p) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{pointColorPalette}. ++ If the option does not exist the value, p is returned. curveColorPalette: (List DrawOption,PAL) -> PAL ++ curveColorPalette(l,p) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{curveColorPalette}. ++ If the option does not exist the value, p is returned. ranges: (List DrawOption, RANGE) -> RANGE ++ ranges(l,r) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{ranges}. ++ If the option does not exist the value, r is returned. var1Steps: (List DrawOption, PositiveInteger) -> PositiveInteger ++ var1Steps(l,n) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{var1Steps}. ++ If the option does not exist the value, n is returned. var2Steps: (List DrawOption, PositiveInteger) -> PositiveInteger ++ var2Steps(l,n) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{var2Steps}. ++ If the option does not exist the value, n is returned. space: (List DrawOption) -> SPACE3 ++ space(l) takes a list of draw options, l, and checks to see ++ if it contains the option \spad{space}. If the the option ++ doesn't exist, then an empty space is returned. tubePoints : (List DrawOption, PositiveInteger) -> PositiveInteger ++ tubePoints(l,n) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{tubePoints}. ++ If the option does not exist the value, n is returned. tubeRadius : (List DrawOption, Float) -> Float ++ tubeRadius(l,n) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{tubeRadius}. ++ If the option does not exist the value, n is returned. coord: (List DrawOption, (POINT->POINT)) -> (POINT->POINT) ++ coord(l,p) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{coord}. ++ If the option does not exist the value, p is returned. units: (List DrawOption, UNIT) -> UNIT ++ units(l,u) takes the list of draw options, l, and checks ++ the list to see if it contains the option \spad{unit}. ++ If the option does not exist the value, u is returned. Implementation ==> add adaptive(l,s) == (u := option(l,'adaptive)$DrawOptionFunctions1(Boolean)) case "failed" => s u::Boolean clipBoolean(l,s) == (u := option(l,'clipBoolean)$DrawOptionFunctions1(Boolean)) case "failed" => s u::Boolean title(l, s) == (u := option(l,'title)$DrawOptionFunctions1(String)) case "failed" => s u::String viewpoint(l, vp) == (u := option(l,'viewpoint)$DrawOptionFunctions1(VIEWPT)) case "failed" => vp u::VIEWPT style(l, s) == (u := option(l,'style)$DrawOptionFunctions1(String)) case "failed" => s u::String toScale(l,s) == (u := option(l,'toScale)$DrawOptionFunctions1(Boolean)) case "failed" => s u::Boolean pointColorPalette(l,s) == (u := option(l,'pointColorPalette)$DrawOptionFunctions1(PAL)) case "failed" => s u::PAL curveColorPalette(l,s) == (u := option(l,'curveColorPalette)$DrawOptionFunctions1(PAL)) case "failed" => s u::PAL ranges(l, s) == (u := option(l,'ranges)$DrawOptionFunctions1(RANGE)) case "failed" => s u::RANGE space(l) == (u := option(l,'space)$DrawOptionFunctions1(SPACE3)) case "failed" => create3Space()$SPACE3 u::SPACE3 var1Steps(l,s) == (u := option(l,'var1Steps)$DrawOptionFunctions1(PositiveInteger)) case "failed" => s u::PositiveInteger var2Steps(l,s) == (u := option(l,'var2Steps)$DrawOptionFunctions1(PositiveInteger)) case "failed" => s u::PositiveInteger tubePoints(l,s) == (u := option(l,'tubePoints)$DrawOptionFunctions1(PositiveInteger)) case "failed" => s u::PositiveInteger tubeRadius(l,s) == (u := option(l,'tubeRadius)$DrawOptionFunctions1(Float)) case "failed" => s u::Float coord(l,s) == (u := option(l,'coord)$DrawOptionFunctions1(POINT->POINT)) case "failed" => s u::(POINT->POINT) units(l,s) == (u := option(l,'unit)$DrawOptionFunctions1(UNIT)) case "failed" => s u::UNIT @ \section{License} <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. --Copyright (C) 2007-2009, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are --met: -- -- - Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- - Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- -- - Neither the name of The Numerical ALgorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- --THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS --IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED --TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER --OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, --EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, --PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @ <<*>>= <> <> <> <> @ \eject \begin{thebibliography}{99} \bibitem{1} nothing \end{thebibliography} \end{document}