#include <stdio.h>

#include <usercore.h>

#include <math.h>

#include "dynavars.h"

int pixwindd();

struct vwsurf vwsurf = DEFAULT_VWSURF(pixwindd);


graphinit() {

int error;

error = initialize_core(BASIC,NOINPUT,THREED);
if( error )exit(0);
error = initialize_view_surface(&vwsurf,FALSE);
error |= select_view_surface(&vwsurf);
if( error )exit(1);

set_viewport_2(0.05,0.95,0.05,0.75);
set_window(-0.18,0.18,-.14,0.14);
set_output_clipping(FALSE);
set_window_clipping(FALSE);
set_view_reference_point(0.0,3.0,0.0);
set_view_plane_normal(0.0,-1.0,0.0);
set_view_up_3(0.0,0.0,-1.0);
set_view_plane_distance(0.5);
set_projection(PERSPECTIVE,0.0,0.0,0.0);
set_view_depth(1.0,500.0);

new_frame();
}

graphend() {

deselect_view_surface(&vwsurf);
terminate_core();
 
}

  
drawman()


{
int link,par;
double tempv[3];

create_temporary_segment();

  for (link = 2; link <=numlinks;link++){
  par = parent[link];

move_abs_3(pH[par][0],pH[par][1],pH[par][2]);

line_abs_3(pH[link][0],pH[link][1],pH[link][2]);
  }


  for(link = 1;link <= numlinks; link++){
  mxv(RI[link],c[link],tempv);
  sxv(2.0,tempv,tempv);
  vpv(pH[link],tempv,tempv);
move_abs_3(pH[link][0],pH[link][1],pH[link][2]);

line_abs_3(tempv[0],tempv[1],tempv[2]);
  }
close_temporary_segment();

}


   

