Αποτελέσματα Αναζήτησης
The formula for computing the area of a regular polygon is * Area=n s24 tan (n). * <p> * Draw the UML diagram for the class and then implement the class. * <p> * Write a test program that creates three RegularPolygon objects, * created using the no-arg constructor, using RegularPolygon (6, 4), * and using RegularPolygon (10, 4, 5.6, 7.8).
/** creates a regular polygon with the specified number /* of sides, length of side, and x- and y-coordinates */ RegularPolygon(int newN, double newSide, double newX, double newY) {
(Geometry: area of a regular polygon) A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular).
16 Δεκ 2012 · In order to turn your polygon by X degrees, convert X to radians, and add the result to the angle in the formula, like this: (2*Math.PI*K)/N + Xrad. Finally, since the origin of the screen is in one of the corners, only a portion of your polygon is going to be visible.
I have been trying to figure out how to write a simple program to compute the x,y points for creating a regular polygon of n sides. Can someone give me some code examples that don't use preexisting functions that draw polygons?
16 Απρ 2014 · The goal of this code golf is to draw a regular polygon (one with equal side lengths) given the number of sides and radius (distance from center to vertex). The number of sides and the radius can be entered via a file, STDIN, or just a plain old variable.
public class RegularPolygon { private int n; // number of polygin sides private double side; // length of side private double x; // x-coordinate of polygon's center private double y; // y-coordinate of polygon's center /* * no-arg constructor */ public RegularPolygon () { n = 3; side = 1; x = 0; y = 0; } /** * parameter ...