Back to index

radiance  4R0+20100331
Functions | Variables
genbeads.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

Go to the source code of this file.

Functions

void hermite3 (double hp[3], double p0[3], double p1[3], double r0[3], double r1[3], double t)
void htan3 (double ht[3], double p0[3], double p1[3], double r0[3], double r1[3], double t)
static void genstring (char *mtype, char *name, double p0[3], double p1[3], double r0[3], double r1[3], double rad, double inc)
int main (int argc, char **argv)

Variables

static const char RCSid [] = "$Id: genbeads.c,v 2.7 2003/11/16 10:29:38 schorsch Exp $"

Function Documentation

static void genstring ( char *  mtype,
char *  name,
double  p0[3],
double  p1[3],
double  r0[3],
double  r1[3],
double  rad,
double  inc 
) [static]

Definition at line 20 of file genbeads.c.

{
       register int  i;
       double  v[3];
       double  t;
       
       t = 0.0;
       for (i = 0; t <= 1.0; i++) {

              printf("\n%s sphere %s.%d\n", mtype, name, i);
              
              hermite3(v, p0, p1, r0, r1, t);
              
              printf("0\n0\n4 %18.12g %18.12g %18.12g %18.12g\n",
                                   v[0], v[1], v[2], rad);

              htan3(v, p0, p1, r0, r1, t);
              t += inc / sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hermite3 ( double  hp[3],
double  p0[3],
double  p1[3],
double  r0[3],
double  r1[3],
double  t 
)

Definition at line 13 of file hermite3.c.

{
       register int  i;
       double  tmh[4];
       
       tmh[0] = (2.0*t - 3.0)*t*t + 1.0;
       tmh[1] = (-2.0*t + 3.0)*t*t;
       tmh[2] = ((t - 2.0)*t + 1.0)*t;
       tmh[3] = (t - 1.0)*t*t;
       
       for (i = 0; i < 3; i++)
              hp[i] = p0[i]*tmh[0] + p1[i]*tmh[1] +
                     r0[i]*tmh[2] + r1[i]*tmh[3];
}

Here is the caller graph for this function:

void htan3 ( double  ht[3],
double  p0[3],
double  p1[3],
double  r0[3],
double  r1[3],
double  t 
)

Definition at line 37 of file hermite3.c.

{
       register int  i;
       double  tpmh[4];
       
       tpmh[0] = (6.0*t - 6.0)*t;
       tpmh[1] = (-6.0*t + 6.0)*t;
       tpmh[2] = (3.0*t - 4.0)*t + 1.0;
       tpmh[3] = (3.0*t - 2.0)*t;
       
       for (i = 0; i < 3; i++)
              ht[i] = p0[i]*tpmh[0] + p1[i]*tpmh[1] +
                     r0[i]*tpmh[2] + r1[i]*tpmh[3];
}

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file genbeads.c.

{
       double  p0[3], p1[3], r0[3], r1[3];
       double  rad, inc;
       char  *mtype;        /* material type */
       char  *name;         /* name */
       
       if (argc != 17) {
              fprintf(stderr, "Usage: %s material name p0 p1 r0 r1 rad inc\n",
                                    argv[0]);
              exit(1);
       }
       mtype = argv[1];
       name = argv[2];
       p0[0] = atof(argv[3]);
       p0[1] = atof(argv[4]);
       p0[2] = atof(argv[5]);
       p1[0] = atof(argv[6]);
       p1[1] = atof(argv[7]);
       p1[2] = atof(argv[8]);
       r0[0] = atof(argv[9]);
       r0[1] = atof(argv[10]);
       r0[2] = atof(argv[11]);
       r1[0] = atof(argv[12]);
       r1[1] = atof(argv[13]);
       r1[2] = atof(argv[14]);
       rad = atof(argv[15]);
       inc = atof(argv[16]);
       
       genstring(mtype, name, p0, p1, r0, r1, rad, inc);
       
       return(0);
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: genbeads.c,v 2.7 2003/11/16 10:29:38 schorsch Exp $" [static]

Definition at line 2 of file genbeads.c.