sync
This commit is contained in:
parent
50c8bafd9f
commit
ac06c97e30
820 changed files with 467502 additions and 386453 deletions
|
@ -25,12 +25,12 @@ static const char sccsid[] = "@(#)anemone.c 5.22 2006/03/04 xlockmore";
|
|||
| DESCRIPTION Anemone.
|
||||
|
|
||||
| WRITTEN BY Gabriel Finch
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
| MODIFICATIONS june 2001 started
|
||||
| March 2006 adaption for xlockmore
|
||||
|
|
||||
|
|
||||
+----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -251,7 +251,7 @@ initAppendages(anemonestruct *sp)
|
|||
{
|
||||
int i;
|
||||
/*int marginx, marginy; */
|
||||
|
||||
|
||||
/*double scalex, scaley;*/
|
||||
|
||||
double x,y,z,dist;
|
||||
|
@ -298,7 +298,7 @@ initAppendages(anemonestruct *sp)
|
|||
sp->vCurr->sy=(int) ((sp->vCurr->y-sp->my/2)/5);
|
||||
sp->vCurr->sz=(int) (sp->vCurr->z/5);
|
||||
|
||||
|
||||
|
||||
sp->vNext->x=sp->vCurr->x+sp->vCurr->sx;
|
||||
sp->vNext->y=sp->vCurr->y+sp->vCurr->sy;
|
||||
sp->vNext->z=sp->vCurr->z+sp->vCurr->sz;
|
||||
|
@ -358,7 +358,7 @@ initAnemone( ModeInfo * mi , anemonestruct *sp )
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
sp->b= sp->window;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ createPoints(anemonestruct *sp)
|
|||
if (!(--sp->aCurr->growth)) sp->aCurr->growth=-NRAND(sp->finpoints)-1;
|
||||
sp->vCurr = sp->vPendage + (sp->finpoints + 1) * i + sp->aCurr->numpt-1;
|
||||
if (sp->aCurr->numpt<sp->finpoints - 1) {
|
||||
/* add a piece */
|
||||
/* add a piece */
|
||||
sp->vNext=sp->vCurr + 1;
|
||||
sp->aCurr->numpt++;
|
||||
sp->vNext->sx=sp->vCurr->sx+NRAND(3)-1;
|
||||
|
@ -417,7 +417,7 @@ drawImage(Drawable curr_window, double sint, double cost , anemonestruct *sp)
|
|||
|
||||
if ((numpt=sp->aCurr->numpt)==1) return;
|
||||
XSetForeground(sp->dpy, sp->gcDraw, sp->aCurr->col);
|
||||
|
||||
|
||||
sp->vNext=sp->vCurr+1;
|
||||
|
||||
cx=sp->vCurr->x;
|
||||
|
@ -500,11 +500,11 @@ init_anemone(ModeInfo * mi)
|
|||
|
||||
animateAnemone( sp->b , sp );
|
||||
}
|
||||
|
||||
|
||||
void draw_anemone (ModeInfo * mi)
|
||||
{
|
||||
anemonestruct *sp = &anemones[MI_SCREEN(mi)];
|
||||
|
||||
|
||||
if (anemones == NULL)
|
||||
return;
|
||||
MI_IS_DRAWN(mi) = True;
|
||||
|
|
|
@ -562,10 +562,10 @@ drawadot(ModeInfo * mi, int startx, int starty, int filled)
|
|||
dclockstruct *dp = &dclocks[MI_SCREEN(mi)];
|
||||
|
||||
if (filled)
|
||||
XFillArc(display, dp->pixmap, dp->fgGC, startx, starty,
|
||||
XFillArc(display, dp->pixmap, dp->fgGC, startx, starty,
|
||||
BINARY_WIDTH, BINARY_HEIGHT, 0, 23040);
|
||||
else
|
||||
XDrawArc(display, dp->pixmap, dp->fgGC, startx, starty,
|
||||
XDrawArc(display, dp->pixmap, dp->fgGC, startx, starty,
|
||||
BINARY_WIDTH, BINARY_HEIGHT, 0, 23040);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ static const char sccsid[] = "@(#)deluxe.c 5.22 2006/03/07 xlockmore";
|
|||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. No representations are made about the suitability of this
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* implied warranty.
|
||||
*
|
||||
*
|
||||
* adapted for xlockmore : March 2006
|
||||
*/
|
||||
|
||||
|
@ -66,11 +66,11 @@ static const char sccsid[] = "@(#)deluxe.c 5.22 2006/03/07 xlockmore";
|
|||
#define DEF_TRANSPARENT "False"
|
||||
#define DEF_DB "True"
|
||||
#ifdef HAVE_DOUBLE_BUFFER_EXTENSION
|
||||
#define DEF_USEDBECLEAR "True"
|
||||
#define DEF_USEDBECLEAR "True"
|
||||
#endif
|
||||
#define DEF_MONO "False"
|
||||
#define DEF_PLANES "0"
|
||||
|
||||
|
||||
static int st_thickness;
|
||||
static int st_speed;
|
||||
static Bool st_transparent;
|
||||
|
@ -179,7 +179,7 @@ static void
|
|||
free_deluxe(Display *dpy, deluxestruct *dlp)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < dlp->count; i++)
|
||||
if ( dlp->throbbers[i] )
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ void draw_deluxe (ModeInfo * mi)
|
|||
Display *dpy = MI_DISPLAY(mi);
|
||||
Window window = MI_WINDOW(mi);
|
||||
int i;
|
||||
|
||||
|
||||
if (deluxes == NULL)
|
||||
return;
|
||||
MI_IS_DRAWN(mi) = True;
|
||||
|
|
|
@ -19,7 +19,7 @@ http://www.math.missouri.edu/\~{}stephen}
|
|||
|
||||
\maketitle
|
||||
|
||||
This document describes a program I wrote to simulate the
|
||||
This document describes a program I wrote to simulate the
|
||||
two dimensional Euler Equation --- a program that is part
|
||||
of the {\tt xlock} screensaver as the {\tt euler2d}
|
||||
mode. A similar explanation may also be found in the
|
||||
|
@ -106,7 +106,7 @@ unusual initial distribution for the vorticity --- that the
|
|||
vorticity is a finite sum of dirac delta masses.
|
||||
\[ w(0,x) = \sum_{k=1}^N w_k \delta(x-x_k(0)) .\]
|
||||
Here $x_k(0)$ is the initial place where the points
|
||||
of vorticity are concentrated, with values $w_k$.
|
||||
of vorticity are concentrated, with values $w_k$.
|
||||
Then at time $t$, the vorticity becomes
|
||||
\[ w(t,x) = \sum_{k=1}^N w_k \delta(x-x_k(t)) .\]
|
||||
The points of fluid $x_k(t)$ are pushed by the
|
||||
|
@ -132,7 +132,7 @@ the equations become
|
|||
|
||||
We solve this $2N$ system of equations using standard
|
||||
numerical methods, in our case, using the second order midpoint method
|
||||
for the first step, and thereafter using the second order Adams-Bashforth
|
||||
for the first step, and thereafter using the second order Adams-Bashforth
|
||||
method. (See for example the book
|
||||
by Burden and Faires \cite{BF}).
|
||||
|
||||
|
@ -142,8 +142,8 @@ The computer program solves equation (\ref{tildex-p1}), and displays
|
|||
the results on the screen, with a boundary. All the information
|
||||
for solving the equation and displaying the output is countained
|
||||
in the structure {\tt euler2dstruct}. Let us describe some of
|
||||
the fields in {\tt euler2dstruct}.
|
||||
The points $\tilde x_k$ are contained
|
||||
the fields in {\tt euler2dstruct}.
|
||||
The points $\tilde x_k$ are contained
|
||||
in {\tt double *x}: with the coordinates of
|
||||
$\tilde x_k$ being the two numbers
|
||||
{\tt x[2*k+0]}, {\tt x[2*k+1]}. The values $w_k$ are contained
|
||||
|
@ -178,13 +178,13 @@ Here, and in the rest of this discussion, $R_{a,b}$ is a function
|
|||
that returns a random variable uniformly distributed over the interval
|
||||
$[a,b]$.
|
||||
|
||||
This works fine for $\Delta$, but for $p(\Delta)$, the points
|
||||
This works fine for $\Delta$, but for $p(\Delta)$, the points
|
||||
$p(\tilde x_k)$ are not uniformly distributed over $p(\Delta)$,
|
||||
but are distributed with a density proportional to
|
||||
$1/|p'(\tilde x_k)|^2$. So to restore the uniform density we need
|
||||
to reject this value of $\tilde x_k$ with probability proportional
|
||||
to $|p'(\tilde x_k)|^2$. Noticing that the condition
|
||||
$\sum_{n=2}^{\tt deg\_p} n |c_n| = 1$ implies that
|
||||
to $|p'(\tilde x_k)|^2$. Noticing that the condition
|
||||
$\sum_{n=2}^{\tt deg\_p} n |c_n| = 1$ implies that
|
||||
$|p'(\tilde x_k)| \le 2$, we
|
||||
do this by rejecting if $|p'(\tilde x_k)|^2 < R_{0,4}$.
|
||||
(This makes use of the function {\tt calc\_mod\_dp2} which calculates
|
||||
|
@ -196,7 +196,7 @@ The main loop of the program is in the function {\tt draw\_euler2d}.
|
|||
Most of the drawing operations are contained in this function, and
|
||||
the numerical aspects are sent to the function {\tt ode\_solve}.
|
||||
But there is an aspect of this that I would like
|
||||
to discuss in the next section, and so we will look at a simple method for
|
||||
to discuss in the next section, and so we will look at a simple method for
|
||||
numerically solving differential equations.
|
||||
|
||||
The Euler Method
|
||||
|
@ -208,7 +208,7 @@ the solution of the equation:
|
|||
\label{method-simple}
|
||||
\tilde x_k(t+h) = \tilde x_k(t) + h \tilde\alpha_k(t) .
|
||||
\end{equation}
|
||||
The more sophisticated methods we use are variations of
|
||||
The more sophisticated methods we use are variations of
|
||||
the Euler Method, and so the discussion in the following section
|
||||
still applies.
|
||||
|
||||
|
@ -227,9 +227,9 @@ so now it is not used.
|
|||
One problem using a numerical scheme such as the Euler Method occurs
|
||||
when the points $\tilde x_k$ get close to the boundary
|
||||
of $\Delta$. In that case, it is possible that the new
|
||||
points will be pushed outside of the boundary. Even if they
|
||||
points will be pushed outside of the boundary. Even if they
|
||||
are not pushed out of the boundary, they may be much closer
|
||||
or farther from the boundary than they should be.
|
||||
or farther from the boundary than they should be.
|
||||
Our system of equations is very sensitive to how close points
|
||||
are to the boundary --- points with non-zero vorticity
|
||||
(``vortex points'') that are close to the boundary travel
|
||||
|
@ -238,7 +238,7 @@ inversely proportional to the distance from the boundary.
|
|||
|
||||
A way to try to mitigate this problem is something that I call
|
||||
``subtle perturbation.''
|
||||
We map the points in
|
||||
We map the points in
|
||||
the unit disk to points in the plane using the map
|
||||
\begin{equation*}
|
||||
F(x) = f(|x|) \frac x{|x|} ,
|
||||
|
@ -248,7 +248,7 @@ bijection. It turns out that a good choice is
|
|||
\begin{equation*}
|
||||
f(t) = -\log(1-t) .
|
||||
\end{equation*}
|
||||
(The reason for this is that points close to each other
|
||||
(The reason for this is that points close to each other
|
||||
that are a distance
|
||||
about $r$ from the boundary will be pushed around so that
|
||||
their distance from each other is about multiplied by the
|
||||
|
@ -268,12 +268,12 @@ $y_k = F(\tilde x_k)$. In effect this is what we do.
|
|||
Instead of performing the computation (\ref{method-simple}),
|
||||
we do the calculation
|
||||
\begin{equation*}
|
||||
y_k = F(\tilde x_k(t)) + h {\cal A}(\tilde x_k) \tilde\alpha_k(t)
|
||||
y_k = F(\tilde x_k(t)) + h {\cal A}(\tilde x_k) \tilde\alpha_k(t)
|
||||
\end{equation*}
|
||||
where
|
||||
${\cal A}(x)$ is the matrix of partial derivatives of $F$:
|
||||
\begin{equation*}
|
||||
{\cal A}(x) =
|
||||
{\cal A}(x) =
|
||||
\frac{f(|x|)}{|x|}
|
||||
\left[
|
||||
\begin{matrix}
|
||||
|
@ -300,10 +300,10 @@ the quantity {\tt SUBTLE\_PERTURB} is set.
|
|||
\section{Drawing the Points}
|
||||
|
||||
As we stated earlier, most of the drawing functions are contained
|
||||
in the function {\tt draw\_euler2d}. If the variable
|
||||
in the function {\tt draw\_euler2d}. If the variable
|
||||
{\tt hide\_vortex} is set (and the function {\tt init\_euler2d}
|
||||
will set this with probability $3/4$), then we only display
|
||||
the points $\tilde x_k$ for ${\tt Nvortex} < k \le N$. If
|
||||
the points $\tilde x_k$ for ${\tt Nvortex} < k \le N$. If
|
||||
{\tt hide\_vortex} is not set, then the ``vortex points''
|
||||
$\tilde x_k$ ($1 \le k \le {\tt Nvortex}$) are displayed in white.
|
||||
In fact the points $p(\tilde x_k)$ are what are put onto the screen,
|
||||
|
@ -319,7 +319,7 @@ is replace by
|
|||
$$ K_1(x,y) = \frac{(x-y)^\perp}{|x-y|^{m+1}}, $$
|
||||
and
|
||||
$$ K_2(x,y) = K_1(x,y) - |y|^{1-m} K_1(x,y) .$$
|
||||
So for example, setting $m=2$ corresponds to the
|
||||
So for example, setting $m=2$ corresponds to the
|
||||
quasi-geostrophic equation. (I haven't yet figured out
|
||||
what $K_p$ should be, so if $m \ne 1$ we use the unit circle
|
||||
as the boundary.)
|
||||
|
|
|
@ -642,7 +642,7 @@ init_flow(ModeInfo * mi)
|
|||
flowstruct *sp;
|
||||
char *name;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32
|
||||
/* This is needed because we don't have resource management
|
||||
working on Windows yet so all the defaults are being
|
||||
ignored. */
|
||||
|
|
|
@ -169,7 +169,7 @@ NAME(fzort_ctx *ctx, struct pvertex *v1,
|
|||
}
|
||||
|
||||
if (xb >= ctx->clip.x_min && xa <= xb) {
|
||||
u = u_left;
|
||||
u = u_left;
|
||||
v = v_left;
|
||||
|
||||
if (adjx) {
|
||||
|
|
|
@ -209,7 +209,7 @@ fp_mul(long a, long b)
|
|||
asm volatile("imull %2; shrdl %3,%%edx,%%eax"
|
||||
: "=a"(c)
|
||||
: "0"(a), "m"(b), "i"(FP_SHIFT)
|
||||
: "edx");
|
||||
: "edx");
|
||||
return c;
|
||||
}
|
||||
#else
|
||||
|
@ -229,7 +229,7 @@ fp_mul_add(long s, long a, long b)
|
|||
asm volatile("imull %2; shrdl %3,%%edx,%%eax; addl %4,%%eax"
|
||||
: "=a"(c)
|
||||
: "0"(a), "m"(b), "i"(FP_SHIFT), "m"(s)
|
||||
: "edx");
|
||||
: "edx");
|
||||
return c;
|
||||
}
|
||||
#else
|
||||
|
@ -394,7 +394,7 @@ mat_make_rotation_around_x(struct matrix *m, float ang)
|
|||
mat_make_identity(m);
|
||||
|
||||
m->m22 = c; m->m23 = -s;
|
||||
m->m32 = s; m->m33 = c;
|
||||
m->m32 = s; m->m33 = c;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -554,7 +554,7 @@ init_edge(fzort_ctx *ctx, struct edge *edge,
|
|||
edge->lines = (int) (y_max - edge->sy);
|
||||
edge->dxdy = fp_div(edge->dx, edge->dy);
|
||||
edge->sx = INT_TO_FP(v0->x_scr) + edge->adjy*edge->dxdy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define CONCAT(a, b) a ## b
|
||||
|
@ -636,7 +636,7 @@ render_process_mesh(fzort_ctx *ctx, struct matrix *m)
|
|||
for (v = ctx->mesh->vtx; v != vend; v++) {
|
||||
struct vector normal;
|
||||
float w;
|
||||
|
||||
|
||||
mat_transform_copy(&pv->p, m, &v->p);
|
||||
mat_rotate_copy(&normal, m, &v->normal);
|
||||
vec_normalize(&normal);
|
||||
|
@ -645,22 +645,22 @@ render_process_mesh(fzort_ctx *ctx, struct matrix *m)
|
|||
(TEXTURE_SIZE/2)*normal.y + 0.5);
|
||||
pv->v_txt = FLOAT_TO_FP((TEXTURE_SIZE/2) +
|
||||
(TEXTURE_SIZE/2)*normal.x + 0.5);
|
||||
|
||||
|
||||
w = ctx->lx/pv->p.z;
|
||||
pv->x_scr = (int) (ctx->cx + w*pv->p.x + 0.5);
|
||||
pv->y_scr = (int) (ctx->cy + w*pv->p.y + 0.5);
|
||||
|
||||
if (pv->x_scr < x_scr_min)
|
||||
x_scr_min = pv->x_scr;
|
||||
x_scr_min = pv->x_scr;
|
||||
|
||||
if (pv->x_scr > x_scr_max)
|
||||
x_scr_max = pv->x_scr;
|
||||
x_scr_max = pv->x_scr;
|
||||
|
||||
if (pv->y_scr < y_scr_min)
|
||||
y_scr_min = pv->y_scr;
|
||||
y_scr_min = pv->y_scr;
|
||||
|
||||
if (pv->y_scr > y_scr_max)
|
||||
y_scr_max = pv->y_scr;
|
||||
y_scr_max = pv->y_scr;
|
||||
|
||||
pv++;
|
||||
}
|
||||
|
@ -704,13 +704,13 @@ render_process_mesh(fzort_ctx *ctx, struct matrix *m)
|
|||
|
||||
for (idx = &pin->vtx_index[0]; idx != iend; idx++) {
|
||||
pv = &ctx->pvtx[*idx];
|
||||
|
||||
|
||||
nclip_x_min += (pv->x_scr < ctx->clip.x_min);
|
||||
nclip_x_max += (pv->x_scr > ctx->clip.x_max);
|
||||
nclip_y_min += (pv->x_scr < ctx->clip.y_min);
|
||||
nclip_y_max += (pv->y_scr > ctx->clip.y_max);
|
||||
}
|
||||
|
||||
|
||||
if (nclip_x_min != pin->nvtx && nclip_x_max != pin->nvtx &&
|
||||
nclip_y_min != pin->nvtx && nclip_y_max != pin->nvtx) {
|
||||
struct pvertex *p0, *p1, *p2, *p3;
|
||||
|
@ -745,27 +745,27 @@ render_process_mesh(fzort_ctx *ctx, struct matrix *m)
|
|||
struct polygon *poly;
|
||||
|
||||
z_min = z_max = 0.f;
|
||||
|
||||
|
||||
for (i = 0; i < npoly; i++) {
|
||||
z = ctx->order_in[i].z;
|
||||
|
||||
|
||||
if (i == 0 || z < z_min)
|
||||
z_min = z;
|
||||
|
||||
|
||||
if (i == 0 || z > z_max)
|
||||
z_max = z;
|
||||
}
|
||||
|
||||
|
||||
z_scale = 255.f/(z_max - z_min);
|
||||
|
||||
|
||||
for (i = 0; i < npoly; i++)
|
||||
ctx->order_in[i].zi = (unsigned int) (z_scale*(ctx->order_in[i].z - z_min));
|
||||
|
||||
|
||||
radix_sort(ctx->order_out, ctx->order_in, 0, npoly);
|
||||
|
||||
|
||||
for (i = npoly - 1; i >= 0; i--) {
|
||||
poly = ctx->order_out[i].poly;
|
||||
|
||||
|
||||
for (j = 1; j < poly->nvtx - 1; j++) {
|
||||
ctx->fill_triangle_fn(ctx,
|
||||
&ctx->pvtx[poly->vtx_index[0]],
|
||||
|
@ -795,8 +795,8 @@ mesh_free(struct mesh *m)
|
|||
static inline float
|
||||
radius_offset(float phi, float theta, float phase, float amp)
|
||||
{
|
||||
return (amp + 4.*amp*sin(3.*phase + theta))*sin(phase + 5.*phi) +
|
||||
(amp + 4.*amp*sin(2.*phase + 2.*phi))*sin(phase + 3.*theta);
|
||||
return (amp + 4.*amp*sin(3.*phase + theta))*sin(phase + 5.*phi) +
|
||||
(amp + 4.*amp*sin(2.*phase + 2.*phi))*sin(phase + 3.*theta);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -876,9 +876,9 @@ calc_mesh_vertices(struct mesh *mesh, int density, float radius,
|
|||
|
||||
/*
|
||||
(amp + 4.*amp*sin(3.*phase + theta))*
|
||||
sin(phase + 5.*phi) +
|
||||
sin(phase + 5.*phi) +
|
||||
(amp + 4.*amp*sin(2.*phase + 2.*phi))*
|
||||
sin(phase + 3.*theta);
|
||||
sin(phase + 3.*theta);
|
||||
*/
|
||||
|
||||
offs = (amp + 4.*amp*
|
||||
|
@ -1287,7 +1287,7 @@ static int
|
|||
make_image(ModeInfo *mi, struct fzort_ctx *fz)
|
||||
{
|
||||
int img_width, img_height;
|
||||
|
||||
|
||||
img_width = MIN(MI_WIDTH(mi), MI_HEIGHT(mi));
|
||||
|
||||
if (img_width > MAX_WIDTH)
|
||||
|
@ -1623,7 +1623,7 @@ draw_fzort(ModeInfo *mi)
|
|||
;
|
||||
} else {
|
||||
XPutImage(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
|
||||
fz->image,
|
||||
fz->image,
|
||||
src_x_min, src_y_min, x0 + src_x_min, y0 + src_y_min,
|
||||
src_x_max - src_x_min + 1, src_y_max - src_y_min + 1);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ static const char sccsid[] = "@(#)biof.c 5.15 2005/02/15 xlockmore";
|
|||
* Ported to Linux by Tugrul Galatali <tugrul@galatali.com>
|
||||
*
|
||||
* BioF is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* BioF is distributed in the hope that it will be useful,
|
||||
|
@ -60,7 +60,7 @@ static const char sccsid[] = "@(#)biof.c 5.15 2005/02/15 xlockmore";
|
|||
"*showFPS: False \n" \
|
||||
"*cycles: 100 \n" \
|
||||
"*size: 6000 \n" \
|
||||
"*preset: 5 \n"
|
||||
"*preset: 5 \n"
|
||||
|
||||
# include "xlockmore.h" /* from the xscreensaver distribution */
|
||||
# include <stdio.h>
|
||||
|
|
|
@ -324,7 +324,7 @@ do_normal(GLfloat x1, GLfloat y1, GLfloat z1,
|
|||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Shorthand utilities for making faces, with proper normals.
|
||||
|
@ -410,7 +410,7 @@ face5(GLint texture, GLfloat * color, Bool wire,
|
|||
glVertex3f(x5, y5, z5);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Creating object models
|
||||
|
@ -1655,7 +1655,7 @@ taser(ModeInfo * mi, Bool wire)
|
|||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Rendering and animating object models
|
||||
|
@ -2161,7 +2161,7 @@ rotate(GLfloat * pos, GLfloat * v, GLfloat * dv, GLfloat max_v, Bool verbose)
|
|||
*dv *= 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Window management, etc
|
||||
|
|
|
@ -56,28 +56,28 @@ static const char sccsid[] = "@(#)morph3d.c 5.01 2001/03/01 xlockmore";
|
|||
Basics of morph3d Engine
|
||||
|
||||
This document is VERY incomplete, but tries to describe the mathematics used
|
||||
in the program. At this moment it just describes how the polyhedra are
|
||||
in the program. At this moment it just describes how the polyhedra are
|
||||
generated. On further versions, this document will probably be improved.
|
||||
|
||||
Marcelo Fernandes Vianna
|
||||
Marcelo Fernandes Vianna
|
||||
- Feb-13-1997
|
||||
|
||||
POLYHEDRA GENERATION
|
||||
|
||||
For the purpose of this program it's not sufficient to know the polyhedra
|
||||
vertexes coordinates. Since the morphing algorithm applies a nonlinear
|
||||
vertexes coordinates. Since the morphing algorithm applies a nonlinear
|
||||
transformation over the surfaces (faces) of the polyhedron, each face has
|
||||
to be divided into smaller ones. The morphing algorithm needs to transform
|
||||
to be divided into smaller ones. The morphing algorithm needs to transform
|
||||
each vertex of these smaller faces individually. It's a very time consuming
|
||||
task.
|
||||
|
||||
In order to reduce calculation overload, and since all the macro faces of
|
||||
the polyhedron are transformed by the same way, the generation is made by
|
||||
the polyhedron are transformed by the same way, the generation is made by
|
||||
creating only one face of the polyhedron, morphing it and then rotating it
|
||||
around the polyhedron center.
|
||||
around the polyhedron center.
|
||||
|
||||
What we need to know is the face radius of the polyhedron (the radius of
|
||||
the inscribed sphere) and the angle between the center of two adjacent
|
||||
What we need to know is the face radius of the polyhedron (the radius of
|
||||
the inscribed sphere) and the angle between the center of two adjacent
|
||||
faces using the center of the sphere as the angle's vertex.
|
||||
|
||||
The face radius of the regular polyhedra are known values which I decided
|
||||
|
@ -106,7 +106,7 @@ and sqrt(3)/2 for the other two other edges. So the angle we want is:
|
|||
+-----------------------------------------------------------+
|
||||
For the cube this angle is obvious, but just for formality it can be
|
||||
easily obtained because we also know it's isosceles edge lengths:
|
||||
sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
|
||||
sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
|
||||
want is:
|
||||
+-----------------------------------------------------------+
|
||||
| 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees |
|
||||
|
@ -127,8 +127,8 @@ Edge radius:
|
|||
(VRp is the pentagon's vertex radio).
|
||||
Face Radius For Dodecahedron
|
||||
FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404
|
||||
Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
|
||||
completing this triangle, the lesser angle is a half of the angle we are
|
||||
Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
|
||||
completing this triangle, the lesser angle is a half of the angle we are
|
||||
looking for, so this angle is:
|
||||
+-----------------------------------------------------------+
|
||||
| 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees |
|
||||
|
@ -161,7 +161,7 @@ Update May-23-2005 [Maintainer wants to add a rhombic dodecahedron and the
|
|||
|
||||
Figure/Diagram example (not here) shows a dodecahedron
|
||||
SC = Solid Center (Center of polyhedron)
|
||||
FC = Face Center (Center of a polygon)
|
||||
FC = Face Center (Center of a polygon)
|
||||
P = Arbitrary Point inside the face plan
|
||||
Alpha = Faces Angle (internal angle from center of polyhedron)
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ static gasketstruct *gasket = (gasketstruct *) NULL;
|
|||
|
||||
/* static GLuint limit; */
|
||||
|
||||
|
||||
|
||||
/* Computing normal vectors (thanks to Nat Friedman <ndf@mit.edu>)
|
||||
*/
|
||||
|
||||
|
@ -222,7 +222,7 @@ do_normal(GLfloat x1, GLfloat y1, GLfloat z1,
|
|||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
triangle (GLfloat x1, GLfloat y1, GLfloat z1,
|
||||
|
|
|
@ -1121,10 +1121,10 @@ draw_cell(ModeInfo * mi, cellstruct info)
|
|||
#endif
|
||||
{
|
||||
(void) XPutImage(display, MI_WINDOW(mi), gc, lp->logo,
|
||||
info.age%XPATTERNS * TRUE_CELL_WIDTH,
|
||||
(info.age/XPATTERNS) * TRUE_CELL_HEIGHT,
|
||||
info.age%XPATTERNS * TRUE_CELL_WIDTH,
|
||||
(info.age/XPATTERNS) * TRUE_CELL_HEIGHT,
|
||||
lp->xb + lp->xs * col, lp->yb + lp->ys * row,
|
||||
lp->logo->width/XPATTERNS, lp->logo->height/YPATTERNS);
|
||||
lp->logo->width/XPATTERNS, lp->logo->height/YPATTERNS);
|
||||
}
|
||||
}
|
||||
} else { /* TRI */
|
||||
|
@ -2288,7 +2288,7 @@ init_life(ModeInfo * mi)
|
|||
lp->height > MINGRIDSIZE * lp->logo->height/YPATTERNS) {
|
||||
lp->pixelmode = False;
|
||||
lp->xs = lp->logo->width/XPATTERNS;
|
||||
lp->ys = lp->logo->height/YPATTERNS;
|
||||
lp->ys = lp->logo->height/YPATTERNS;
|
||||
} else
|
||||
{
|
||||
int min = MIN(lp->width, lp->height) / (8 * MINGRIDSIZE);
|
||||
|
|
|
@ -360,7 +360,7 @@ reps(complex c, double p, int r, Bool binary, interior_t interior, double demran
|
|||
if (zsin)
|
||||
add(&t, complex_sin(t1));
|
||||
l2 = t.real * t.real + t.imag * t.imag;
|
||||
if (l2 <= alpha2) {
|
||||
if (l2 <= alpha2) {
|
||||
alpha2 = l2;
|
||||
index = rep;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ reps(complex c, double p, int r, Bool binary, interior_t interior, double demran
|
|||
attractor, the more negative the exponent will be. */
|
||||
/* n=N
|
||||
L = lim 1/N * Sum log(abs(dx(n+1)/dx(n)))/ln(2)
|
||||
N->inf n=1
|
||||
N->inf n=1
|
||||
*/
|
||||
L += log(sqrt(l2));
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ reps(complex c, double p, int r, Bool binary, interior_t interior, double demran
|
|||
if(p > 2) ipow(&t1, (int) (p - 1));
|
||||
mult(&dt, t1);
|
||||
dt.real += 1;
|
||||
dl2 = dt.real * dt.real + dt.imag * dt.imag;
|
||||
dl2 = dt.real * dt.real + dt.imag * dt.imag;
|
||||
if (dl2 >= 1e300) {
|
||||
escaped = 2;
|
||||
break;
|
||||
|
|
|
@ -247,7 +247,7 @@ static void
|
|||
free_toneclock(Display *display, toneclockstruct *tclock)
|
||||
{
|
||||
ModeInfo *mi = tclock->mi;
|
||||
|
||||
|
||||
if (MI_IS_INSTALL(mi) && MI_NPIXELS(mi) > 2) {
|
||||
MI_WHITE_PIXEL(mi) = tclock->whitepixel;
|
||||
MI_BLACK_PIXEL(mi) = tclock->blackpixel;
|
||||
|
@ -270,7 +270,7 @@ free_toneclock(Display *display, toneclockstruct *tclock)
|
|||
XFreeGC(display, tclock->gc);
|
||||
tclock->gc = None;
|
||||
}
|
||||
free_hour(tclock);
|
||||
free_hour(tclock);
|
||||
#ifndef NO_DBUF
|
||||
if (tclock->dbuf != None) {
|
||||
XFreePixmap(display, tclock->dbuf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue