Hi,

When you set the stripCounts Array, it specifies how many vertices are
in each separate strip (or fan). So, the sum of values in stripCounts
should be the same as the number of points.

Instead of stripCounts of 17, use:

int stripCounts[] = {10};       // your only strip has 10 vertices

Also, you don't need to include vertex  (0,0,0) again in the fan.

_______
Carlos


Andy wrote:

>Hi Java3D Dev Team:
>
>In Tutorial 2, it shows that TriangleFanArray is having a parameter of
>vertexCount which is TriangleFanArray(vertexCount....).  However, is this
>vertexCount or stripCount?  Since I created a Fan with 10 points(vertices)
>only including the central point, I should have this ".....= new
>TriangleFanArray(10, TriangleFanArray.COORDINATES, stripCounts);" instead of
>"....=new TriangleFanArray(17....);".  However, if I make it 10, it will
>have runtime error.  What is the problem?  Here is my source code:
>
>private BranchGroup createCone(){
>                BranchGroup root = new BranchGroup();
>
>                // CREATE ALL TRIANGLES //
>                TriangleFanArray tfa;
>                int s = 8;
>                int v = s + 1;
>                int totalV = v + 1;
>                Point3f coords[] = new Point3f[v+1];
>                int stripCounts[] = {17};
>                float r = 0.5f;
>                float x, y;
>                double angle = 360 / s;
>
>                coords[0] = new Point3f(0.0f, 0.0f, 0.0f);
>
>                for(int a = 1, n = 0; a <= s; a++, n++){
>                        x = r * EngMath.cos(n*angle);
>                        y = r * EngMath.sin(n*angle);
>
>                        coords[a] = new Point3f(x, y, 0.0f);
>                }
>
>                coords[9] = new Point3f(0.0f, 0.0f, 0.0f);
>
>                tfa = new TriangleFanArray(10, TriangleFanArray.COORDINATES,
>stripCounts);
>                tfa.setCoordinates(0, coords);
>                root.addChild(new Shape3D(tfa));
>                return root;
>        }
>
>Please help.  Thanks.
>
>Andy
>
>===========================================================================
>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".
>

===========================================================================
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".

Reply via email to