Browse Source

added sphere-cylinder intersection

Martin Thoma 12 years ago
parent
commit
4f8837d107

+ 37 - 0
pstricks/sphere-cylinder/Makefile

@@ -0,0 +1,37 @@
+SOURCE = sphere-cylinder
+DELAY = 80
+DENSITY = 300
+WIDTH = 512
+
+make:
+	latex $(SOURCE).tex -output-format=pdf
+	dvips -D600 $(SOURCE).dvi -o $(SOURCE).ps
+	ps2pdf $(SOURCE).ps $(SOURCE).pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.dvi *.ps
+
+gif:
+	pdfcrop $(SOURCE).pdf
+	convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
+	make clean
+
+png:
+	make
+	make svg
+	inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
+
+transparentGif:
+	convert $(SOURCE).pdf -transparent white result.gif
+	make clean
+
+svg:
+	make
+	#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
+	pdf2svg $(SOURCE).pdf $(SOURCE).svg
+	# Necessary, as pdf2svg does not always create valid svgs:
+	inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
+	rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
+	inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
+	rm $(SOURCE)2.svg

+ 5 - 0
pstricks/sphere-cylinder/Readme.md

@@ -0,0 +1,5 @@
+This is an example from `pst-solides3d` documentation.
+
+Compiled example
+----------------
+![Example](sphere-cylinder.png)

BIN
pstricks/sphere-cylinder/sphere-cylinder.png


+ 36 - 0
pstricks/sphere-cylinder/sphere-cylinder.tex

@@ -0,0 +1,36 @@
+\documentclass[pstricks,border=2pt]{standalone}
+\usepackage{pst-solides3d}  
+\begin{document}
+\psset{
+    unit=0.5,
+    lightsrc=50 -50 50,
+    viewpoint=100 0 0 rtp2xyz,
+    Decran=110,
+    linewidth=0.5\pslinewidth
+}
+\begin{pspicture}(-7,-6)(6,6)
+\defFunction{F}(t){
+    t cos dup mul 5 mul
+}{t cos t sin mul 5 mul}{t sin 5 mul}
+
+\codejps{%
+    /cylindre1 {
+        -5 2.5 5 [36 36] newcylindre
+        {2.5 0 0 translatepoint3d} solidtransform
+        dup (White) outputcolors
+    } def
+    /sphere1 {
+        5 [36 72] newsphere
+        dup (White) outputcolors
+    } def
+    /CS {cylindre1 sphere1 solidfuz} def
+    CS drawsolid**
+}
+\psPoint(0,0,0){O}
+\psSolid[object=courbe,r=0,
+    function=F,
+    range=0 360,
+    linecolor=red,
+    linewidth=4\pslinewidth]
+\end{pspicture}
+\end{document}