Class GeometryBuilder


  • public class GeometryBuilder
    extends java.lang.Object
    • Constructor Detail

      • GeometryBuilder

        public GeometryBuilder()
    • Method Detail

      • getOrientation

        public int getOrientation()
      • setOrientation

        public void setOrientation​(int orientation)
      • getCylinderVertexCount

        public int getCylinderVertexCount​(int slices,
                                          int stacks)
      • getCylinderIndexCount

        public int getCylinderIndexCount​(int slices,
                                         int stacks)
      • getCylinderOutlineIndexCount

        public int getCylinderOutlineIndexCount​(int slices,
                                                int stacks)
      • getCylinderDrawMode

        public int getCylinderDrawMode()
      • getCylinderOutlineDrawMode

        public int getCylinderOutlineDrawMode()
      • makeCylinderLocations

        public LatLon[] makeCylinderLocations​(Globe globe,
                                              LatLon center,
                                              double radius,
                                              int slices)
      • makeCylinderLocations

        public LatLon[] makeCylinderLocations​(Globe globe,
                                              LatLon center,
                                              double minorRadius,
                                              double majorRadius,
                                              Angle heading,
                                              int slices)
      • makeCylinderVertices

        public void makeCylinderVertices​(Terrain terrain,
                                         LatLon center,
                                         double radius,
                                         double[] altitudes,
                                         boolean[] terrainConformant,
                                         int slices,
                                         int stacks,
                                         Vec4 refPoint,
                                         float[] dest)
      • makeCylinderVertices

        public void makeCylinderVertices​(Terrain terrain,
                                         LatLon center,
                                         double minorRadius,
                                         double majorRadius,
                                         Angle heading,
                                         double[] altitudes,
                                         boolean[] terrainConformant,
                                         int slices,
                                         int stacks,
                                         Vec4 refPoint,
                                         float[] dest)
      • makeCylinderVertices

        public void makeCylinderVertices​(float radius,
                                         float height,
                                         int slices,
                                         int stacks,
                                         float[] dest)
      • makeCylinderNormals

        public void makeCylinderNormals​(int slices,
                                        int stacks,
                                        float[] dest)
      • makeEllipticalCylinderNormals

        public void makeEllipticalCylinderNormals​(int slices,
                                                  int stacks,
                                                  double minorRadius,
                                                  double majorRadius,
                                                  Angle heading,
                                                  float[] dest)
      • makeCylinderIndices

        public void makeCylinderIndices​(int slices,
                                        int stacks,
                                        int[] dest)
      • makeCylinderOutlineIndices

        public void makeCylinderOutlineIndices​(int slices,
                                               int stacks,
                                               int[] dest)
      • getPartialCylinderVertexCount

        public int getPartialCylinderVertexCount​(int slices,
                                                 int stacks)
      • getPartialCylinderIndexCount

        public int getPartialCylinderIndexCount​(int slices,
                                                int stacks)
      • getPartialCylinderOutlineIndexCount

        public int getPartialCylinderOutlineIndexCount​(int slices,
                                                       int stacks)
      • getPartialCylinderDrawMode

        public int getPartialCylinderDrawMode()
      • getPartialCylinderOutlineDrawMode

        public int getPartialCylinderOutlineDrawMode()
      • makePartialCylinderLocations

        public LatLon[] makePartialCylinderLocations​(Globe globe,
                                                     LatLon center,
                                                     double radius,
                                                     int slices,
                                                     double start,
                                                     double sweep)
      • makePartialCylinderVertices

        public void makePartialCylinderVertices​(Terrain terrain,
                                                LatLon center,
                                                double radius,
                                                double[] altitudes,
                                                boolean[] terrainConformant,
                                                int slices,
                                                int stacks,
                                                double start,
                                                double sweep,
                                                Vec4 refPoint,
                                                float[] dest)
      • makePartialCylinderVertices

        public void makePartialCylinderVertices​(float radius,
                                                float height,
                                                int slices,
                                                int stacks,
                                                float start,
                                                float sweep,
                                                float[] dest)
      • makePartialCylinderNormals

        public void makePartialCylinderNormals​(float radius,
                                               float height,
                                               int slices,
                                               int stacks,
                                               float start,
                                               float sweep,
                                               float[] dest)
      • makePartialCylinderIndices

        public void makePartialCylinderIndices​(int slices,
                                               int stacks,
                                               int[] dest)
      • makePartialCylinderOutlineIndices

        public void makePartialCylinderOutlineIndices​(int slices,
                                                      int stacks,
                                                      int[] dest)
      • getDiskVertexCount

        public int getDiskVertexCount​(int slices,
                                      int loops)
      • getDiskIndexCount

        public int getDiskIndexCount​(int slices,
                                     int loops)
      • getDiskDrawMode

        public int getDiskDrawMode()
      • makeDiskLocations

        public LatLon[] makeDiskLocations​(Globe globe,
                                          LatLon center,
                                          double innerRadius,
                                          double outerRadius,
                                          int slices,
                                          int loops)
      • makeDiskLocations

        public LatLon[] makeDiskLocations​(Globe globe,
                                          LatLon center,
                                          double[] radii,
                                          Angle heading,
                                          int slices,
                                          int loops)
      • makeDiskVertices

        public void makeDiskVertices​(Terrain terrain,
                                     LatLon center,
                                     double innerRadius,
                                     double outerRadius,
                                     double altitude,
                                     boolean terrainConformant,
                                     int slices,
                                     int loops,
                                     Vec4 refPoint,
                                     float[] dest)
      • makeDiskVertices

        public void makeDiskVertices​(Terrain terrain,
                                     LatLon center,
                                     double[] radii,
                                     Angle heading,
                                     double altitude,
                                     boolean terrainConformant,
                                     int slices,
                                     int loops,
                                     Vec4 refPoint,
                                     float[] dest)
      • makeDiskVertices

        public void makeDiskVertices​(float innerRadius,
                                     float outerRadius,
                                     int slices,
                                     int loops,
                                     float[] dest)
      • makeDiskNormals

        public void makeDiskNormals​(int slices,
                                    int loops,
                                    float[] dest)
      • makeDiskVertexNormals

        public void makeDiskVertexNormals​(double innerMinorRadius,
                                          double outerMinorRadius,
                                          int slices,
                                          int loops,
                                          float[] srcVerts,
                                          float[] dest)
      • makeDiskIndices

        public void makeDiskIndices​(int slices,
                                    int loops,
                                    int[] dest)
      • getPartialDiskVertexCount

        public int getPartialDiskVertexCount​(int slices,
                                             int loops)
      • getPartialDiskIndexCount

        public int getPartialDiskIndexCount​(int slices,
                                            int loops)
      • getPartialDiskDrawMode

        public int getPartialDiskDrawMode()
      • makePartialDiskLocations

        public LatLon[] makePartialDiskLocations​(Globe globe,
                                                 LatLon center,
                                                 double innerRadius,
                                                 double outerRadius,
                                                 int slices,
                                                 int loops,
                                                 double start,
                                                 double sweep)
      • makePartialDiskVertices

        public void makePartialDiskVertices​(Terrain terrain,
                                            LatLon center,
                                            double innerRadius,
                                            double outerRadius,
                                            double altitude,
                                            boolean terrainConformant,
                                            int slices,
                                            int loops,
                                            double start,
                                            double sweep,
                                            Vec4 refPoint,
                                            float[] dest)
      • makePartialDiskVertices

        public void makePartialDiskVertices​(float innerRadius,
                                            float outerRadius,
                                            int slices,
                                            int loops,
                                            float start,
                                            float sweep,
                                            float[] dest)
      • makePartialDiskNormals

        public void makePartialDiskNormals​(int slices,
                                           int loops,
                                           float[] dest)
      • makePartialDiskVertexNormals

        public void makePartialDiskVertexNormals​(float innerRadius,
                                                 float outerRadius,
                                                 int slices,
                                                 int loops,
                                                 float start,
                                                 float sweep,
                                                 float[] srcVerts,
                                                 float[] dest)
      • makePartialDiskIndices

        public void makePartialDiskIndices​(int slices,
                                           int loops,
                                           int[] dest)
      • getRadialWallVertexCount

        public int getRadialWallVertexCount​(int pillars,
                                            int stacks)
      • getRadialWallIndexCount

        public int getRadialWallIndexCount​(int pillars,
                                           int stacks)
      • getRadialWallOutlineIndexCount

        public int getRadialWallOutlineIndexCount​(int pillars,
                                                  int stacks)
      • getRadialWallDrawMode

        public int getRadialWallDrawMode()
      • getRadialWallOutlineDrawMode

        public int getRadialWallOutlineDrawMode()
      • makeRadialWallVertices

        public void makeRadialWallVertices​(Terrain terrain,
                                           LatLon center,
                                           double innerRadius,
                                           double outerRadius,
                                           double angle,
                                           double[] altitudes,
                                           boolean[] terrainConformant,
                                           int pillars,
                                           int stacks,
                                           Vec4 refPoint,
                                           float[] dest)
      • makeRadialWallVertices

        public void makeRadialWallVertices​(float innerRadius,
                                           float outerRadius,
                                           float height,
                                           float angle,
                                           int pillars,
                                           int stacks,
                                           float[] dest)
      • makeRadialWallNormals

        public void makeRadialWallNormals​(float innerRadius,
                                          float outerRadius,
                                          float height,
                                          float angle,
                                          int pillars,
                                          int stacks,
                                          float[] dest)
      • makeRadialWallIndices

        public void makeRadialWallIndices​(int pillars,
                                          int stacks,
                                          int[] dest)
      • makeRadialWallOutlineIndices

        public void makeRadialWallOutlineIndices​(int pillars,
                                                 int stacks,
                                                 int[] dest)
      • getLongCylinderVertexCount

        public int getLongCylinderVertexCount​(int arcSlices,
                                              int lengthSlices,
                                              int stacks)
      • getLongCylinderIndexCount

        public int getLongCylinderIndexCount​(int arcSlices,
                                             int lengthSlices,
                                             int stacks)
      • getLongCylinderOutlineIndexCount

        public int getLongCylinderOutlineIndexCount​(int arcSlices,
                                                    int lengthSlices,
                                                    int stacks)
      • getLongCylinderDrawMode

        public int getLongCylinderDrawMode()
      • getLongCylinderOutlineDrawMode

        public int getLongCylinderOutlineDrawMode()
      • makeLongCylinderLocations

        public LatLon[] makeLongCylinderLocations​(Globe globe,
                                                  LatLon center1,
                                                  LatLon center2,
                                                  double radius,
                                                  int arcSlices,
                                                  int lengthSlices)
      • makeLongCylinderVertices

        public void makeLongCylinderVertices​(Terrain terrain,
                                             LatLon center1,
                                             LatLon center2,
                                             double radius,
                                             double[] altitudes,
                                             boolean[] terrainConformant,
                                             int arcSlices,
                                             int lengthSlices,
                                             int stacks,
                                             Vec4 refPoint,
                                             float[] dest)
      • makeLongCylinderVertices

        public void makeLongCylinderVertices​(float radius,
                                             float length,
                                             float height,
                                             int arcSlices,
                                             int lengthSlices,
                                             int stacks,
                                             float[] dest)
      • makeLongCylinderNormals

        public void makeLongCylinderNormals​(int arcSlices,
                                            int lengthSlices,
                                            int stacks,
                                            float[] dest)
      • makeLongCylinderIndices

        public void makeLongCylinderIndices​(int arcSlices,
                                            int lengthSlices,
                                            int stacks,
                                            int[] dest)
      • makeLongCylinderOutlineIndices

        public void makeLongCylinderOutlineIndices​(int arcSlices,
                                                   int lengthSlices,
                                                   int stacks,
                                                   int[] dest)
      • getLongDiskVertexCount

        public int getLongDiskVertexCount​(int arcSlices,
                                          int lengthSlices,
                                          int loops)
      • getLongDiskIndexCount

        public int getLongDiskIndexCount​(int arcSlices,
                                         int lengthSlices,
                                         int loops)
      • getLongDiskDrawMode

        public int getLongDiskDrawMode()
      • makeLongDiskLocations

        public LatLon[] makeLongDiskLocations​(Globe globe,
                                              LatLon center1,
                                              LatLon center2,
                                              double innerRadius,
                                              double outerRadius,
                                              int arcSlices,
                                              int lengthSlices,
                                              int loops)
      • makeLongDiskVertices

        public void makeLongDiskVertices​(Terrain terrain,
                                         LatLon center1,
                                         LatLon center2,
                                         double innerRadius,
                                         double outerRadius,
                                         double altitude,
                                         boolean terrainConformant,
                                         int arcSlices,
                                         int lengthSlices,
                                         int loops,
                                         Vec4 refPoint,
                                         float[] dest)
      • makeLongDiskVertices

        public void makeLongDiskVertices​(float innerRadius,
                                         float outerRadius,
                                         float length,
                                         int arcSlices,
                                         int lengthSlices,
                                         int loops,
                                         float[] dest)
      • makeLongDiskNormals

        public void makeLongDiskNormals​(int arcSlices,
                                        int lengthSlices,
                                        int loops,
                                        float[] dest)
      • makeLongDiskVertexNormals

        public void makeLongDiskVertexNormals​(float innerRadius,
                                              float outerRadius,
                                              float length,
                                              int arcSlices,
                                              int lengthSlices,
                                              int loops,
                                              float[] srcVerts,
                                              float[] dest)
      • makeLongDiskIndices

        public void makeLongDiskIndices​(int arcSlices,
                                        int lengthSlices,
                                        int loops,
                                        int[] dest)
      • computePolygonWindingOrder2

        public int computePolygonWindingOrder2​(int pos,
                                               int count,
                                               Vec4[] points)
      • computePolygonArea2

        public float computePolygonArea2​(int pos,
                                         int count,
                                         Vec4[] points)
      • getIndexedTriangleBufferDrawMode

        public int getIndexedTriangleBufferDrawMode()
      • makeIndexedTriangleBufferNormals

        public void makeIndexedTriangleBufferNormals​(int indexPos,
                                                     int indexCount,
                                                     java.nio.IntBuffer indices,
                                                     int vertexPos,
                                                     int vertexCount,
                                                     java.nio.FloatBuffer vertices,
                                                     java.nio.FloatBuffer dest)
      • makeEllipsoidNormals

        public void makeEllipsoidNormals​(int indexPos,
                                         int indexCount,
                                         java.nio.IntBuffer indices,
                                         int vertexPos,
                                         int vertexCount,
                                         java.nio.FloatBuffer vertices,
                                         java.nio.FloatBuffer dest)
      • makeCylinderNormals

        public void makeCylinderNormals​(int indexPos,
                                        int indexCount,
                                        java.nio.IntBuffer indices,
                                        int vertexPos,
                                        int vertexCount,
                                        java.nio.FloatBuffer vertices,
                                        java.nio.FloatBuffer dest)
      • makeUnitSphereTextureCoordinates

        public void makeUnitSphereTextureCoordinates​(GeometryBuilder.IndexedTriangleBuffer itb,
                                                     java.nio.FloatBuffer texCoords,
                                                     int seamVerticesIndex)
      • makeUnitSphereTextureCoordinates

        public void makeUnitSphereTextureCoordinates​(int vertexCount,
                                                     java.nio.FloatBuffer vertices,
                                                     java.nio.FloatBuffer texCoords,
                                                     int seamVerticesIndex)
      • makeUnitBoxTextureCoordinates

        public void makeUnitBoxTextureCoordinates​(java.nio.FloatBuffer texCoords,
                                                  int vertexCount)
      • makeUnitBoxTextureCoordinates

        public void makeUnitBoxTextureCoordinates​(int index,
                                                  java.nio.FloatBuffer texCoords,
                                                  int vertexCount)
      • makeUnitPyramidTextureCoordinates

        public void makeUnitPyramidTextureCoordinates​(java.nio.FloatBuffer texCoords,
                                                      int vertexCount)
      • makeUnitPyramidTextureCoordinates

        public void makeUnitPyramidTextureCoordinates​(int index,
                                                      java.nio.FloatBuffer texCoords,
                                                      int vertexCount)
      • makeUnitCylinderTextureCoordinates

        public void makeUnitCylinderTextureCoordinates​(int face,
                                                       java.nio.FloatBuffer texCoords,
                                                       int subdivisions)
      • makeWedgeTextureCoordinates

        public void makeWedgeTextureCoordinates​(java.nio.FloatBuffer texCoords,
                                                int subdivisions,
                                                Angle angle)
      • makeUnitWedgeTextureCoordinates

        public void makeUnitWedgeTextureCoordinates​(int face,
                                                    java.nio.FloatBuffer texCoords,
                                                    int subdivisions,
                                                    Angle angle)
      • makeUnitConeTextureCoordinates

        public void makeUnitConeTextureCoordinates​(java.nio.FloatBuffer texCoords,
                                                   int subdivisions)
      • makeUnitConeTextureCoordinates

        public void makeUnitConeTextureCoordinates​(int face,
                                                   java.nio.FloatBuffer texCoords,
                                                   int subdivisions)
      • getIndexedTriangleArrayDrawMode

        public int getIndexedTriangleArrayDrawMode()
      • makeIndexedTriangleArrayNormals

        public void makeIndexedTriangleArrayNormals​(int indexPos,
                                                    int indexCount,
                                                    int[] indices,
                                                    int vertexPos,
                                                    int vertexCount,
                                                    float[] vertices,
                                                    float[] dest)
      • makeIndexedTriangleStripNormals

        public void makeIndexedTriangleStripNormals​(int indexPos,
                                                    int indexCount,
                                                    int[] indices,
                                                    int vertexPos,
                                                    int vertexCount,
                                                    float[] vertices,
                                                    float[] dest)
      • getSubdivisionPointsVertexCount

        public int getSubdivisionPointsVertexCount​(int subdivisions)
      • makeSubdivisionPoints

        public void makeSubdivisionPoints​(float x1,
                                          float y1,
                                          float z1,
                                          float x2,
                                          float y2,
                                          float z2,
                                          int subdivisions,
                                          float[] dest)
      • getBilinearSurfaceFillIndexCount

        public int getBilinearSurfaceFillIndexCount​(int uStacks,
                                                    int vStacks)
      • getBilinearSurfaceOutlineIndexCount

        public int getBilinearSurfaceOutlineIndexCount​(int uStacks,
                                                       int vStacks,
                                                       int mask)
      • getBilinearSurfaceVertexCount

        public int getBilinearSurfaceVertexCount​(int uStacks,
                                                 int vStacks)
      • getBilinearSurfaceFillDrawMode

        public int getBilinearSurfaceFillDrawMode()
      • getBilinearSurfaceOutlineDrawMode

        public int getBilinearSurfaceOutlineDrawMode()
      • makeBilinearSurfaceFillIndices

        public void makeBilinearSurfaceFillIndices​(int vertexPos,
                                                   int uStacks,
                                                   int vStacks,
                                                   int destPos,
                                                   int[] dest)
      • makeBilinearSurfaceOutlineIndices

        public void makeBilinearSurfaceOutlineIndices​(int vertexPos,
                                                      int uStacks,
                                                      int vStacks,
                                                      int mask,
                                                      int destPos,
                                                      int[] dest)
      • makeBilinearSurfaceVertices

        public void makeBilinearSurfaceVertices​(float[] control,
                                                int destPos,
                                                int uStacks,
                                                int vStacks,
                                                float[] dest)
      • makeBilinearSurfaceVertexNormals

        public void makeBilinearSurfaceVertexNormals​(int srcPos,
                                                     int uStacks,
                                                     int vStacks,
                                                     float[] srcVerts,
                                                     int destPos,
                                                     float[] dest)
      • makeEllipse

        public java.nio.FloatBuffer makeEllipse​(float x,
                                                float y,
                                                float majorRadius,
                                                float minorRadius,
                                                int slices)
        Creates a vertex buffer for a two-dimensional ellipse centered at the specified location and with the specified radii. The ellipse's center is placed at (x, y), it has a width of 2 * majorRadius, and a height of 2 * minorRadius.

        If the specified slices is greater than 1 this returns a buffer with vertices evenly spaced along the circumference of the ellipse. Otherwise this returns a buffer with one vertex.

        The returned buffer contains pairs of xy coordinates representing the location of each vertex in the ellipse in a counter-clockwise winding order relative to the z axis. The buffer may be rendered in OpenGL as either a triangle fan or a line loop.

        Parameters:
        x - the x-coordinate of the ellipse's center.
        y - the y-coordinate of the ellipse's center.
        majorRadius - the ellipse's radius along the x axis.
        minorRadius - the ellipse's radius along the y axis.
        slices - the number of slices in the ellipse.
        Returns:
        a buffer containing the ellipse's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if any of majorRadius, minorRadius, or slices are less than zero.
      • makeEllipseWithLeader

        public java.nio.FloatBuffer makeEllipseWithLeader​(float x,
                                                          float y,
                                                          float majorRadius,
                                                          float minorRadius,
                                                          int slices,
                                                          float leaderX,
                                                          float leaderY,
                                                          float leaderWidth)
        Creates a vertex buffer for a two-dimensional ellipse centered at the specified location and with the specified radii. The ellipse's center is placed at (x, y), it has a width of 2 * majorRadius, and a height of 2 * minorRadius.

        If the specified slices is greater than 1 this returns a buffer with vertices evenly spaced along the circumference of the ellipse. Otherwise this returns a buffer with one vertex.

        If the specified leaderWidth is greater than zero and the location (leaderX, leaderY) is outside of the rectangle that encloses the ellipse, the ellipse has a triangle attached to one side with with its top pointing at (leaderX, leaderY). Otherwise this returns an ellipse with no leader and is equivalent to calling makeEllipse(float, float, float, float, int). The leader is attached at the center of either the top, bottom, left, or right side, depending on the leader's location relative to the ellipse. The leader width is limited in size by the side it is attached to. For example, if the leader is attached to the ellipse's bottom, its width is limited by the ellipse's major radius.

        Parameters:
        x - the x-coordinate of the ellipse's center.
        y - the y-coordinate of the ellipse's center.
        majorRadius - the ellipse's radius along the x axis.
        minorRadius - the ellipse's radius along the y axis.
        slices - the number of slices in the ellipse.
        leaderX - the x-coordinate the leader points to.
        leaderY - the y-coordinate the leader points to.
        leaderWidth - the leader triangle's width.
        Returns:
        a buffer containing the ellipse's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if any of majorRadius, minorRadius, slices, or leaderWidth are less than zero.
      • makeRectangle

        public java.nio.FloatBuffer makeRectangle​(float x,
                                                  float y,
                                                  float width,
                                                  float height)
        Creates a vertex buffer for a two-dimensional rectangle at the specified location, and with the specified size. The rectangle's lower left corner is placed at (x, y), and its upper right corner is placed at (x + width, y + height).

        The returned buffer contains pairs of xy coordinates representing the location of each vertex in the rectangle in a counter-clockwise winding order relative to the z axis. The buffer may be rendered in OpenGL as either a triangle fan or a line loop.

        Parameters:
        x - the x-coordinate of the rectangle's lower left corner.
        y - the y-coordinate of the rectangle's lower left corner.
        width - the rectangle's width.
        height - the rectangle's height.
        Returns:
        a buffer containing the rectangle's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if either width or height are less than zero.
      • makeRectangle

        public java.nio.FloatBuffer makeRectangle​(float x,
                                                  float y,
                                                  float width,
                                                  float height,
                                                  float cornerRadius,
                                                  int cornerSlices)
        Creates a vertex buffer for a two-dimensional rectangle at the specified location, with the specified size, and with optionally rounded corners. The rectangle's lower left corner is placed at the (x, y), and its upper right corner is placed at (x + width, y + height).

        If the specified cornerRadius and cornerSlices are greater than 0, the rectangle's corners have a rounded appearance. The radius specifies the size of a rounded corner, and the slices specifies the number of segments that make a rounded corner. If either cornerRadius or cornerSlices are 0, this returns a rectangle with sharp corners and is equivalent to calling makeRectangle(float, float, float, float). The cornerRadius is limited by the rectangle's width and height. For example, if the corner radius is 100 and the width and height are 50 and 100, the actual corner radius used is 25 - half of the rectangle's smallest dimension.

        The returned buffer contains pairs of xy coordinates representing the location of each vertex in the rectangle in a counter-clockwise winding order relative to the z axis. The buffer may be rendered in OpenGL as either a triangle fan or a line loop.

        Parameters:
        x - the x-coordinate of the rectangle's lower left corner.
        y - the y-coordinate of the rectangle's lower left corner.
        width - the rectangle's width.
        height - the rectangle's height.
        cornerRadius - the rectangle's rounded corner radius, or 0 to disable rounded corners.
        cornerSlices - the number of slices in each rounded corner, or 0 to disable rounded corners.
        Returns:
        a buffer containing the rectangle's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if any of width, height, cornerRadius, or cornerSlices are less than zero.
      • makeRectangleWithLeader

        public java.nio.FloatBuffer makeRectangleWithLeader​(float x,
                                                            float y,
                                                            float width,
                                                            float height,
                                                            float leaderX,
                                                            float leaderY,
                                                            float leaderWidth)
        Creates a vertex buffer for a two-dimensional rectangle at the specified location, with the specified size, and with an optional leader pointing to the specified leader location. The rectangle's lower left corner is placed at (x, y), and its upper right corner is placed at (x + width, y + height).

        If the specified leaderWidth is greater than zero and the location (leaderX, leaderY) is outside of the rectangle, the rectangle has a triangle attached to one side with with its top pointing at (leaderX, leaderY). Otherwise this returns a rectangle with no leader and is equivalent to calling makeRectangle(float, float, float, float). The leader is attached at the center of either the top, bottom, left, or right side, depending on the leader's location relative to the rectangle. The leader width is limited in size by the side it is attached to. For example, if the leader is attached to the rectangle's bottom, its width is limited by the rectangle's width.

        The returned buffer contains pairs of xy coordinates representing the location of each vertex in the rectangle in a counter-clockwise winding order relative to the z axis. The buffer may be rendered in OpenGL as either a triangle fan or a line loop.

        Parameters:
        x - the x-coordinate of the rectangle's lower left corner.
        y - the y-coordinate of the rectangle's lower left corner.
        width - the rectangle's width.
        height - the rectangle's height.
        leaderX - the x-coordinate the leader points to.
        leaderY - the y-coordinate the leader points to.
        leaderWidth - the leader triangle's width.
        Returns:
        a buffer containing the rectangle's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if any of width, height, or leaderWidth are less than zero.
      • makeRectangleWithLeader

        public java.nio.FloatBuffer makeRectangleWithLeader​(float x,
                                                            float y,
                                                            float width,
                                                            float height,
                                                            float cornerRadius,
                                                            int cornerSlices,
                                                            float leaderX,
                                                            float leaderY,
                                                            float leaderWidth)
        Creates a vertex buffer for a two-dimensional rectangle at the specified location, with the specified size, and with optionally rounded corners. The rectangle's lower left corner is placed at the (x, y), and its upper right corner is placed at (x + width, y + height).

        If the specified cornerRadius and cornerSlices are greater than 0, the rectangle's corners have a rounded appearance. The radius specifies the size of a rounded corner, and the slices specifies the number of segments that make a rounded corner. If either cornerRadius or cornerSlices are 0, this returns a rectangle with sharp corners and is equivalent to calling makeRectangleWithLeader(float, float, float, float, float, float, float) . The cornerRadius is limited by the rectangle's width and height. For example, if the corner radius is 100 and the width and height are 50 and 100, the actual corner radius used is 25 - half of the rectangle's smallest dimension.

        If the specified leaderWidth is greater than zero and the location (leaderX, leaderY) is outside of the rectangle, the rectangle has a triangle attached to one side with with its top pointing at (leaderX, leaderY). Otherwise this returns a rectangle with no leader and is equivalent to calling makeRectangle(float, float, float, float, float, int). The leader is attached at the center of either the top, bottom, left, or right side, depending on the leader's location relative to the rectangle. The leader width is limited in size by the side it is attached to. For example, if the leader is attached to the rectangle's bottom, its width is limited by the rectangle's width minus any area used by the rounded corners.

        The returned buffer contains pairs of xy coordinates representing the location of each vertex in the rectangle in a counter-clockwise winding order relative to the z axis. The buffer may be rendered in OpenGL as either a triangle fan or a line loop.

        Parameters:
        x - the x-coordinate of the rectangle's lower left corner.
        y - the y-coordinate of the rectangle's lower left corner.
        width - the rectangle's width.
        height - the rectangle's height.
        cornerRadius - the rectangle's rounded corner radius, or 0 to disable rounded corners.
        cornerSlices - the number of slices in each rounded corner, or 0 to disable rounded corners.
        leaderX - the x-coordinate the leader points to.
        leaderY - the y-coordinate the leader points to.
        leaderWidth - the leader triangle's width.
        Returns:
        a buffer containing the rectangle's x and y locations.
        Throws:
        java.lang.IllegalArgumentException - if any of width, height, cornerRadius, cornerSlices, or leaderWidth are less than zero.
      • addRectangleRoundedCorner

        protected void addRectangleRoundedCorner​(float x,
                                                 float y,
                                                 float radius,
                                                 float start,
                                                 float sweep,
                                                 int slices,
                                                 java.nio.FloatBuffer buffer)
        Adds the vertices for one rounded corner of a two-dimensional rectangular to the specified buffer. This assumes that the first and last vertices of each corner are created by the caller, so this adds only the intermediate vertices. The number of intermediate vertices is equal to slices - 2. This does nothing if slices is one or zero.
        Parameters:
        x - the x-coordinate of the corner's origin.
        y - the y-coordinate of the corner's origin.
        radius - the corner's radius.
        start - the corner's starting angle, in radians.
        sweep - the corner's angular distance, in radians.
        slices - the number of slices in the corner.
        buffer - the buffer the corner's xy coordinates are added to.
      • computeLeaderLocationCode

        protected int computeLeaderLocationCode​(float x1,
                                                float y1,
                                                float x2,
                                                float y2,
                                                float leaderX,
                                                float leaderY)
        Returns a four bit code indicating the leader's location within the specified rectangle. The rectangle's lower left corner is located at (x1, y1) and its upper right corner is located at (x2, y2). The returned code includes the bit for any of LEADER_LOCATION_LEFT, LEADER_LOCATION_RIGHT, LEADER_LOCATION_BOTTOM, and LEADER_LOCATION_TOP, depending on whether the leader is located to the left, right, bottom, or top of the rectangle. If the leader is inside the rectangle, this returns LEADER_LOCATION_INSIDE.
        Parameters:
        x1 - the rectangle's minimum x-coordinate.
        y1 - the rectangle's maximum x-coordinate.
        x2 - the rectangle's minimum y-coordinate.
        y2 - the rectangle's maximum y-coordinate.
        leaderX - the leader's x-coordinate.
        leaderY - the leader's y-coordinate.
        Returns:
        a four bit code indicating the leader's location relative to the rectangle.
      • reversePoints

        public <T> void reversePoints​(int pos,
                                      int count,
                                      T[] points)