make Polygon Area - Java java.lang

Java examples for java.lang:Math Geometry Shape

Description

make Polygon Area

Demo Code


//package com.java2s;
import java.awt.Polygon;

public class Main {
    public static Polygon makeArea(Polygon polygon, int steps, int dX,
            int dY) {
        // make this an area!
        for (int i = steps - 1; i >= 0; --i) {
            polygon.addPoint(polygon.xpoints[i] + dX, polygon.ypoints[i]
                    + dY);//  ww  w . j av  a 2s . com
        }
        return polygon;
    }
}

Related Tutorials