jvx.numeric
Class PnLIC
- java.lang.Object
-
- jvx.numeric.PnLIC
-
public class PnLIC extends java.lang.ObjectLine Integral Convolution for vector field visualization.After constructing an instance of this class one can immediately get the resulting LIC texture size by methods
getTextureWidth()andgetTextureHeight().- Author:
- Eike Preuss
- Version:
- 15.04.06, 2.10 revised (kp) Calculation of planar texture coordinates makeElementTextureCoords() moved to PwTexture.
15.04.06, 2.00 revised (kp) Formatting and removal of long-time deprecated method getOutline() for computing outline of triangle.
01.03.06, 1.95 revised (ah) Storage of last polygon removed.
02.07.03, 1.90 revised (ep) Do not do LIC for degenerated elements; pixel array is only allocated when LIC is performed, not when size is set.
24.06.03, 1.85 revised (kp) Class ScannedData moved to new class jv.objectGui.PsScanline.
05.02.03, 1.80 revised (ep) Increased vertical gap in texture image.
21.01.03, 1.70 revised (ep) Better texture filling.
15.01.03, 1.60 revised (ep) Handling of degenerated elements.
06.01.03, 1.50 revised (ep) Create nearly square texture images.
17.12.02, 1.40 revised (ep) Added (optional) contrast parameter to getPixArray and implemented other scanline algorithm (isn't used here yet).
20.07.02, 1.30 revised (ep) Array length bug removed.
08.07.01, 1.20 revised (ep) Optimized getPixels, and computation by using floats and no variable declarations in loops.
16.01.01, 1.10 revised (ep) Triangle packing optimized.
09.03.00, 1.06 revised (ep) Bug-fixes.
20.02.00, 1.05 revised (ep) Corrected "integralh-bug".
11.12.99, 1.02 revised (ep) Adaptive kernel width.
-
-
Constructor Summary
Constructors Constructor and Description PnLIC()Creates a new LIC processor.PnLIC(PgElementSet geom)Creates a new LIC processor for given geometry.PnLIC(PgElementSet geom, int size, PnGeodesicRK rk)Creates a new LIC processor for given geometry.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description doublegetCoarseness()intgetConvolutionWidth()Deprecated.intgetMinConvolutionWidth()int[]getPixArray(int[] pix)int[]getPixArray(int[] pix, double contrast)Puts actual LIC texture line by line with offset 0 and scan width 'texturewidth' into given alphaRGB pixel array.doublegetStepSize()intgetTextureHeight()Call this to get information about the actual height of the texture image that is used for the LIC image.intgetTextureWidth()Call this to get information about the actual width of the texture image that is used for the LIC image.doublegetWorldConvolutionWidth()Normal (one-velocity) convolution width along integral lines in world coordinates.voidmakeElement(int elemIndex)Computes Line Integral Convolution texture along all integral lines that begin in given element.voidmakeFastElement(int elem, PdVector[] texvector, PdBaryDir[] baryvector, double[] veclen, PdVector[] pixTexCoord, boolean[] computedVec, boolean[] computedCoord)First try to make LIC *VERY* fast :-), experimental.voidmakeFastLIC()First try to make LIC *VERY* fast :-), experimental.voidmakeLIC()Computes LIC texture for all elements of geometry.voidreset()Initialize pixel array with zeroes.booleansetCoarseness(double coarse)Sets the coarseness of noise that is convoluted to create the LIC image.booleansetConvolutionWidth(int numPixels)Deprecated.voidsetGeometry(PgElementSet geom)Set the size of the LIC texture.booleansetMinConvolutionWidth(int numPixels)At every point their is a minimal number of pixels that are convoluted, even ifconvolutionwidth*(velocity of vector field)is less than this number (minconvolutionwidth).voidsetRungeKutta(PnGeodesicRK rk)Sets the vector field for integration and the integration method.voidsetSize(int size)Set the size of the LIC texture.voidsetStepSize(double h)Sets the stepsize of the runge-kutta integration method.booleansetWorldConvolutionWidth(double width)Sets normal (one-velocity) convolution width along integral lines in world coordinates.
-
-
-
Constructor Detail
-
PnLIC
public PnLIC()
Creates a new LIC processor. Later geometry, size and ode solver must be assigned.- Since:
- JavaView 3.98.005
- Version:
- 07.09.07, 1.00 created
-
PnLIC
public PnLIC(PgElementSet geom)
Creates a new LIC processor for given geometry.- Parameters:
geom- underlying geometry
-
PnLIC
public PnLIC(PgElementSet geom, int size, PnGeodesicRK rk)
Creates a new LIC processor for given geometry. The vector field that shall be visualized is implicitly given by the geodesic Runge-Kutta class.- Parameters:
geom- underlying geometrysize- width in pixels of longest edge of the geometryrk- geodesic Runge-Kutta method with vector field.- See Also:
PnGeodesicRK- Version:
- 03.09.07, 1.10 revised (kp) Obsolete parameter time removed.
-
-
Method Detail
-
setGeometry
public void setGeometry(PgElementSet geom)
Set the size of the LIC texture. Method allocates element texture in geometry based on size parameter.- Parameters:
geom- Geometry on which we operate.- Since:
- JavaView 3.98.005
- Version:
- 07.09.07, 1.00 created
-
setSize
public void setSize(int size)
Set the size of the LIC texture. Method allocates element texture in geometry based on size parameter.- Parameters:
size- length in pixels of longest edge of the geometry.
-
setRungeKutta
public void setRungeKutta(PnGeodesicRK rk)
Sets the vector field for integration and the integration method.- Parameters:
rk- geodesic runge-kutta method that contains the vector field that shall be visualized- See Also:
PnGeodesicRK
-
getTextureWidth
public int getTextureWidth()
Call this to get information about the actual width of the texture image that is used for the LIC image.- Returns:
- width of the texture image in pixels
-
getTextureHeight
public int getTextureHeight()
Call this to get information about the actual height of the texture image that is used for the LIC image.- Returns:
- height of the texture image in pixels
-
setCoarseness
public boolean setCoarseness(double coarse)
Sets the coarseness of noise that is convoluted to create the LIC image.- Parameters:
coarse- 0 = fine; 1 = constant
-
getCoarseness
public double getCoarseness()
-
setConvolutionWidth
public boolean setConvolutionWidth(int numPixels)
Deprecated. UsesetWorldConvolutionWidth(double).Sets normal (one-velocity) convolution width along integral lines in pixels. This value is only synchronized withgetWorldConvolutionWidth()aftermakeElement(int)ormakeLIC()is called. If worldConvolutionWidth has a value > 0, then the value of convolutionWidth is ignored!- Parameters:
numPixels- new width given in texture pixels
-
getConvolutionWidth
public int getConvolutionWidth()
Deprecated. UsegetWorldConvolutionWidth().This value is only synchronized withgetWorldConvolutionWidth()aftermakeElement(int)ormakeLIC()is called. If worldConvolutionWidth has a value > 0, then the value of convolutionWidth is ignored!
-
setWorldConvolutionWidth
public boolean setWorldConvolutionWidth(double width)
Sets normal (one-velocity) convolution width along integral lines in world coordinates. This value is only synchronized withgetConvolutionWidth()aftermakeElement(int)ormakeLIC()is called. If worldConvolutionWidth has a value > 0, then the value of convolutionWidth is ignored!
The given length is only used approximately - in fact it is transformed to a number of texture pixels.- Parameters:
width- new width given in world coordinate length- Returns:
- true if worldConvolutionWidth is set, false if convolutionWidth will be used (caused by invalid parameter 'width')
- Since:
- JavaView 2.49.009
-
getWorldConvolutionWidth
public double getWorldConvolutionWidth()
Normal (one-velocity) convolution width along integral lines in world coordinates. This value is only synchronized withgetConvolutionWidth()aftermakeElement(int)ormakeLIC()is called. If worldConvolutionWidth has a value > 0, then the value of convolutionWidth is ignored!
The given length is only used approximately - in fact it is transformed to a number of texture pixels.- Since:
- JavaView 2.49.009
-
setMinConvolutionWidth
public boolean setMinConvolutionWidth(int numPixels)
At every point their is a minimal number of pixels that are convoluted, even ifconvolutionwidth*(velocity of vector field)is less than this number (minconvolutionwidth). Of course this number may be zero.minconvolutionwidthmay not be less thanconvolutionwidth.
-
getMinConvolutionWidth
public int getMinConvolutionWidth()
-
setStepSize
public void setStepSize(double h)
Sets the stepsize of the runge-kutta integration method.- Parameters:
h- stepsize
-
getStepSize
public double getStepSize()
-
makeElement
public void makeElement(int elemIndex)
Computes Line Integral Convolution texture along all integral lines that begin in given element. These integral lines may leave the element.- Parameters:
elemIndex- global element index in underlying geometry- Version:
- 09.03.00, 1.10 revised (ep) Handle degenerated triangles.
-
getPixArray
public int[] getPixArray(int[] pix)
- See Also:
getPixArray(int[], double)
-
getPixArray
public int[] getPixArray(int[] pix, double contrast)Puts actual LIC texture line by line with offset 0 and scan width 'texturewidth' into given alphaRGB pixel array. It also performs a histogram transformation (boosting the contrast of image), so you should avoid calling this method if the LIC texture did not change since last call. The given integer array should be of sufficient size width*height, seegetTextureWidth()andgetTextureHeight(), or may benull. If parameter isnullthen a new integer array of the correct size is returned.- Parameters:
pix- output: actual LIC texture; should be of size texturewidth*textureheight- Returns:
- the same as in parameter
pix, or a new integer array that contains the results ifpixisnull - Since:
- JavaView 2.48.005
- See Also:
getTextureWidth(),getTextureHeight()
-
makeLIC
public void makeLIC()
Computes LIC texture for all elements of geometry. MethodgetPixArray(int[])returns the texture image. You need to callsetSizebefore.- See Also:
getPixArray(int[]),getPixArray(int[],double)
-
reset
public void reset()
Initialize pixel array with zeroes.
-
makeFastLIC
public void makeFastLIC()
First try to make LIC *VERY* fast :-), experimental. You need to callsetSize(int)before.- Since:
- JavaView 2.65.000
-
makeFastElement
public void makeFastElement(int elem, PdVector[] texvector, PdBaryDir[] baryvector, double[] veclen, PdVector[] pixTexCoord, boolean[] computedVec, boolean[] computedCoord)First try to make LIC *VERY* fast :-), experimental. You need to callsetSize(int)before.- Since:
- JavaView 2.65.000
-
-
"