diff --git a/books/bookvol10.4.pamphlet b/books/bookvol10.4.pamphlet index 2808767..8924ade 100644 --- a/books/bookvol10.4.pamphlet +++ b/books/bookvol10.4.pamphlet @@ -25214,6 +25214,151 @@ ExpressionTubePlot(): Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{package EXP3D Export3D} +<>= +)set break resume +)sys rm -f Export3D.output +)spool Export3D.output +)set message test on +)set message auto off +)clear all + +--S 1 of 1 +)show Export3D +--R Export3D is a package constructor +--R Abbreviation for Export3D is EXP3D +--R This constructor is exposed in this frame. +--R Issue )edit /tmp/export3D.spad to see algebra source code for EXP3D +--R +--R------------------------------- Operations -------------------------------- +--R writeObj : (SubSpace(3,DoubleFloat),String) -> Void +--R +--E 1 + +)spool +)lisp (bye) +@ +<>= +==================================================================== +Export3D examples +==================================================================== + +See Also: +o )show Export3D + +@ +\pagehead{Export3D}{EXP3D} +\pagepic{ps/v104export3d.ps}{EXP3D}{1.00} + +{\bf Exports:}\\ +\cross{EXP3D}{writeObj} + +<>= +)abbrev package EXP3D Export3D +++ Author: Martin Baker +++ Date: June, 2010 +++ Description: +++ This package provides support for exporting SubSpace and +++ ThreeSpace structures to files. + +EF ==> Expression Float +SBF ==> SegmentBinding Float +DF ==> DoubleFloat +I ==> Integer +PI ==> PositiveInteger +NNI ==> NonNegativeInteger +STR ==> String + +Export3D(): with + + writeObj:(SubSpace(3,DoubleFloat),String) -> Void + ++ writes 3D SubSpace to a file in Wavefront (.OBJ) format + + == add + import List List NNI + + -- return list of indexes + -- assumes subnodes are leaves containing index + faceIndex(subSp: SubSpace(3,DoubleFloat)):List NNI == + faceIndexList:List NNI := [] + for poly in children(subSp) repeat + faceIndexList := cons(extractIndex(poly),faceIndexList) + reverse faceIndexList + + -- called if this component contains a single polygon + -- write out face information for Wavefront (.OBJ) 3D file format + -- one face per line, represented by list of vertex indexes + writePolygon(f1:TextFile,curves: List SubSpace(3,DoubleFloat)):Void == + faceIndexList:List NNI := [] + for curve in curves repeat + faceIndexList := append(faceIndexList,faceIndex(curve)) + -- write out face information for Wavefront (.OBJ) 3D file format + -- one face per line, represented by list of vertex indexes + s:String := "f " + for i in faceIndexList repeat + s:=concat(s,string(i))$String + s:=concat(s," ")$String + writeLine!(f1,s) + + -- called if this component contains a mesh, the mesh will be rendered + -- as quad polygons. + -- write out face information for Wavefront (.OBJ) 3D file format + -- one face per line, represented by list of vertex indexes + writeMesh(f1:TextFile,curves: List SubSpace(3,DoubleFloat)):Void == + meshIndexArray:List List NNI := [] + for curve in curves repeat + -- write out face information for Wavefront (.OBJ) 3D file format + -- one face per line, represented by list of vertex indexes + meshIndexArray := cons(faceIndex(curve),meshIndexArray) + meshIndexArray := reverse meshIndexArray + rowLength := #meshIndexArray + colLength := #(meshIndexArray.1) + for i in 1..(rowLength-1) repeat + for j in 1..(colLength-1) repeat + --s1:String := concat["row ",string(i)," col ",string(j)] + --writeLine!(f1,s1) + s:String := concat ["f ",string((meshIndexArray.i).j)," ",_ + string((meshIndexArray.(i+1)).j)," ",_ + string((meshIndexArray.(i+1)).(j+1))," ",_ + string((meshIndexArray.i).(j+1))] + writeLine!(f1,s) + + toString(d : DoubleFloat) : String == + unparse(convert(d)@InputForm) + + -- this writes SubSpace geometry to Wavefront (.OBJ) 3D file format + -- reqires SubSpace to contain 3 or 4 dimensional points over DoubleFloat + -- to export a function plot try: + -- writeObj(subspace(makeObject(x*x-y*y,x=-1..1,y=-1..1)),"myfile.obj") + -- colour dimension is ignored + -- no normals or texture data is generated + writeObj(subSp: SubSpace(3,DoubleFloat), filename:String):Void == + f1:TextFile:=open(filename::FileName,"output") + writeLine!(f1,"# mesh generated by axiom") + -- write vertex data + verts := pointData(subSp) + for v in verts repeat + #v < 3 => error "Can't write OBJ file from 2D points" + writeLine!(f1,concat(["v ", toString(v.1), " ",_ + toString(v.2), " ", toString(v.3)])$String) + for component in children(subSp) repeat + curves := children(component) + if #curves < 2 then + sayTeX$Lisp "Can't write point or curve to OBJ file" + --writeLine!(f1,"new component") + if #curves > 1 then + if numberOfChildren(curves.1) = 1 then writePolygon(f1,curves) + if numberOfChildren(curves.1) > 1 then writeMesh(f1,curves) + close! f1 + +@ +<>= +"EXP3D" [color="#FF4488",href="bookvol10.4.pdf#nameddest=EXP3D"] +"STRING" [color="#88FF44",href="bookvol10.3.pdf#nameddest=STRING"] +"EXP3D" -> "STRING" + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{package E04AGNT e04AgentsPackage} \pagehead{e04AgentsPackage}{E04AGNT} \pagepic{ps/v104e04agentspackage.ps}{E04AGNT}{1.00} @@ -160147,6 +160292,7 @@ ZeroDimensionalSolvePackage(R,ls,ls2): Exports == Implementation where <> <> <> +<> <> <> diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 6672e69..fb71ff0 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -23925,6 +23925,7 @@ otherwise the new algebra won't be loaded by the interpreter when needed. (|ErrorFunctions| . ERROR) (|EuclideanGroebnerBasisPackage| . GBEUCLID) (|Exit| . EXIT) + (|Export3D| . EXP3D) (|Expression| . EXPR) (|ExpressionFunctions2| . EXPR2) (|ExpressionSolve| . EXPRSOL) diff --git a/books/ps/v104export3d.ps b/books/ps/v104export3d.ps new file mode 100644 index 0000000..73cabef --- /dev/null +++ b/books/ps/v104export3d.ps @@ -0,0 +1,266 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Graphviz version 2.20.2 (Mon Mar 30 10:09:11 UTC 2009) +%%For: (root) root +%%Title: pic +%%Pages: 1 +%%BoundingBox: 36 36 114 152 +%%EndComments +save +%%BeginProlog +/DotDict 200 dict def +DotDict begin + +/setupLatin1 { +mark +/EncodingVector 256 array def + EncodingVector 0 + +ISOLatin1Encoding 0 255 getinterval putinterval +EncodingVector 45 /hyphen put + +% Set up ISO Latin 1 character encoding +/starnetISO { + dup dup findfont dup length dict begin + { 1 index /FID ne { def }{ pop pop } ifelse + } forall + /Encoding EncodingVector def + currentdict end definefont +} def +/Times-Roman starnetISO def +/Times-Italic starnetISO def +/Times-Bold starnetISO def +/Times-BoldItalic starnetISO def +/Helvetica starnetISO def +/Helvetica-Oblique starnetISO def +/Helvetica-Bold starnetISO def +/Helvetica-BoldOblique starnetISO def +/Courier starnetISO def +/Courier-Oblique starnetISO def +/Courier-Bold starnetISO def +/Courier-BoldOblique starnetISO def +cleartomark +} bind def + +%%BeginResource: procset graphviz 0 0 +/coord-font-family /Times-Roman def +/default-font-family /Times-Roman def +/coordfont coord-font-family findfont 8 scalefont def + +/InvScaleFactor 1.0 def +/set_scale { + dup 1 exch div /InvScaleFactor exch def + scale +} bind def + +% styles +/solid { [] 0 setdash } bind def +/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def +/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def +/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def +/bold { 2 setlinewidth } bind def +/filled { } bind def +/unfilled { } bind def +/rounded { } bind def +/diagonals { } bind def + +% hooks for setting color +/nodecolor { sethsbcolor } bind def +/edgecolor { sethsbcolor } bind def +/graphcolor { sethsbcolor } bind def +/nopcolor {pop pop pop} bind def + +/beginpage { % i j npages + /npages exch def + /j exch def + /i exch def + /str 10 string def + npages 1 gt { + gsave + coordfont setfont + 0 0 moveto + (\() show i str cvs show (,) show j str cvs show (\)) show + grestore + } if +} bind def + +/set_font { + findfont exch + scalefont setfont +} def + +% draw text fitted to its expected width +/alignedtext { % width text + /text exch def + /width exch def + gsave + width 0 gt { + [] 0 setdash + text stringwidth pop width exch sub text length div 0 text ashow + } if + grestore +} def + +/boxprim { % xcorner ycorner xsize ysize + 4 2 roll + moveto + 2 copy + exch 0 rlineto + 0 exch rlineto + pop neg 0 rlineto + closepath +} bind def + +/ellipse_path { + /ry exch def + /rx exch def + /y exch def + /x exch def + matrix currentmatrix + newpath + x y translate + rx ry scale + 0 0 1 0 360 arc + setmatrix +} bind def + +/endpage { showpage } bind def +/showpage { } def + +/layercolorseq + [ % layer color sequence - darkest to lightest + [0 0 0] + [.2 .8 .8] + [.4 .8 .8] + [.6 .8 .8] + [.8 .8 .8] + ] +def + +/layerlen layercolorseq length def + +/setlayer {/maxlayer exch def /curlayer exch def + layercolorseq curlayer 1 sub layerlen mod get + aload pop sethsbcolor + /nodecolor {nopcolor} def + /edgecolor {nopcolor} def + /graphcolor {nopcolor} def +} bind def + +/onlayer { curlayer ne {invis} if } def + +/onlayers { + /myupper exch def + /mylower exch def + curlayer mylower lt + curlayer myupper gt + or + {invis} if +} def + +/curlayer 0 def + +%%EndResource +%%EndProlog +%%BeginSetup +14 default-font-family set_font +1 setmiterlimit +% /arrowlength 10 def +% /arrowwidth 5 def + +% make sure pdfmark is harmless for PS-interpreters other than Distiller +/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse +% make '<<' and '>>' safe on PS Level 1 devices +/languagelevel where {pop languagelevel}{1} ifelse +2 lt { + userdict (<<) cvn ([) cvn load put + userdict (>>) cvn ([) cvn load put +} if + +%%EndSetup +setupLatin1 +%%Page: 1 1 +%%PageBoundingBox: 36 36 114 152 +%%PageOrientation: Portrait +0 0 1 beginpage +gsave +36 36 78 116 boxprim clip newpath +1 1 set_scale 0 rotate 40 40 translate +% EXP3D +gsave +[ /Rect [ 3 72 67 108 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.4.pdf#nameddest=EXP3D) >> + /Subtype /Link +/ANN pdfmark +0.939 0.733 1.000 nodecolor +newpath 67 108 moveto +3 108 lineto +3 72 lineto +67 72 lineto +closepath fill +1 setlinewidth +filled +0.939 0.733 1.000 nodecolor +newpath 67 108 moveto +3 108 lineto +3 72 lineto +67 72 lineto +closepath stroke +0.000 0.000 0.000 nodecolor +14 /Times-Roman set_font +10.5 85.9 moveto 49 (EXP3D) alignedtext +grestore +% STRING +gsave +[ /Rect [ 0 0 70 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=STRING) >> + /Subtype /Link +/ANN pdfmark +0.273 0.733 1.000 nodecolor +newpath 70 36 moveto +0 36 lineto +0 0 lineto +70 0 lineto +closepath fill +1 setlinewidth +filled +0.273 0.733 1.000 nodecolor +newpath 70 36 moveto +0 36 lineto +0 0 lineto +70 0 lineto +closepath stroke +0.000 0.000 0.000 nodecolor +14 /Times-Roman set_font +8 13.9 moveto 54 (STRING) alignedtext +grestore +% EXP3D->STRING +gsave +1 setlinewidth +0.000 0.000 0.000 edgecolor +newpath 35 72 moveto +35 64 35 55 35 46 curveto +stroke +0.000 0.000 0.000 edgecolor +newpath 38.5 46 moveto +35 36 lineto +31.5 46 lineto +closepath fill +1 setlinewidth +solid +0.000 0.000 0.000 edgecolor +newpath 38.5 46 moveto +35 36 lineto +31.5 46 lineto +closepath stroke +grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +end +restore +%%EOF diff --git a/changelog b/changelog index 95138dc..49b7b79 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20100701 myb src/axiom-website/patches.html 20100701.02.myb.patch +20100701 myb src/algebra/Makefile test and help files for Export3D +20100701 myb books/bookvol5 expose Export3D +20100701 myb books/bookvol10.4 add Export3D +20100701 myb books/ps/v104export3d.ps graph Export3D 20100701 tpd src/axiom-website/patches.html 20100701.01.tpd.patch 20100701 tpd src/input/Makefile add paffexample.input for PAFF testing 20100701 tpd src/input/paffexample.input additional PAFF testing diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index b9cb8a8..bd287c5 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -5320,7 +5320,8 @@ LAYER11=\ ${OUT}/DSTREE.o \ ${OUT}/D01AJFA.o ${OUT}/D01AKFA.o ${OUT}/D01ALFA.o ${OUT}/D01AMFA.o \ ${OUT}/D01APFA.o ${OUT}/D01AQFA.o ${OUT}/EMR.o ${OUT}/EQ.o \ - ${OUT}/ERROR.o ${OUT}/EVALCYC.o ${OUT}/E04DGFA.o ${OUT}/E04FDFA.o \ + ${OUT}/ERROR.o ${OUT}/EVALCYC.o ${OUT}/EXP3D.o \ + ${OUT}/E04DGFA.o ${OUT}/E04FDFA.o \ ${OUT}/E04GCFA.o ${OUT}/E04JAFA.o ${OUT}/E04UCFA.o ${OUT}/FACUTIL.o \ ${OUT}/FF.o ${OUT}/FFCG.o ${OUT}/FFCGX.o ${OUT}/FFFG.o \ ${OUT}/FFFGF.o ${OUT}/FFHOM.o ${OUT}/FFNB.o ${OUT}/FFNBX.o \ @@ -6028,6 +6029,23 @@ LAYER11=\ /*"EVALCYC" -> "CHARNZ"*/ "EVALCYC" -> "PFECAT" +"EXP3D" [color="#FF4488",href="bookvol10.4.pdf#nameddest=EXP3D"] +"EXP3D" -> "STRING" +/*"EXP3D" -> {"FPS"; "RNS"; "FIELD"; "EUCDOM"; "PID"; "GCDDOM"; "INTDOM"; }*/ +/*"EXP3D" -> {"COMRING"; "RING"; "RNG"; "ABELGRP"; "CABMON"; "ABELMON"}*/ +/*"EXP3D" -> {"ABELSG"; "SETCAT"; "BASTYPE"; "KOERCE"; "SGROUP"; "MONOID"}*/ +/*"EXP3D" -> {"LMODULE"; "BMODULE"; "RMODULE"; "ALGEBRA"; "MODULE"}*/ +/*"EXP3D" -> {"ENTIRER"; "UFD"; "DIVRING"; "ORDRING"; "OAGROUP"; "OCAMON"}*/ +/*"EXP3D" -> {"OAMON"; "OASGP"; "ORDSET"; "REAL"; "KONVERT"; "RETRACT"}*/ +/*"EXP3D" -> {"RADCAT"; "PATMAB"; "CHARZ"; "INT"; "LIST"; "ILIST"; "CHAR"}*/ +/*"EXP3D" -> {"SINT"; "OUTFORM"; "PRIMARR"; "A1AGG-"; "ISTRING"; "LSAGG"}*/ +/*"EXP3D" -> {"STAGG"; "URAGG"; "RCAGG"; "HOAGG"; "AGG"; "TYPE"; "EVALAB"}*/ +/*"EXP3D" -> {"IEVALAB"; "LNAGG"; "IXAGG"; "ELTAGG"; "ELTAB"; "CLAGG"}*/ +/*"EXP3D" -> {"FLAGG"; "ELAGG"; "OM"; "NNI"; "LSAGG-"; "STAGG-"; "ELAGG-"}*/ +/*"EXP3D" -> {"FLAGG-"; "URAGG-"; "LNAGG-"; "RCAGG-"; "IXAGG-"; "CLAGG-"}*/ +/*"EXP3D" -> {"HOAGG-"; "ORDSET-"; "AGG-"; "ELTAGG-"; "SETCAT-"; "BASTYPE-"}*/ +/*"EXP3D" -> {"DFLOAT"; "PTCAT"; "VECTCAT"; "A1AGG"; "PI"}*/ + "E04DGFA" [color="#88FF44",href="bookvol10.3.pdf#nameddest=E04DGFA"] /*"E04DGFA" -> {"OPTCAT"; "SETCAT"; "BASTYPE"; "KOERCE"; "FPS"; "RNS"}*/ /*"E04DGFA" -> {"FIELD"; "EUCDOM"; "PID"; "GCDDOM"; "INTDOM"; "COMRING"}*/ @@ -17320,6 +17338,7 @@ SPADHELP=\ ${HELP}/EuclideanGroebnerBasisPackage.help \ ${HELP}/EuclideanModularRing.help \ ${HELP}/Evalable.help \ + ${HELP}/Export3D.help \ ${HELP}/Expression.help \ ${HELP}/ExpressionSpace.help \ ${HELP}/ExponentialExpansion.help \ @@ -17521,7 +17540,6 @@ SPADHELP=\ ${HELP}/MappingPackage1.help \ ${HELP}/MappingPackage2.help \ ${HELP}/MappingPackage3.help \ - ${HELP}/MathMLFormat.help \ ${HELP}/Matrix.help \ ${HELP}/MatrixCategory.help \ ${HELP}/ModMonic.help \ @@ -18006,6 +18024,7 @@ REGRESS= \ EuclideanGroebnerBasisPackage.regress \ EuclideanModularRing.regress \ Evalable.regress \ + Export3D.regress \ Expression.regress \ ExpressionSpace.regress \ ExponentialExpansion.regress \ @@ -18207,7 +18226,6 @@ REGRESS= \ MappingPackage1.regress \ MappingPackage2.regress \ MappingPackage3.regress \ - MathMLFormat.regress \ Matrix.regress \ MatrixCategory.regress \ ModMonic.regress \ @@ -20363,6 +20381,18 @@ ${HELP}/Equation.help: ${BOOKS}/bookvol10.3.pamphlet >${INPUT}/Equation.input @echo "Equation (EQ)" >>${HELPFILE} +${HELP}/Export3D.help: ${BOOKS}/bookvol10.4.pamphlet + @echo 5000 create Export3D.help from \ + ${BOOKS}/bookvol10.4.pamphlet + @${TANGLE} -R"Export3D.help" \ + ${BOOKS}/bookvol10.4.pamphlet \ + >${HELP}/Export3D.help + @cp ${HELP}/Export3D.help ${HELP}/EXP3D.help + @${TANGLE} -R"Export3D.input" \ + ${BOOKS}/bookvol10.4.pamphlet \ + >${INPUT}/Export3D.input + @echo "Export3D (EXP3D)" >>${HELPFILE} + ${HELP}/ExpressionSpace.help: ${BOOKS}/bookvol10.2.pamphlet @echo 5000 create ExpressionSpace.help from \ ${BOOKS}/bookvol10.2.pamphlet @@ -22777,15 +22807,6 @@ ${HELP}/MakeFunction.help: ${BOOKS}/bookvol10.4.pamphlet >${INPUT}/MakeFunction.input @echo "MakeFunction (MKFUNC)" >>${HELPFILE} -${HELP}/MathMLFormat.help: ${BOOKS}/bookvol10.3.pamphlet - @echo 7595 create MathMLFormat.help from ${BOOKS}/bookvol10.3.pamphlet - @${TANGLE} -R"MathMLFormat.help" ${BOOKS}/bookvol10.3.pamphlet \ - >${HELP}/MathMLFormat.help - @cp ${HELP}/MathMLFormat.help ${HELP}/MMLFORM.help - @${TANGLE} -R"MathMLFormat.input" ${BOOKS}/bookvol10.3.pamphlet \ - >${INPUT}/MathMLFormat.input - @echo "MathMLFormat (MMLFORM)" >>${HELPFILE} - ${HELP}/MappingPackage1.help: ${BOOKS}/bookvol10.4.pamphlet @echo 7600 create MappingPackage1.help from \ ${BOOKS}/bookvol10.4.pamphlet diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index b751994..f0f9e15 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2956,7 +2956,9 @@ src/algebra/Makefile remove new algebra scaffolding code
src/input/hyperell.input additional PAFF testing
20100630.02.tpd.patch src/input/exampleagcode.input additional PAFF testing
-20100701.01.tpd.patch +20100701.01.tpd.patch src/input/paffexample.input additional PAFF testing
+20100701.02.myb.patch +books/bookvol10.4 add Export3D