// SPACE SIN CURVES
init<-0;
angle<-0.0;
angle2<-0.0;
radius<-15.0;
x<-0;
y<-0;
z<-0;
Color<-216.0;
Pos_x<-null;
Pos_y<-null;
Pos_z<-null;
PosIndex<-0;
PosIndex2<-0;
PosDistance<-0;
ls<-0;
// Init display makes a voxel display wall using special display voxels.
function Init_Display(Size)
{
local x,y;
// Clear Zone
for (x=0;x<32;x++)
for (y=0;y<64;y++) UNF_PlaceVoxel3D(x+1,y,0,0);
// Setup the screen
for (x=0;x<Size;x++)
for (y=0;y<Size;y++) UNF_PlaceVoxel3D(x+1,y,0,223);
}
// This function is called repeatedly for each step of the robot.
function Voxel_Step()
{
local i;
// Startup code, build the environnment. Executes only once.
if (init ==0)
{
init = 1;
Pos_x = array(1001);
Pos_y = array(1001);
Pos_z = array(1001);
}
// Draw Realtime Curve
for (i=0;i<100;i++)
{
x = (sin(angle)*radius).tointeger();
z = (cos(angle)*radius).tointeger();
y = (sin(angle2)* 10.0+ 10.0).tointeger();
UNF_PlaceVoxel3D(x,y.tointeger(),z,216);
// Store position in the table
Pos_x[PosIndex] = x; Pos_y[PosIndex] = y; Pos_z[PosIndex] = z;
// Erase old position.
UNF_PlaceVoxel3D(Pos_x[PosIndex2],Pos_y[PosIndex2],Pos_z[PosIndex2],0);
PosIndex++;
if (PosDistance<200) PosDistance++;
else PosIndex2++;
if (PosIndex>1000) PosIndex = 0;
if (PosIndex2>1000) PosIndex2 = 0;
angle += 0.025+ls;
angle2+= 0.1;
Color+=0.001;
if (Color > (216 + 16)) Color = 216;
ls+=0.00001;
if (ls > 0.1) ls=0;
}
}