home *** CD-ROM | disk | FTP | other *** search
- /*
- * RCCL Version 1.0 Author : Vincent Hayward
- * School of Electrical Engineering
- * Purdue University
- * Dir : src
- * File : news.c
- * Remarks : Mostly dynamic allocation of rccl structures.
- * Usage : part of the library
- */
-
- /*LINTLIBRARY*/
-
- #include "../h/rccl.h"
- #include "../h/manip.h"
-
- /*
- * dummy function meaning that the transform is really a constant transform
- */
-
- int const() /*::*/
- {
- }
-
- /*
- * dummy function meaning that the transform may change during execution
- * but whose value is taken into account at the transition time
- */
-
- int hold() /*::*/
- {
- }
-
- /*
- * dummy function meaning that the transform may change during execution
- */
-
- int varb() /*::*/
- {
- }
-
- /*
- * creates a position record
- */
-
- PST_PTR newposition_n() /*::*/
- {
- char *malloc();
- PST_PTR l;
-
- if ((l = (PST_PTR) malloc(sizeof(PST))) == NULL) {
- giveup("mem. alloc error", YES);
- }
- l->name = "";
- l->code = OK;
- l->scal = 0.;
- l->end = 0;
- l->cfnsp = l->tfnsp = l->coorp = l->toolp = NO;
- l->t6ptr = l->tlptr = l->pos = NULL;
- return(l);
- }
-
-
- /*
- * creates a term record
- */
-
- TERM_PTR newterm_n() /*::*/
- {
- char *malloc();
- TERM_PTR l;
-
- if ((l = (TERM_PTR) malloc(sizeof(TERM))) == NULL) {
- giveup("mem. alloc error", YES);
- }
- l->trsf = NULL;
- l->altr = NULL;
- l->oldt = NULL;
- l->hd.put = NULL;
- l->hd.get = NULL;
- return(l);
- }
-
-
- /*
- * creates a transform record
- */
-
- TRSF_PTR newtrans(string, fct) /*::*/
- char *string;
- TRFN fct; /* pointer to a function */
- {
- TRSF_PTR p;
-
- if ((p = (TRSF_PTR) malloc(sizeof(TRSF))) == NULL) {
- giveup("mem. alloc error", YES);
- }
- p->name = string;
- p->fn = fct;
- p->timeval = 0;
-
- /* initialize with identity transforms */
-
- p->n.x = p->o.y = p->a.z = 1.;
- p->n.y = p->n.z = p->o.x = p->o.z = p->a.x = p->a.y = 0.;
- p->p.x = p->p.y = p->p.z = 0.;
-
- return(p);
- }
-
-
- /*
- * genrates a transform given the translation
- * vector, and the rotation about a vector
- */
-
- TRSF_PTR gentr_rot(name, tx, ty, tz, k, h) /*::*/
- char *name;
- real tx, ty, tz, h;
- VECT_PTR k;
- {
- TRSF_PTR t;
-
- t = rot(trsl(newtrans(name, const), tx, ty, tz), k, h);
-
- if (prints_out > 1) /* print value of transform */
- printrn(t, fpi);
- return(t);
- }
-
-
- /*
- * generates a transform given the translation
- */
-
- TRSF_PTR gentr_trsl(name, tx, ty, tz) /*::*/
- char *name;
- real tx, ty, tz;
- {
- TRSF_PTR t;
-
- t = trsl(newtrans(name, const), tx, ty, tz);
-
- if (prints_out > 1) /* print value of transform */
- printrn(t, fpi);
- return(t);
- }
-
-
- /*
- * generates a transform given the translation
- * vector, and the rotation expressed with euler angles
- */
-
- TRSF_PTR gentr_eul(name, tx, ty, tz, phi, the, psi) /*::*/
- char *name;
- real tx, ty, tz;
- real phi, the, psi;
- {
- TRSF_PTR t;
-
- t = eul(trsl(newtrans(name, const), tx, ty, tz), phi, the, psi);
-
- if (prints_out > 1) /* print value of transform */
- printrn(t, fpi);
- return(t);
- }
-
-
- /*
- * generates a transform given the translation
- * vector, and the rotation expressed with rpy angles
- */
-
- TRSF_PTR gentr_rpy(name, tx, ty, tz, phi, the, psi) /*::*/
- char *name;
- real tx, ty, tz;
- real phi, the, psi;
- {
- TRSF_PTR t;
-
- t = rpy(trsl(newtrans(name, const), tx, ty, tz), phi, the, psi);
-
- if (prints_out > 1) /* print value of transform */
- printrn(t, fpi);
- return(t);
- }
-
-
- /*
- * generates a transform given the
- * p, a, o vectors
- */
-
- TRSF_PTR gentr_pao(name, px, py, pz, ax, ay, az, ox, oy, oz) /*::*/
- char *name;
- real px, py, pz, ax, ay, az, ox, oy, oz;
- {
- TRSF_PTR t;
-
- t = vao(trsl(newtrans(name, const), px, py, pz), ax, ay, az, ox, oy, oz);
-
- if (prints_out > 1) /* print value of transform */
- printrn(t, fpi);
- return(t);
- }
-
-
-