Calculate centroid of 2D non crossing polygon

Posted on Leave a commentPosted in java

Calculate centroid of 2D non crossing polygon, To accommodate that points are correct using Gift wrapping algorithm(Finding Convex Hull) Test case   import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull;   import java.awt.Point; import java.util.ArrayList; import java.util.Arrays; import java.util.List;   import org.junit.Test;   public class MathUtilTest {   @Test public void computeCentroidWithHull() { Point p1 = new […]

Find Convex hull of given points using Gift wrapping algorithm

Posted on 3 CommentsPosted in java

Find Convex hull of given points using Gift wrapping algorithm This is implementation of Grift wrapping algorithm for finding convex hull.   private static final Integer ZERO = new Integer(0);     /** * Find Convex hull of given points * * @ref http://en.wikipedia.org/wiki/Gift_wrapping_algorithm * @param vertices * @return */ private static List<Point> findConvexHull(final List<Point> […]