Package geomerative

Class RMesh


  • public class RMesh
    extends RGeomElem
    RMesh is a reduced interface for creating, holding and drawing meshes. A mesh is a group of triangular strips (RStrip).
    • Field Detail

      • type

        public int type
      • strips

        public RStrip[] strips
        Array of RStrip objects holding the contours of the polygon.
    • Constructor Detail

      • RMesh

        public RMesh()
        Create a new empty mesh.
      • RMesh

        public RMesh​(RMesh m)
        Copy a mesh.
        Parameters:
        m - the object of which to make a copy
    • Method Detail

      • countStrips

        public int countStrips()
        Use this method to count the number of strips in the mesh.
        Returns:
        int, the number strips in the mesh
      • addStrip

        public void addStrip​(RStrip s)
        Add a new strip.
        Parameters:
        s - the strip to be added
      • addStrip

        public void addStrip()
      • setCurrent

        public void setCurrent​(int indStrip)
        Use this method to set the current strip to which append points.
      • addPoint

        public void addPoint​(RPoint p)
        Add a new point to the current strip.
        Parameters:
        p - the point to be added
      • addPoint

        public void addPoint​(float x,
                             float y)
        Add a new point to the current strip.
        Parameters:
        x - the x coordinate of the point to be added
        y - the y coordinate of the point to be added
      • addPoint

        public void addPoint​(int indStrip,
                             RPoint p)
        Add a new point to the given strip.
        Parameters:
        indStrip - the index of the strip to which the point will be added
        p - the point to be added
      • addPoint

        public void addPoint​(int indStrip,
                             float x,
                             float y)
        Add a new point to the given strip.
        Parameters:
        indStrip - the index of the strip to which the point will be added
        x - the x coordinate of the point to be added
        y - the y coordinate of the point to be added
      • draw

        public void draw​(processing.core.PGraphics g)
        Use this method to draw the mesh.
        Specified by:
        draw in class RGeomElem
        Parameters:
        g - PGraphics, the graphics object on which to draw the mesh
      • draw

        public void draw​(processing.core.PApplet g)
        Specified by:
        draw in class RGeomElem
      • getHandles

        public RPoint[] getHandles()
        Use this to get the vertices of the mesh. It returns the points as an array of RPoint.
        Specified by:
        getHandles in class RGeomElem
        Returns:
        RPoint[], the vertices returned in an array.
      • getPoints

        public RPoint[] getPoints()
        Use this to get the vertices of the mesh. It returns the points as an array of RPoint.
        Specified by:
        getPoints in class RGeomElem
        Returns:
        RPoint[], the vertices returned in an array.
      • getType

        public int getType()
        Use this method to get the type of element this is.
        Specified by:
        getType in class RGeomElem
        Returns:
        int, will allways return RGeomElem.MESH
      • transform

        public void transform​(RMatrix m)
        Use this method to transform the mesh.
        Overrides:
        transform in class RGeomElem
        Parameters:
        m - RMatrix, the matrix of the affine transformation to apply to the mesh
      • toPolygon

        public RPolygon toPolygon()
                           throws java.lang.RuntimeException
        Overrides:
        toPolygon in class RGeomElem
        Throws:
        java.lang.RuntimeException
      • toShape

        public RShape toShape()
                       throws java.lang.RuntimeException
        Specified by:
        toShape in class RGeomElem
        Throws:
        java.lang.RuntimeException