@Test public void testCalculateArea() { Polygon polygon = new Polygon(1, new Vector3(0, 0), new Vector3(0, 1), new Vector3(1, 0)); Assert.assertEquals(0.5, polygon.getArea(), 0.001); }
public void calculateArea() { float signedArea = getAndCalcSignedArea(); if (signedArea < 0) { counterClockWise = false; } else { counterClockWise = true; } area = (float) Math.abs(signedArea); }
Polygon implements Shape { public void calculateArea() { float signedArea = getAndCalcSignedArea(); if (signedArea < 0) { counterClockWise = false; } else { counterClockWise = true; } area = (float) Math.abs(signedArea); } }
Polygon implements Shape { public void calculateArea() { float signedArea = getAndCalcSignedArea(); if (signedArea < 0) { counterClockWise = false; } else { counterClockWise = true; } area = (float) Math.abs(signedArea); } Polygon(int index, List<Vector3> points, int[] vectorIndexs);  Polygon(int index, List<Vector3> points, int[] vectorIndexs,boolean initCalculate);  Polygon(int index, Vector3... point);  Polygon(List<Vector3> points); }
Polygon implements Shape { public void calculateArea() { float signedArea = getAndCalcSignedArea(); if (signedArea < 0) { counterClockWise = false; } else { counterClockWise = true; } area = (float) Math.abs(signedArea); } Polygon(int index, List<Vector3> points, int[] vectorIndexs);  Polygon(int index, List<Vector3> points, int[] vectorIndexs,boolean initCalculate);  Polygon(int index, Vector3... point);  Polygon(List<Vector3> points); void calculateCenter(); void calculateRadius(); void calculateArea(); float getAndCalcSignedArea(); boolean calculateIsConvex(); float getArea(); int getIndex(); Vector3 getPoint(int i); boolean isInnerPoint(Vector3 point); boolean isOnEdge(Vector3 point); boolean contains(Polygon polygon); boolean contains(Vector3 p); boolean intersectsEdge(Polygon polygon); @Override String toString(); @Override Rectangle getBounds(); @Override Rectangle2D getBounds2D(); @Override boolean contains(double x, double z); @Override boolean contains(Point2D p); @Override boolean intersects(double x, double y, double w, double h); @Override boolean intersects(Rectangle2D r); @Override boolean contains(double x, double y, double w, double h); @Override boolean contains(Rectangle2D r); @Override PathIterator getPathIterator(AffineTransform at); @Override PathIterator getPathIterator(AffineTransform at, double flatness); String print(); }
Polygon implements Shape { public void calculateArea() { float signedArea = getAndCalcSignedArea(); if (signedArea < 0) { counterClockWise = false; } else { counterClockWise = true; } area = (float) Math.abs(signedArea); } Polygon(int index, List<Vector3> points, int[] vectorIndexs);  Polygon(int index, List<Vector3> points, int[] vectorIndexs,boolean initCalculate);  Polygon(int index, Vector3... point);  Polygon(List<Vector3> points); void calculateCenter(); void calculateRadius(); void calculateArea(); float getAndCalcSignedArea(); boolean calculateIsConvex(); float getArea(); int getIndex(); Vector3 getPoint(int i); boolean isInnerPoint(Vector3 point); boolean isOnEdge(Vector3 point); boolean contains(Polygon polygon); boolean contains(Vector3 p); boolean intersectsEdge(Polygon polygon); @Override String toString(); @Override Rectangle getBounds(); @Override Rectangle2D getBounds2D(); @Override boolean contains(double x, double z); @Override boolean contains(Point2D p); @Override boolean intersects(double x, double y, double w, double h); @Override boolean intersects(Rectangle2D r); @Override boolean contains(double x, double y, double w, double h); @Override boolean contains(Rectangle2D r); @Override PathIterator getPathIterator(AffineTransform at); @Override PathIterator getPathIterator(AffineTransform at, double flatness); String print(); public int index; public List<Vector3> points; public float y; public Vector3 center; public float area; public boolean counterClockWise; public boolean convex; public float radius; public float radiusSq; public int[] vectorIndexs; transient List<Connection<Polygon>> connections; public List<Vector3> randomPoints; }