Class ContourPlot.Triangles

java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Triangles
All Implemented Interfaces:
ContourPlot.Renderable
Enclosing class:
ContourPlot

public class ContourPlot.Triangles extends 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
invalid reference
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 Details

    • isDirty

      protected boolean isDirty
    • globalAlphaMultiplier

      protected DoubleSupplier globalAlphaMultiplier
    • globalSaturationMultiplier

      protected DoubleSupplier globalSaturationMultiplier
    • triangles

      protected ArrayList<ContourPlot.TriangleDetails> triangles
    • useCrispEdgesForSVG

      protected boolean useCrispEdgesForSVG
    • useAAinFallback

      protected boolean useAAinFallback
    • hidden

      protected boolean hidden
  • Constructor Details

    • Triangles

      public Triangles()
  • Method Details

    • numTriangles

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

      public boolean intersects(Rectangle2D rect)
      Description copied from interface: ContourPlot.Renderable
      tests if this ContourPlot.Renderable intersects or contains the specified rectangle.
      Specified by:
      intersects in interface ContourPlot.Renderable
      Parameters:
      rect - rectangle to test
      Returns:
      true when intersecting
    • isHidden

      public boolean isHidden()
      Description copied from interface: ContourPlot.Renderable
      Indicates whether this Renderable is hidden i.e. will not be drawn.
      Specified by:
      isHidden in interface ContourPlot.Renderable
      Returns:
      true when hidden
    • getTriangleDetails

      public 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(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
      invalid reference
      #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 List<ContourPlot.TriangleDetails> getIntersectingTriangles(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
    • setDirty

      public ContourPlot.Triangles setDirty()
      Sets the isDirty() state of this ContourPlot.Triangles object to true.
      Returns:
      this for chaining