Explorar o código

added 3d function plots

Martin Thoma %!s(int64=13) %!d(string=hai) anos
pai
achega
96888a7dce

+ 31 - 0
tikz/hypersurface-2/Makefile

@@ -0,0 +1,31 @@
+SOURCE = hypersurface-2
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	pdflatex $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
+
+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:
+	#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

+ 49 - 0
tikz/hypersurface-2/hypersurface-2.tex

@@ -0,0 +1,49 @@
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+\setlength\PreviewBorder{2mm}
+\usepackage{pgfplots}
+\usepackage{units}
+\pgfplotsset{compat=1.3}% <-- moves axis labels near ticklabels
+                        % (respects tick label widths)
+\usepackage{tikz}
+\usetikzlibrary{arrows, positioning, calc, intersections, decorations.markings}
+
+\usepackage{xcolor}
+\definecolor{horizontalLineColor}{HTML}{008000}
+\definecolor{verticalLineColor}{HTML}{FF0000}
+ 
+\begin{document}
+
+% Define this as a command to ensure that it is same in both cases
+\newcommand*{\ShowIntersection}[2]{
+\fill 
+    [name intersections={of=#1 and #2, name=i, total=\t}] 
+    [red, opacity=1, every node/.style={above left, black, opacity=1}] 
+    \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
+        node [above left] {\s}};
+}
+
+\begin{preview}
+\begin{tikzpicture}
+    \begin{axis}[
+        grid=both,
+        minor tick num=1,
+        xlabel=$x$,
+        ylabel=$y$,
+        zlabel=$z$,
+        %label distance=0mm,
+        %width=8cm, height=7cm,     % size of the image
+        xmin=-5,   % start the diagram at this x-coordinate
+        xmax= 5,   % end   the diagram at this x-coordinate
+        ymin=-5,   % start the diagram at this y-coordinate
+        ymax= 5,   % end   the diagram at this y-coordinate
+        axis lines=left,
+        %tick style={draw=none},
+        %xticklabels={,,},
+        %yticklabels={,,}
+    ]
+      \addplot3[surf] {3*x*x-y*y-9*x+1};
+    \end{axis} 
+\end{tikzpicture}
+\end{preview}
+\end{document}

+ 31 - 0
tikz/hypersurface-3/Makefile

@@ -0,0 +1,31 @@
+SOURCE = hypersurface-3
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	pdflatex $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
+
+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:
+	#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

+ 45 - 0
tikz/hypersurface-3/hypersurface-3.tex

@@ -0,0 +1,45 @@
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+\setlength\PreviewBorder{2mm}
+\usepackage{pgfplots}
+\usepackage{units}
+\pgfplotsset{compat=1.3}% <-- moves axis labels near ticklabels
+                        % (respects tick label widths)
+\usepackage{tikz}
+\usetikzlibrary{arrows, positioning, calc, intersections, decorations.markings}
+
+\usepackage{xcolor}
+\definecolor{horizontalLineColor}{HTML}{008000}
+\definecolor{verticalLineColor}{HTML}{FF0000}
+ 
+\begin{document}
+
+% Define this as a command to ensure that it is same in both cases
+\newcommand*{\ShowIntersection}[2]{
+\fill 
+    [name intersections={of=#1 and #2, name=i, total=\t}] 
+    [red, opacity=1, every node/.style={above left, black, opacity=1}] 
+    \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
+        node [above left] {\s}};
+}
+
+\begin{preview}
+\begin{tikzpicture}
+    \begin{axis}[
+        grid=both,
+        minor tick num=1,
+        xlabel=$x$,
+        ylabel=$y$,
+        zlabel=$z$,
+        %label distance=0mm,
+        %width=8cm, height=7cm,     % size of the image
+        axis lines=left,
+        %tick style={draw=none},
+        %xticklabels={,,},
+        %yticklabels={,,}
+    ]
+      \addplot3[surf] {-3/25*x*x+1/25*y*y};
+    \end{axis} 
+\end{tikzpicture}
+\end{preview}
+\end{document}

+ 31 - 0
tikz/hypersurface-order-2/Makefile

@@ -0,0 +1,31 @@
+SOURCE = hypersurface-order-2
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	pdflatex $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
+
+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:
+	#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

+ 49 - 0
tikz/hypersurface-order-2/hypersurface-order-2.tex

@@ -0,0 +1,49 @@
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+\setlength\PreviewBorder{2mm}
+\usepackage{pgfplots}
+\usepackage{units}
+\pgfplotsset{compat=1.3}% <-- moves axis labels near ticklabels
+                        % (respects tick label widths)
+\usepackage{tikz}
+\usetikzlibrary{arrows, positioning, calc, intersections, decorations.markings}
+
+\usepackage{xcolor}
+\definecolor{horizontalLineColor}{HTML}{008000}
+\definecolor{verticalLineColor}{HTML}{FF0000}
+ 
+\begin{document}
+
+% Define this as a command to ensure that it is same in both cases
+\newcommand*{\ShowIntersection}[2]{
+\fill 
+    [name intersections={of=#1 and #2, name=i, total=\t}] 
+    [red, opacity=1, every node/.style={above left, black, opacity=1}] 
+    \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
+        node [above left] {\s}};
+}
+
+\begin{preview}
+\begin{tikzpicture}
+    \begin{axis}[
+        grid=both,
+        minor tick num=1,
+        xlabel=$x$,
+        ylabel=$y$,
+        zlabel=$z$,
+        %label distance=0mm,
+        %width=8cm, height=7cm,     % size of the image
+        xmin=-5,   % start the diagram at this x-coordinate
+        xmax= 5,   % end   the diagram at this x-coordinate
+        ymin=-5,   % start the diagram at this y-coordinate
+        ymax= 5,   % end   the diagram at this y-coordinate
+        axis lines=left,
+        %tick style={draw=none},
+        %xticklabels={,,},
+        %yticklabels={,,}
+    ]
+      \addplot3[surf] {x*x-4*x*y+y*y+1};
+    \end{axis} 
+\end{tikzpicture}
+\end{preview}
+\end{document}