I am trying to generate normals for a polygon I have created, yet I am getting an 
error at the 'generateNormals()' line.
The code is shown below, and works fine to create and display the object, it's just 
when I try and generate the normals I get a problem.....

Exception in thread "main" java.lang.IllegalArgumentException: StripCounts 
inconsistent with primitive

I take it this is a problem with the GeometryInfo object I've created... but I'm not 
sure what to do!

HELP!!



Point3d Coords[] = new Point3d[36];

Coords[0] = new Point3d(0,.4,-2);
Coords[1] = new Point3d(0,0,-2);
Coords[2] = new Point3d(0,.6,-3);
Coords[3] = new Point3d(0,0,-3);
Coords[4] = new Point3d(0,.7,-4);
Coords[5] = new Point3d(0,0,-4);
Coords[6] = new Point3d(0,1,-5);
Coords[7] = new Point3d(0,0,-5);

Coords[8] = new Point3d(0.1,.4,-2);
Coords[9] = new Point3d(0.1,0,-2);
Coords[10] = new Point3d(0.1,.6,-3);
Coords[11] = new Point3d(0.1,0,-3);
Coords[12] = new Point3d(0.1,.7,-4);
Coords[13] = new Point3d(0.1,0,-4);
Coords[14] = new Point3d(0.1,1,-5);
Coords[15] = new Point3d(0.1,0,-5);

Coords[16] = new Point3d(0,.4,-2);
Coords[17] = new Point3d(0.1,.4,-2);
Coords[18] = new Point3d(0,.6,-3);
Coords[19] = new Point3d(0.1,.6,-3);
Coords[20] = new Point3d(0,.7,-4);
Coords[21] = new Point3d(0.1,.7,-4);
Coords[22] = new Point3d(0,1,-5);
Coords[23] = new Point3d(0.1,1,-5);

Coords[24] = new Point3d(0,.4,-2);
Coords[25] = new Point3d(0,0,-2);
Coords[26] = new Point3d(0.1,.4,-2);
Coords[27] = new Point3d(0.1,0,-2);

Coords[28] = new Point3d(0,1,-5);
Coords[29] = new Point3d(0,0,-5);
Coords[30] = new Point3d(0.1,1,-5);
Coords[31] = new Point3d(0.1,0,-5);

Coords[32] = new Point3d(0,0,-2);
Coords[33] = new Point3d(0.1,0,-2);
Coords[34] = new Point3d(0,0,-5);
Coords[35] = new Point3d(0.1,0,-5);


int strips[] = {8, 8, 8, 4, 4, 4};
TriangleStripArray tsa = new TriangleStripArray(36, TriangleStripArray.COORDINATES, 
strips);
tsa.setCoordinates(0, Coords);

GeometryInfo geoInfo = new GeometryInfo(GeometryInfo.TRIANGLE_STRIP_ARRAY) ;
geoInfo.setCoordinates(Coords);

NormalGenerator norm = new NormalGenerator();
norm.generateNormals(geoInfo);

GeometryArray goemetry = geoInfo.getGeometryArray();

Shape3D poly = new Shape3D(geometry);
appearance = new Appearance();
PolygonAttributes polyAttrib = new PolygonAttributes();
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
appearance.setPolygonAttributes(polyAttrib);
poly.setAppearance(appearance);
mouseTrans.addChild(poly);

 <<David McCafferty.vcf>>

David McCafferty.vcf

Reply via email to