JavaView© v3.95.000

jvx.numeric
Class PnLIC

java.lang.Object
  extended byjvx.numeric.PnLIC

public class PnLIC
extends java.lang.Object

Line Integral Convolution for vector field visualization.

After constructing an instance of this class one can imediately get the resulting LIC texture size by methods getTextureWidth() and getTextureHeight().


Constructor Summary
PnLIC(PgElementSet geom)
          Creates a new LIC processor for given geometry.
PnLIC(PgElementSet geom, int size, double time, PnGeodesicRK rk)
          Creates a new LIC processor for given geometry.
 
Method Summary
 double getCoarseness()
           
 int getConvolutionWidth()
          Deprecated. Use getWorldConvolutionWidth().
 int getMinConvolutionWidth()
           
static int getOutline(PdVector[] elemTex, int width, int height, PiVector xc, PiVector yc)
          Deprecated. use jv.objectGui.PsScanline#makeScanlines(int,..) instead. This method has serious problems with triangles that have horizontal edges.
 int[] getPixArray(int[] pix)
           
 int[] getPixArray(int[] pix, double contrast)
          Puts actual LIC texture line by line with offset 0 and scanwidth 'texturewidth' into given alphaRGB pixel array.
 double getStepSize()
           
 int getTextureHeight()
          Call this to get information about the actual height of the texture image that is used for the LIC image.
 int getTextureWidth()
          Call this to get information about the actual width of the texture image that is used for the LIC image.
 double getWorldConvolutionWidth()
          Normal (one-velocity) convolution width along integral lines in world coordinates.
 void makeElement(int elemIndex)
          Computes Line Integral Convolution texture along all integral lines that begin in given element.
static double[] makeElementTextureCoords(PgElementSet geom, int maxwidth)
          Calculates element texture coordinates for triangulation.
 void makeFastElement(int elem, PdVector[] texvector, PdBaryDir[] baryvector, double[] veclen, PdVector[] pixTexCoord, boolean[] computedVec, boolean[] computedCoord)
          First try to make LIC *VERY* fast :-), experimental.
 void makeFastLIC()
          First try to make LIC *VERY* fast :-), experimental.
 void makeLIC()
          Computes LIC texture for all elements of geometry.
 void reset()
           
 boolean setCoarseness(double coarse)
          Sets the coarseness of noise that is convoluted to create the LIC image.
 boolean setConvolutionWidth(int numPixels)
          Deprecated. Use setWorldConvolutionWidth(double).
static void setEnabledKeepTransparency(boolean flag)
           
 boolean setMinConvolutionWidth(int numPixels)
          At every point their is a minimal number of pixels that are convoluted, even if convolutionwidth*(velocity of vector field) is less than this number (minconvolutionwidth).
 void setRungeKutta(PnGeodesicRK rk)
          Sets the vector field for integration and the integration method.
 void setSize(int size)
          Set the size of the LIC texture.
 void setStepSize(double h)
          Sets the stepsize of the runge-kutta integration method.
 boolean setWorldConvolutionWidth(double width)
          Sets normal (one-velocity) convolution width along integral lines in world coordinates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PnLIC

public PnLIC(PgElementSet geom,
             int size,
             double time,
             PnGeodesicRK rk)
Creates a new LIC processor for given geometry. The vector field that shall be visualized is implicitely given by the geodesic runge kutta class.

Parameters:
geom - underlying geometry
size - width in pixels of longest edge of the geometry
time - not yet implemented
rk - geodesic runge-kutta method with vector field.
See Also:
PnGeodesicRK

PnLIC

public PnLIC(PgElementSet geom)
Creates a new LIC processor for given geometry.

Parameters:
geom - underlying geometry
Method Detail

setSize

public void setSize(int size)
Set the size of the LIC texture.

Parameters:
size - width 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. Use setWorldConvolutionWidth(double).

Sets normal (one-velocity) convolution width along integral lines in pixels. This value is only synchronized with getWorldConvolutionWidth() after makeElement(int) or makeLIC() 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. Use getWorldConvolutionWidth().

This value is only synchronized with getWorldConvolutionWidth() after makeElement(int) or makeLIC() 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 with getConvolutionWidth() after makeElement(int) or makeLIC() 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 with getConvolutionWidth() after makeElement(int) or makeLIC() 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 if convolutionwidth*(velocity of vector field) is less than this number (minconvolutionwidth). Of course this number may be zero. minconvolutionwidth may not be less than convolutionwidth.


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

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 scanwidth '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, see getTextureWidth() and getTextureHeight(), or may be null. If parameter is null then 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 if pix is null
Since:
JavaView 2.48.005
See Also:
getTextureWidth(), getTextureHeight()

makeLIC

public void makeLIC()
Computes LIC texture for all elements of geometry. Method getPixArray(int[]) returns the texture image. You need to call setSize before.

See Also:
getPixArray(int[]), getPixArray(int[],double)

reset

public void reset()

makeFastLIC

public void makeFastLIC()
First try to make LIC *VERY* fast :-), experimental. You need to call setSize(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 call setSize(int) before.

Since:
JavaView 2.65.000

makeElementTextureCoords

public static double[] makeElementTextureCoords(PgElementSet geom,
                                                int maxwidth)
Calculates element texture coordinates for triangulation. Puts triangles in lines with longest edges at top.

Parameters:
geom - triangulation
maxwidth - the length that the longest edge
Returns:
[(scaling factor from worldcoords->pixel)/(pixelwidth of texture)/(pixelheight of texture)]

getOutline

public static int getOutline(PdVector[] elemTex,
                             int width,
                             int height,
                             PiVector xc,
                             PiVector yc)
Deprecated. use jv.objectGui.PsScanline#makeScanlines(int,..) instead. This method has serious problems with triangles that have horizontal edges.

Calculates outline of triangle texture coordinates in texture pixels by line scanning. Line number j has points (xc[j],yc[j]), (xc[length-1-j],yc[j]).

Parameters:
elemTex - normalized texture coordinates of triangle
width - width of the texture image (pixel)
height - height of the texture image (pixel)
xc - output: x-coordinates of outline
yc - output: y-coordinates of outline
Returns:
length of coordinate arrays

setEnabledKeepTransparency

public static void setEnabledKeepTransparency(boolean flag)

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.