/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd.			    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

/* Control level code for the program 'oftest' */

#include "../h/rccl.h"
#include <math.h>

changeTr(tr, arg, mnp)
TRSF *tr;
int arg;
MANIP *mnp;
{
	float *amount;
	float scale;
	float cosine = cos(rcclSysTime()/500.0);
	float sine = sin(rcclSysTime()/500.0);

	if ((amount = (float*)getMemByName("amount")) == NULL)
	 { rciAbort (0, "can't get amount\n");
	   return (-1);
	 }
	scale = *amount*rcclGetInterval()/30.0;	/* XXX */
	if (arg == 1)
	 { tr->p.x += scale * cosine;
	   tr->p.y += scale * sine;
	 }
	else if (arg == 2)
	 { tr->p.y += scale * cosine;
	   tr->p.z += scale * sine;
	 }
	else if (arg == 3)
	 { tr->p.z += scale * cosine;
	   tr->p.x += scale * sine;
	 }
}
