// model class
import java.awt.*;

public class model
{
public bodypart bodyparts0[];
public bodypart bodyparts1[];
public int      index0[];
public int      index1[];
public vector   Rxyz[];
public vector   Dxyz[];
public vector   Crgb[];
public bodypart origin;
public int      num;
    
public model(int n)
    {
       	bodyparts0 = new bodypart[n];
       	bodyparts1 = new bodypart[n];
	index0     = new int[n];
	index1     = new int[n];
	Rxyz       = new vector[n];
	Dxyz       = new vector[n];
	Crgb       = new vector[n];
	origin     = null;
	num        = 0;
    }

public void set_origin(bodypart p)
    {
	origin = p;
    }

public void insert(bodypart bp0, int id0, bodypart bp1, int id1, vector r, vector d, vector c)
    {
	bodyparts0[num] = bp0;
	bodyparts1[num] = bp1;
	index0[num]     = id0;
	index1[num]     = id1;
	Rxyz[num]       = r;
	Dxyz[num]       = d;
	Crgb[num]       = c;
	bodyparts1[num].connect(bodyparts0[num], Rxyz[num], Dxyz[num], Crgb[num]);
	num++;
    }

public void compute_transforms(matrix m)
    {
	origin.compute_transforms(m);
    }
}

