No. 1 Three-Dimensional Graphics with Tikz/Pstricks and the Help Of
Total Page:16
File Type:pdf, Size:1020Kb
TUGboat, Volume 0 (9999), No. 0 preliminary draft, December 27, 2017 18:02 ? 1 60 TUGboat, Volume 39 (2018), No. 1 Three-dimensional graphics with An interesting and detailed introduction to the TikZ/PSTricks and the help of Geogebra problem of producing three-dimensional graphics Three-dimensional graphics with with Ti kkZ can be found in an article by Keith Wol- Luciano Battaia TikZ/PSTricks and the help of GeoGebra cott [ [55],]. and It was actually in fact it was the just reading the reading of this ofarticle this that led us to study the problem in order to find AbstractLuciano Battaia article that led us to study the problem in order to finda more a more accessible affordable solution. solution. Wolcott's This article ends In this article we consider the opportunity of using a Abstract indeedwith a figure with a which figure shows that only shows the the partial onlysolution partial so- of dynamical geometry software like Geogebra in order what had been the main purpose of the project: the In this article we consider the opportunity of using lution of what was the main purpose of the project: to allow an easy export of three-dimensional geomet- drawing of two spheres and their circle of intersection. dynamic geometry software, such as GeoGebra, to the drawing of two spheres and their circle of inter- ric pictures, with subsequent 2D parallel projection, The author himself points out that the figure needs allow easy exporting of three-dimensional geometric section. Wolcott himself points out that the figure in PGF/TikZ or PSTricks code. The help of a software more work. pictures, with subsequent 2D parallel projection, in needs more work. like Geogebra makes easy enough the production of This is the reason why we begin this article PGF/TikZ or PSTricks code. The help of software like That’s the reason why we begin this article with very complex pictures in LATEX code, having only a with figure 1, which exactly reaches Wolcott's goal. GeoGebra considerably simplifies the production of figure 1 that exactly reaches Wolcott’s goal. Expla- basic knowledge of PGF/TikZ or PSTricks languages Explanations on how we obtain it will be given later, A nations on how to obtain it will be given later, but andvery taking complex advantage pictures of in a L programmingTEX code, requiring substantially only a webut immediately we immediately point point out thatout that our approachour approach to the to mousebasic knowledge driven. All of examplesPGF/TikZ and or samplePSTricks codes languages are in problemthe problem is completely is completely different different from from Wolcott’s Wolcott's. one. PGF/Tiand takingkZ, advantage but almost of nothing a substantially changesmouse if one prefers driven PSTricksprogram.. All examples and sample code here are in PGF/TikZ, but almost nothing changes if one prefers PSTricks. 1 Introduction The1 Introduction need for high quality vector graphics in LATEX documents, in particular with labels in the same A styleLTEX as users, the document, particularly has those always writing been scientific an essential pa- requestpers, have by always all users, had above a need all for for high-quality scientific papers. vector graphics,There including is no special labels, problem that fit in the casestyle of of two- the dimensionalrest of their graphics,documents. and the two most widespread toolsTherePSTricks is noand specialPGF/Ti problemkZ (that in from the case now onof two- will dimensional graphics, and the two most widespread only be mentioned shortly as TikZ), together with Figure 1: The intersection of two spheres with the theirtools derivedPSTricks packages, and PGF solve/Tik almostZ (that every from problem now on Figure 1: The intersection of two spheres with the circle of intersection verywill only well. be As mentioned shown by Claudio merely Beccari as TikZ), [2], together in many with their derived packages, solve almost every prob- situations the use of the basic LATEX picture envi- For the sake of completeness, we would like to lem very well. As Claudio Beccari has shown [2], For the sake of completeness, we mention that ronment is sufficient, without any intervention of point out that a slightly different version of this A a slightly different version of this article, in Italian, externalLTEX's basic packages.picture environment is sufficient for article,can be foundin Italian, in [1]. can be found in [1]. manyThings situations. change a lot if we are interested in three- Things change substantially if we are interested 2 The coming of Geogebra on the scene dimensional graphics. Plots of two variables func- 2 The coming of GeoGebra on the scene tionsin three-dimensional and of various graphics. kinds of Plots surfaces of two-variable can easily For educational reasons we have been using Geogebra befunctions handled and using of various dedicated kinds packages, of surfaces for can instance easily forFor a educational long time, reasonsboth because we have its been non-commercial using GeoGebra use pst3dplotbe handledor pgfplots using dedicated. Also for packages, geometric figuresfor instance some isfor free a long and time, because both its because basic use its isnon-commercial extremely simple. use verypst3dplot interestingor pgfplots packages. Also, are for available, geometric for figures exam- Withis free reference and because to the its problem basic use we is extremelyare dealing simple. with, plesomepst-solides3d very interestingor pst-3d packagesin the arePSTricks available,family for ex- or Withthe interesting reference thing to the is problem the possibility we are ofdealing producing with, tikz-3dplotample pst-solides3din the TikorZ family,pst-3d in but the inPST all casesricks a family some- complexthe interesting two-dimensional thing is the figures possibility and exporting of producing them whator tikz-3dplot deep knowledgein the Ti ofkZ programming family, but techniquesin all cases in a incomplexPSTricks two-dimensionalor TikZ code, figures that can and thenexporting be copied them PSTricksrather deepor Ti knowledgekZ is needed of programming and, in our opinion, techniques this andin PST pastedricks directly or TikZ in code, a LAT thatX source can then with be only copied very EA isin notPST easyricks at or all Ti forkZ the is needed average and, user. in our opinion, limitedand pasted adaptations, directly into mainly a LT regardindEX source the with correct only this isExternal not at all programs easy for that the average produce user.PSTricks or labelvery limited positioning. adaptations, The required mainly knowledge regarding of correct LAT X A E TikZExternalcodes can programs help, for instancethat produceSketchPSTbyricks Eugene or packageslabel positioning. is minimal The and required affordable knowledge for even of inexpe- LTEX TikZ codes can help, for instance Sketch by Eugene packages is minimal and manageable for even in- Ressler, see for example [3], or TEXgraph by Patrick rienced users. Substantially you can produce even Ressler (see for example [3]) and T Xgraph by Patrick experienced users. In short, anyone can produce Fradin (http://texgraph.tuxfamily.org/E ). The complex figures to be included in LATEX documents texgraph.tuxfamily.org/ A lastFradin one ( in particular is very powerful). Theand can last also one witheven acomplexWYSIWYG figurestechnique to be included and extensively in LTEX usingdocu- producein particularPOV-Ray is verycode, powerful but, again, and can it isalso not produce within thements mouse. with This a WYSIWYG seems fartechnique enough from and what extensively a LAT X A E POV-Rthe reachay code, of most but, users. again, Almost it is not the within same the remarks reach userusing normally the mouse. does, This but seems we think far from that what in the a L caseTEX applyof most to users.Asymptote Almost, whose the codesame can remarks be directly apply in- to ofuser graphics normally this does, strategy but we should think that be preferred. in the case Of of Asymptotecluded in a, L whoseAT X source code can through be directly the asymptote includedpack- in a coursegraphics one this must strategy know is Geogebra preferable well for enough, many users. but A E age.LTEX source through the asymptote package. thisOf course does not one require must theknow study GeoGebra of long andwell complex enough, An interesting and detailed introduction to the but this does not require the study of long and com- preliminaryproblem of draft, producing December three-dimensional 27, 2017 18:02 graphics plex handbooks preliminary and, draft, at any December rate, dynamic 27, 2017 geometry 18:02 Luciano Battaia ? 2 preliminary draft, December 27, 2017 18:02 TUGboat, Volume 0 (9999), No. 0 TUGboat, Volume 39 (2018), No. 1 61 handbooks and, at any rate, a software of dynamic softwaregeometry is is of of great great help help to in experiment experimenting the construc- with the constructiontion of technical of technical figures. An figures. example An of example a complex of a complex2D figure2D easilyfigure produced easily produced in Geogebra in GeoGebra and exported and exportedin TikZ almost into Ti withoutkZ almost any withoutintervention intervention in the code in theis proposed generated in code figure is 2. shown in figure 2. ∆x Strain P0 Time Figure 3: Sphere with meridians and parallels, 0 U Time produced with code exported from Geogebra U0 Strain Excitation Excitation Figure 3: Sphere with meridians and parallels, producedThe two by pictures Tomasz Trzeciak are almost using identicalPGF/Ti butkZ the TikZ codes are indeed completely different: you can compare