Hi,

        I try to do a box (cube in this case) with QuadArray but I want to treat
each face independantly. For that, I use one object QuadArray with six
vertex. I attached my class and some pics of the results. Could you tell me
what is wrong?? How to use correctly QuadArray or other class for do what I
want.

I know how to do a box with one vertex only, but I really need that treat
each face independently in my project.

Thanks,

        Vincent

box4.jpg

box1.jpg

box2.jpg

box3.jpg

box.jpg

// une boite



import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.image.TextureLoader;




public class OBJBoite2 extends Shape3D {


        public double thex;
        public double they;
        public double thez;


        //constructeur
        public OBJBoite2(double xsize, double ysize, double zsize) {

                super();
                thex=xsize;
                they=ysize;
                thez=zsize;
                double xmin = -xsize;
                double xmax =  xsize;
                double ymin = -ysize;
                double ymax =  ysize;
                double zmin = -zsize;
                double zmax =  zsize;


                QuadArray boite = new QuadArray(24, QuadArray.COORDINATES);


                Point3d verts1[] = new Point3d[4];
                Point3d verts2[] = new Point3d[4];
                Point3d verts3[] = new Point3d[4];
                Point3d verts4[] = new Point3d[4];
                Point3d verts5[] = new Point3d[4];
                Point3d verts6[] = new Point3d[4];


                // devant
                verts1[0] = new Point3d(xmax, ymin, zmax);
                verts1[1] = new Point3d(xmax, ymax, zmax);
                verts1[2] = new Point3d(xmin, ymax, zmax);
                verts1[3] = new Point3d(xmin, ymin, zmax);
                // derriere
                verts2[0] = new Point3d(xmin, ymin, zmin);
                verts2[1] = new Point3d(xmin, ymax, zmin);
                verts2[2] = new Point3d(xmax, ymax, zmin);
                verts2[3] = new Point3d(xmax, ymin, zmin);
                // droite
                verts3[0] = new Point3d(xmax, ymin, zmin);
                verts3[1] = new Point3d(xmax, ymax, zmin);
                verts3[2] = new Point3d(xmax, ymax, zmax);
                verts3[3] = new Point3d(xmax, ymin, zmax);
                // gauche
                verts4[0] = new Point3d(xmin, ymin, zmax);
                verts4[1] = new Point3d(xmin, ymax, zmax);
                verts4[2] = new Point3d(xmin, ymax, zmin);
                verts4[3] = new Point3d(xmin, ymin, zmin);
                // dessus
                verts5[0] = new Point3d(xmax, ymax, zmax);
                verts5[1] = new Point3d(xmax, ymax, zmin);
                verts5[2] = new Point3d(xmin, ymax, zmin);
                verts5[3] = new Point3d(xmin, ymax, zmax);
                // dessous
                verts6[0] = new Point3d(xmin, ymin, zmax);
                verts6[1] = new Point3d(xmin, ymin, zmin);
                verts6[2] = new Point3d(xmax, ymin, zmin);
                verts6[3] = new Point3d(xmax, ymin, zmax);


                boite.setCoordinates(0, verts1);
                setGeometry(boite);
                boite.setCoordinates(1, verts2);
                setGeometry(boite);
                boite.setCoordinates(2, verts3);
                setGeometry(boite);
                boite.setCoordinates(3, verts4);
                setGeometry(boite);
                boite.setCoordinates(4, verts5);
                setGeometry(boite);
                boite.setCoordinates(5, verts6);
                setGeometry(boite);

        //fin du constructeur
        }

}


_____________________________
Vincent Lalibert�
�tudiant en G�nie Informatique
Universit� Laval
E-Mail: [EMAIL PROTECTED]
T�l:    (418) 687-0885
ICQ: 4392769

Reply via email to