From 971726e18ccfe5ec927f33c052e20a06a84b8eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 9 Nov 2011 23:33:57 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20des=20diagrammes=20de=20Perlin=20N?= =?UTF-8?q?oise.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- presentation.tex | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/presentation.tex b/presentation.tex index ac66d25..b445e98 100644 --- a/presentation.tex +++ b/presentation.tex @@ -2,18 +2,7 @@ \usepackage[utf8]{inputenc} \usepackage[frenchb]{babel} \usepackage{hyperref} -% \hypersetup{% -% colorlinks,% -% citecolor=black,% -% filecolor=black,% -% linkcolor=black,% -% urlcolor=black% -% } \usepackage{tikz} -%\makeatletter\def\@makecaption{}\makeatother -%\usepackage[scriptsize]{caption} -%\captionsetup[figure]{labelformat=empty, labelsep=none} -%\renewcommand*{\figurename}{} \usetikzlibrary{shapes,positioning,snakes,calc,chains} \usetheme{Frankfurt} \usepackage{graphicx} @@ -35,17 +24,6 @@ \vskip0pt% } -%\defbeamertemplate*{caption}{numbered} -%{% -% \raggedright -% {% -% \usebeamercolor[fg]{caption name}% -% \usebeamerfont*{caption name}% -% \insertcaptionname~\insertcaptionnumber:____% -% } -% \insertcaption\par -%} - \AtBeginSection[] { \begin{frame} \frametitle{Plan} @@ -65,6 +43,18 @@ \section{Génération} +\def\dohash#1#2{ + \pgfmathsetmacro\hash{#1} + \pgfmathsetmacro\hashb{#2} + \pgfmathsetmacro\hash{mod((\hash+#1)*\hashb+0.37,1)} + \pgfmathsetmacro\hashb{(1+\hashb)*0.526} + \pgfmathsetmacro\hash{mod((\hash+#1)*\hashb+0.59,1)} + \pgfmathsetmacro\hashb{\hashb*0.415+42} + \pgfmathsetmacro\hash{mod((\hash+#1)*\hashb+0.23,1)} + \pgfmathsetmacro\hashb{\hashb*0.273+132} + \pgfmathsetmacro\hash{mod((\hash+#1*#1)*\hashb+0.78,1)} + \pgfmathsetmacro\hash{mod(\hash,1)} +} \subsection{Perlin noise} \begin{frame} \frametitle{Perlin noise} @@ -73,7 +63,14 @@ \begin{figure}[h] \centering \begin{tikzpicture} - \draw[draw=blue] (0,0) -- (1,1) -- (2,0); + \xdef\oldhash{0} + \xdef\oldi{0} + \foreach \i in {1,2,...,4}{ + \dohash{\i}{0} + \draw[draw=blue] (\oldi,\oldhash) -- (\i,\hash); + \xdef\oldhash{\hash} + \xdef\oldi{\i} + } \end{tikzpicture} \caption{Perlin noise} \end{figure}