o------------------------------------------------------------------------o
On Thu, 8 Mar 2001, Yazel, David J. wrote:
> I don't know enough of your app to understand what "looks wrong" to you.. In
> the second screenshot there are empty bands in the middle of the box.. is
> that what you are referring to?
Yes, that is what I was referring to. The overall box is createt from
several smaller boxes, each has its own color and some of them are
sometimes missing, during rotation
If that happened during a rotation I would
> suspect the normals were wrong.
May be they are, I will thinks about them. Thanks Desiree
Thats how I calculate them now:
Point3f[] coords = new Point3f[16];
// Triangle Strip Array
// front
coords[0]=new Point3f(eastValue-w,heightValue+c,-northValue+l);
coords[1]=new Point3f(eastValue-w,heightValue-c,-northValue+l);
coords[2]=new Point3f(eastValue+w,heightValue+c,-northValue+l);
coords[3]=new Point3f(eastValue+w,heightValue-c,-northValue+l);
// right
coords[4]=new Point3f(eastValue+w,heightValue+c,-northValue-l);
coords[5]=new Point3f(eastValue+w,heightValue-c,-northValue-l);
// back
coords[6]=new Point3f(eastValue-w,heightValue+c,-northValue-l);
coords[7]=new Point3f(eastValue-w,heightValue-c,-northValue-l);
// top
coords[8]=new Point3f(eastValue+w,heightValue+c,-northValue+l);
coords[9]=new Point3f(eastValue+w,heightValue+c,-northValue-l);
coords[10]=new Point3f(eastValue-w,heightValue+c,-northValue+l);
coords[11]=new Point3f(eastValue-w,heightValue+c,-northValue-l);
// left
coords[12]=new Point3f(eastValue-w,heightValue-c,-northValue+l);
coords[13]=new Point3f(eastValue-w,heightValue-c,-northValue-l);
// down
coords[14]=new Point3f(eastValue+w,heightValue-c,-northValue+l);
coords[15]=new Point3f(eastValue+w,heightValue-c,-northValue-l);
/*
for(int j=0;j<coords.length;j++) {
System.out.println("c "+j+" "+coords[j]);
}
*/
// direkter Fuellversuch
// create normals
//Vector3f[] normals = new Vector3f[24];
//Vector3f[] normals = new Vector3f[36];
Vector3f[] normals = new Vector3f[16];
for(int n=0;n<normals.length;n=n+4) {
Vector3f v1 = new Vector3f();
Vector3f v2 = new Vector3f();
v1.x = coords[n+3].x - coords[n].x;
v2.x = coords[n+1].x - coords[n].x;
v1.y = coords[n+3].y - coords[n].y;
v2.y = coords[n+1].y - coords[n].y;
v1.z = coords[n+3].z - coords[n].z;
v2.z = coords[n+1].z - coords[n].z;
Vector3f vcross = new Vector3f();
vcross.cross(v2,v1);
vcross.normalize();
normals[n]=vcross;
normals[n+1]=vcross;
normals[n+2]=vcross;
normals[n+3]=vcross;
}
/*
for(int k=0;k<coords.length;k++) {
System.out.println("n "+k+" "+normals[k]);
}
*/
int stripCounts[] = {8,8};
TriangleStripArray tri = new
TriangleStripArray(16,TriangleArray.COORDINATES|TriangleArray.NORMALS,stripCounts);
tri.setCoordinates(0,coords);
tri.setNormals(0,normals);
tri.setCapability(Geometry.ALLOW_INTERSECT);
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".