Αποτελέσματα Αναζήτησης
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) {
* In an n-sided regular polygon, all sides have the same length and all angles have the same degree * (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains:
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.
You are going to have to figure out the angle for each corner, which would be the same for each in a regular polygon. Then how long you want each side to be. Then run a for loop to add all points to the polygon object. Take a look at this example.
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. Use whatever is shorter in your language.
(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).