Package gov.nih.mipav.model.algorithms
Class ContourPlot.Triangles
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Triangles
- All Implemented Interfaces:
ContourPlot.Renderable
- Enclosing class:
ContourPlot
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
.
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.
invalid reference
FBO
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 Summary
FieldsModifier and TypeFieldDescriptionprotected DoubleSupplierprotected DoubleSupplierprotected booleanprotected booleanprotected ArrayList<ContourPlot.TriangleDetails> protected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatfloatReturns the triangles that intersect or contain the specified rectangle.booleanintersects(Rectangle2D rect) tests if thisContourPlot.Renderableintersects or contains the specified rectangle.booleanReturn true when anti-aliasing is enabled for fallback (AWT) rendering (default=false).booleanisDirty()if true, indicates that a call tois necessary to sync this objects GL resources to its current state.invalid reference
#updateGL(boolean)booleanisHidden()Indicates whether this Renderable is hidden i.e. will not be drawn.intRemoves all TriangleDetails from this collection.setDirty()Sets theisDirty()state of thisContourPlot.Trianglesobject to true.setGlobalAlphaMultiplier(double globalAlphaMultiplier) Sets the global alpha multiplier parameter of thisContourPlot.Trianglesobject.setGlobalAlphaMultiplier(DoubleSupplier globalAlphaMultiplier) Sets the global alpha multiplier parameter of thisContourPlot.Trianglesobject.
-
Field Details
-
isDirty
protected boolean isDirty -
globalAlphaMultiplier
-
globalSaturationMultiplier
-
triangles
-
useCrispEdgesForSVG
protected boolean useCrispEdgesForSVG -
useAAinFallback
protected boolean useAAinFallback
-
-
Constructor Details
-
Triangles
public Triangles()
-
-
Method Details
-
numTriangles
public int numTriangles()- Returns:
- the number of triangles in this collection.
-
intersects
Description copied from interface:ContourPlot.Renderabletests if thisContourPlot.Renderableintersects or contains the specified rectangle.- Specified by:
intersectsin interfaceContourPlot.Renderable- Parameters:
rect- rectangle to test- Returns:
- true when intersecting
-
isHidden
public boolean isHidden()Description copied from interface:ContourPlot.RenderableIndicates whether this Renderable is hidden i.e. will not be drawn.- Specified by:
isHiddenin interfaceContourPlot.Renderable- Returns:
- true when hidden
-
getTriangleDetails
- Returns:
- the list of triangle details.
Make sure to callsetDirty()when manipulating.
-
setGlobalAlphaMultiplier
Sets the global alpha multiplier parameter of thisContourPlot.Trianglesobject. The value will be multiplied with each vertex' alpha color value when rendering. The triangle will then be rendered with the opacityalpha = 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
Sets the global alpha multiplier parameter of thisContourPlot.Trianglesobject. The value will be multiplied with each vertex' alpha color value when rendering. The triangle will then be rendered with the opacityalpha = 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.Renderableif true, indicates that a call tois necessary to sync this objects GL resources to its current state.invalid reference
#updateGL(boolean)- Specified by:
isDirtyin interfaceContourPlot.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
Returns the triangles that intersect or contain the specified rectangle.- Parameters:
rect- rectangle to test intersection- Returns:
- list of intersecting triangles
-
removeAllTriangles
Removes all TriangleDetails from this collection. Sets theisDirty()state to true.- Returns:
- this for chaining
-
setDirty
Sets theisDirty()state of thisContourPlot.Trianglesobject to true.- Returns:
- this for chaining
-