Class Polygon2D


  • public class Polygon2D
    extends java.lang.Object
    indexed polygon class that saves N indices to the N vertices of the polygon
    • Constructor Detail

      • Polygon2D

        public Polygon2D​(long cPtr,
                         boolean cMemoryOwn)
      • Polygon2D

        public Polygon2D()
    • Method Detail

      • getCPtr

        public static long getCPtr​(Polygon2D obj)
      • delete

        public void delete()
      • addVertex

        public void addVertex​(Vector2D p)
        Adds a vertex to the polygon

        The point will be added to the end of the list of points
        Parameters:
        p - [in] The point to add
      • removeVertex

        public void removeVertex​(long idx)
        Removes vertex from the polygon

        Parameters:
        idx - [in] Index of the vertex to remove
      • getVertex

        public Vector2D getVertex​(long idx)
        returns the index of vertex i of the triangle
      • set

        public void set​(long i,
                        Vector2D d)
      • size

        public long size()
        Number of vertices of this polygon
        Returns:
        Number of vertices
      • computeCenter

        public Vector2D computeCenter()
        Computes the center of the polygon as the average of all coordinates
        Returns:
        Center of the polygon