Class ContourPlot.Triangles

  • All Implemented Interfaces:
    ContourPlot.Renderable
    Enclosing class:
    ContourPlot

    public class ContourPlot.Triangles
    extends java.lang.Object
    implements ContourPlot.Renderable
    The Triangles class is a collection of 2D triangles. A single triangle consists of three 2D points where each of these points can be colored differently which leads to the triangle area being colored by interpolating using barycentric coordinates. Also a triangle can have a single picking color, which is the color with which the triangle is rendered into the (invisible) picking color attachment of an FBO. This color may serve as an identifier of the object that can be queried from a location of the rendering canvas. It may take on a value in range of 0xff000001 to 0xffffffff (16.777.214 possible values) or 0.

    There is also a global alpha multiplier parameter which scales every triangle's color alpha value, which can be used to introduce transparency for all triangles of this collection. This may come in handy to let other rendered content under a triangle 'shine through'.

    Author:
    hageldave
    • Field Detail

      • isDirty

        protected boolean isDirty
      • globalAlphaMultiplier

        protected java.util.function.DoubleSupplier globalAlphaMultiplier
      • globalSaturationMultiplier

        protected java.util.function.DoubleSupplier globalSaturationMultiplier
      • useCrispEdgesForSVG

        protected boolean useCrispEdgesForSVG
      • useAAinFallback

        protected boolean useAAinFallback
      • hidden

        protected boolean hidden
    • Constructor Detail

      • Triangles

        public Triangles()
    • Method Detail

      • numTriangles

        public int numTriangles()
        Returns:
        the number of triangles in this collection.
      • getTriangleDetails

        public java.util.ArrayList<ContourPlot.TriangleDetails> getTriangleDetails()
        Returns:
        the list of triangle details.
        Make sure to call setDirty() when manipulating.
      • setGlobalAlphaMultiplier

        public ContourPlot.Triangles setGlobalAlphaMultiplier​(double globalAlphaMultiplier)
        Sets the global alpha multiplier parameter of this ContourPlot.Triangles object. The value will be multiplied with each vertex' alpha color value when rendering. The triangle will then be rendered with the opacity alpha = globalAlphaMultiplier * point.alpha.
        Parameters:
        globalAlphaMultiplier - of the triangles in this collection
        Returns:
        this for chaining
      • getGlobalSaturationMultiplier

        public float getGlobalSaturationMultiplier()
        Returns:
        the saturation multiplier of this renderable
      • setGlobalAlphaMultiplier

        public ContourPlot.Triangles setGlobalAlphaMultiplier​(java.util.function.DoubleSupplier globalAlphaMultiplier)
        Sets the global alpha multiplier parameter of this ContourPlot.Triangles object. The value will be multiplied with each vertex' alpha color value when rendering. The triangle will then be rendered with the opacity alpha = globalAlphaMultiplier * point.alpha.
        Parameters:
        globalAlphaMultiplier - of the triangles in this collection
        Returns:
        this for chaining
      • getGlobalAlphaMultiplier

        public float getGlobalAlphaMultiplier()
        Returns:
        the global alpha multiplier of the triangles in this collection
      • isDirty

        public boolean isDirty()
        Description copied from interface: ContourPlot.Renderable
        if true, indicates that a call to #updateGL(boolean) is necessary to sync this objects GL resources to its current state.
        Specified by:
        isDirty in interface ContourPlot.Renderable
        Returns:
        true if dirty
      • isAAinFallbackEnabled

        public boolean isAAinFallbackEnabled()
        Return true when anti-aliasing is enabled for fallback (AWT) rendering (default=false).

        Especially for triangle grids/meshes this option should be disabled to avoid visible triangle edges inside the grid/mesh. When triangles are not connected, this option can be enabled to get anti-aliased edges.

        Returns:
        true when enabled
      • getIntersectingTriangles

        public java.util.List<ContourPlot.TriangleDetails> getIntersectingTriangles​(java.awt.geom.Rectangle2D rect)
        Returns the triangles that intersect or contain the specified rectangle.
        Parameters:
        rect - rectangle to test intersection
        Returns:
        list of intersecting triangles
      • removeAllTriangles

        public ContourPlot.Triangles removeAllTriangles()
        Removes all TriangleDetails from this collection. Sets the isDirty() state to true.
        Returns:
        this for chaining