Thomas wrote:
>
> Hi,
>
> How can I draw a simple flat polygon from an array of Point3f (that,
> of course belong to the same surface) ?
>
> I tried with GeometryInfo, but I always get an
> IllegalArgumentException: StripCounts inconsistent with primitive.
>
> Thanks for helping me.
>
> Thomas Jung
Hi Thomas,
probably you used the wrong primitive type in the constructor.
Joerg
public BranchGroup createRO(TrialData trDa)
{
System.out.println("Begin createRO");
System.out.println(trDa.getRO_C_NUM());
numCoord = trDa.getRO_C_NUM();
coord = trDa.getRO_COORD();
pointArray = new Point3f[numCoord];
for (int index = numCoord - 1 ; index >= 0 ; index = index - 1)
{
actualP = new Point3f(0.1f * (coord[0][index]).floatValue(),
0f,
-0.1f * (coord[1][index]).floatValue());
pointArray[index] = actualP;
}
// System.out.println("Create Geometry Info Object ");
actualGI = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
actualGI.setCoordinates(pointArray);
//Setup Triangulator
int[] stripCount = {numCoord};
actualGI.setStripCounts(stripCount);
Triangulator tri = new Triangulator();
tri.triangulate(actualGI);
//Create Shape , Appearance, Draw Mode
Appearance app = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(new Color3f(0.0f,0.0f,0.0f));
PolygonAttributes pa = new PolygonAttributes();
pa.setCapability(PolygonAttributes.ALLOW_MODE_WRITE);
pa.setCullFace(PolygonAttributes.CULL_NONE);
pa.setPolygonMode(PolygonAttributes.POLYGON_LINE);
app.setColoringAttributes(ca);
app.setPolygonAttributes(pa);
Shape3D shape = new Shape3D();
shape.setGeometry(actualGI.getGeometryArray());
shape.setAppearance(app);
BranchGroup bg = new BranchGroup();
bg.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
bg.setCapability(BranchGroup.ALLOW_DETACH);
bg.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
bg.addChild(shape);
System.out.println("End createRO");
return bg;
}
--
http://w5.cs.uni-sb.de/~baus
Email : [EMAIL PROTECTED]
Phone : +49-681-302-2016
Fax : +49-681-302-4136
===========================================================================
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".