From ab8cc85adde879fb963c94d15675783f2cf4b183 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 14 Aug 2007 05:14:52 +0000 Subject: Initial population. --- src/graph/view3D/stuff3d.c.pamphlet | 201 ++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 src/graph/view3D/stuff3d.c.pamphlet (limited to 'src/graph/view3D/stuff3d.c.pamphlet') diff --git a/src/graph/view3D/stuff3d.c.pamphlet b/src/graph/view3D/stuff3d.c.pamphlet new file mode 100644 index 00000000..f9ae2ff6 --- /dev/null +++ b/src/graph/view3D/stuff3d.c.pamphlet @@ -0,0 +1,201 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/graph/view3D stuff3d.c} +\author{The Axiom Team} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +\section{License} +<>= +/* +Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +@ +<<*>>= +<> + +#define _STUFF3D_C +#include "axiom-c-macros.h" +#include "useproto.h" + +#include "header.h" + +#include +#include +#include + + + +#include "Gfun.H1" +#include "spadcolors.H1" +#include "util.H1" + +#include "all_3d.H1" +/***************************** + *** traverse(n) *** + *** returns the nth point *** + *** in a point resevoir *** + *****************************/ + +viewTriple * +#ifdef _NO_PROTO +traverse (n) + int n; +#else +traverse (int n) +#endif +{ + + int i; + viewTriple *v; + + v = splitPoints; + for (i=0; inext; + return(v); + +} /* traverse */ + + +/**************************/ +/*** float absolute(x) ***/ +/**************************/ + +float +#ifdef _NO_PROTO +absolute (x) + float x; +#else +absolute (float x) +#endif +{ + + if (x<0.0) return(-x); + else return(x); + +} + + + + +/****************************/ +/*** float get_random(x) ***/ +/****************************/ + +float +#ifdef _NO_PROTO +get_random() +#else +get_random(void) +#endif +{ + + float x; + + x = (float)(rand() % 100); + return(x); + +} + + + + +/****************************/ +/*** float norm_dist() ***/ +/****************************/ + +triple +#ifdef _NO_PROTO +norm_dist() +#else +norm_dist(void) +#endif +{ + + float u1, u2, v1, v2, ss, rad; + triple pert; + + ss = 2.0; + while (ss >= 1.0) { + u1 = get_random()/100.0; + u2 = get_random()/100.0; + v1 = 2.0*u1 - 1.0; v2 = 2.0*u2 - 1.0; + ss = v1*v1 + v2*v2; + } + if (ss == 0.0) ss += .1; + rad = -2.0*log(ss)/ss; + pert.x = v1 * sqrt(rad); + pert.y = v2 * sqrt(rad); + + return(pert); +} + + + +/************************/ +/*** void goodbye() ***/ +/************************/ + +void +#ifdef _NO_PROTO +goodbye(sig) +int sig; +#else +goodbye(int sig) +#endif +{ + + int Command; + + PSClose(); /* free PS file and data structure space */ + + if (pixelSetFlag) FreePixels(dsply,colorMap,smoothConst); + if (!viewAloned) { + Command = viewportClosing; + check(write(Socket,&Command,intSize)); + } + + XCloseDisplay(dsply); + exit(0); +} /* goodbye */ + + + +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} -- cgit v1.2.3