Question: Could someone help me to solve these problems by using three.js and Javascript? Problem 1 Write the function regularPolygonGeometry(n, innerColor, outerColor) that returns a mesh
Could someone help me to solve these problems by using three.js and Javascript?

Problem 1 Write the function regularPolygonGeometry(n, innerColor, outerColor) that returns a mesh representing an n-sided regular polygon. The polygon should be centered at the origin, lie in the xy-plane, and have radius 2 (the distance from the origin to each of the polygon's n vertices is equal to 2). Use your function in a three.js program that produces an 8-sided (or 12- or 16- or whatever-sided) polygon. Colors should interpolate from the polygon's center (innerColor) to its perimeter (outerColor). Problem 2 Write the function linedCylinder (n, radius, height, color) that returns the line mesh of a ruled n-sided cylinder of given color. The cylinder should be centered at the origin, aligned with the y-axis, and have given radius and height. Problem 3 Write an analogous function that generates and returns the geometry of a cylinder. The function createCylinder (n, rad, len) returns the geometry of an n-sided cylinder of radius rad. It should be centered at the origin and aligned with the y-axis, so that the cylinder's top face lies in the plane y = len/2 and its bottom face in the plane y = -len/2. Do not use THREE.Cylinder Geometry. Rather, your function should define the geometry as was done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
