Question: //I am trying to create a cone shape using TriangleFanArray to create triangles that wrap around to make the shape One shape is a self-made

//I am trying to create a cone shape using TriangleFanArray to create triangles that wrap around to make the shape

One shape is a self-made cone, which is spatially symmetrical to the orange-colored cone made in the previous lab. The self-made cone is actually a pyramid in shape, and its curved shape is approximated by increasing the number of sides of the pyramid.

i. Its bottom side is a disk approximated by an n-sided regular polygon in solid blue color, whose illustration in the figure and video has n set to 15. The distance from the center point to the corners on the side of the polygon is 0.6.

ii. The height of the pyramid is 0.6 as well.

iii. The side of the pyramid is created with triangles that connect the apex point to the corners of the bottom side.

//use this method to make the shape

protected Node create_Object() {

int n, N = 15;

int m = 2 *(N+1), StripCount[] = {N+1, N+1};

float a, x, z, r = 0.6f;

Point3f coord[] = new Point3f[m];

coord[0 * (N+1)] = new Point3f(0, 0.6f, -0.6f);

coord[1 * (N+1)] = new Point3f(0f,-.6f, -0.6f);

for(a = 0, n = 0; n < N; n++) {

a = (float) (2.0 * Math.PI / (N -1 )* n);

x = (float) (r * Math.cos(a));

z = (float) (r * Math.sin(a));

coord[0 * (N+1) + N - n] = new Point3f(x,0f,z);

coord[1 * (N+1) + n + 1] = new Point3f(x, 0f, z);

}

TriangleFanArray tfa = new TriangleFanArray(m, TriangleFanArray.COORDINATES, StripCount);

tfa.setCoordinates(0, coord);

return new Shape3D(tfa);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!