JavaView© v3.95.000

jvx.geom
Class PwVectorField

java.lang.Object
  extended byjv.object.PsObject
      extended byjvx.project.PjWorkshop
          extended byjvx.geom.PwVectorField
All Implemented Interfaces:
java.lang.Cloneable, PjWorkshopIf, PsUpdateIf, java.io.Serializable

public class PwVectorField
extends PjWorkshop

With this class one is allowed to create a vector field to a given geometry right from scrap.

See Also:
Serialized Form

Field Summary
static int TYPE_1_Z_K
           
static int TYPE_GRADIENT
           
static int TYPE_LINEAR
           
static int TYPE_ROTATION
           
static int TYPE_STRAIGHT
           
static int TYPE_Z_K
           
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
 
Constructor Summary
PwVectorField()
           
PwVectorField(PvDisplayIf disp)
           
 
Method Summary
 void addCenter(int type)
          Adds a feature center of given type with default values for parameters.
 void addCenter(int type, double infl)
          Adds a feature center of given type.
 void addCenter(PdVector position, int type)
          Adds a feature center of given type at specified position with default values for parameters.
 void addCenter(PdVector position, int type, double infl)
          Adds a feature center of given type at specified position.
 void calculateVF()
          Re-calculates the vector field.
 void cancel()
          Removes all added features to get the original state and closes the workshop.
 void clearCenter()
          Removes all feature centers that where added in this session.
 void close()
          Applies the features to the vector field and closes the workshop.
 void fixVF()
          'Burns' the features into the vector field irreversably.
 int getCenterType(int index)
          Type of the given feature.
 PgElementSet getElementSet()
          The underlying geometry as and element set.
static PgVectorField getInterpolatedElementBased(PgVectorField input, PgVectorField output)
          If this vector field is element based, simply a copy is returned.
static PgVectorField getInterpolatedVertexBased(PgVectorField input, PgVectorField output)
           
 int getNumCenters()
          Number of feature center added in this session.
 int getSelectedCenter()
          Index of the feature center currently active in the info panel.
 PgVectorField getSelectedVF()
          Currently active vector field used in this workshop.
 int getSelectedVFIndex()
          Index of currently active vector field as used in the underlying geometry.
 void init()
          Initialize and reset project, stops the running animation if any.
 boolean isEnabledConvert()
          Whether the user interface allows conversion to other base.
 boolean isEnabledUpdates()
          If this workshop reacts on events.
 void makeNewVF(int type)
          Creates a new vector field, puts it onto the surface and selects it.
static void normalizeVectorField(PgVectorField vf)
          Normalize all vectors of a vector field to unit length.
 void removeCenter(int index)
          Removes the given feature center.
 void removeGeometry()
          Remove the assigned geometry and its backup clone.
 void reset()
          TODO: Not implemented yet (call of init() not tested yet).
static void rotateVectorField(PgVectorField vf)
          Rotate a vector field by 90 degree in the tangent plane of the geometry (for element based vector fields this mean in the plane of the triangle, for vertex based vector fields this means in the plane orthogonal to the vertex normal).
static void rotateVectorField(PgVectorField vf, double angle)
          Rotate a vector field in the tangent plane of the geometry (for element based vector fields this mean in the plane of the triangle, for vertex based vector fields this means in the plane orthogonal to the vertex normal).
 void selectCenter(int index)
          Selects the specified feature center.
 void setCenterInfluence(int centerIndex, double influence)
          Sets all parameters of the given feature center to the given value.
 void setCenterType(int centerIndex, int type)
          Sets the type of given feature center to different type.
 void setDisplay(PvDisplayIf disp)
          In this display the feature centers are shown and can be interactively changed.
 void setEnabledConvert(boolean flag)
          Controls the user interface for converting vertex based vector fields into element based vector fields.
 void setEnabledUpdates(boolean flag)
          Flag specifies whether this workshop reacts on updates or not.
 void setGeometry(PgPointSet geom)
           
 void setMakeTangential(boolean flag)
          Specifies whether the vector field should be made tangential (for element sets).
 void setSelectedVF(int index)
          Selects a vector field from the list of fields in underlying geometry.
 boolean update(java.lang.Object event)
          React on events.
static PdVector[][] vectorFieldFromEigenVectors(PdVector[][] vec, PgElementSet geom)
          Given a vertex based (1,1)-tensor field t as a double array of vectors, where each vector points into an eigendirection of t and has the length of the absolute of the corresponding eigenvalue, the method changes the order of the vectors at a vertex and the sign of the vector, in order to make it consistent on the geometry.
 
Methods inherited from class jvx.project.PjWorkshop
getDisplay, getDisplays, getGeometry, getSavedGeometry, getViewer, isModal, ok, setDisplays, setGeometry, setModal, setViewer
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
 

Field Detail

TYPE_ROTATION

public static final int TYPE_ROTATION
See Also:
Constant Field Values

TYPE_GRADIENT

public static final int TYPE_GRADIENT
See Also:
Constant Field Values

TYPE_STRAIGHT

public static final int TYPE_STRAIGHT
See Also:
Constant Field Values

TYPE_LINEAR

public static final int TYPE_LINEAR
See Also:
Constant Field Values

TYPE_Z_K

public static final int TYPE_Z_K
See Also:
Constant Field Values

TYPE_1_Z_K

public static final int TYPE_1_Z_K
See Also:
Constant Field Values
Constructor Detail

PwVectorField

public PwVectorField()

PwVectorField

public PwVectorField(PvDisplayIf disp)
Method Detail

init

public void init()
Description copied from class: PjWorkshop
Initialize and reset project, stops the running animation if any. Does not reset any registered display nor geometry. They must be reset individually in each subclass.

Overrides:
init in class PjWorkshop

setDisplay

public void setDisplay(PvDisplayIf disp)
In this display the feature centers are shown and can be interactively changed.

Specified by:
setDisplay in interface PjWorkshopIf
Overrides:
setDisplay in class PjWorkshop

update

public boolean update(java.lang.Object event)
React on events.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PjWorkshop
Parameters:
event - if event is 'this' then the various objects are updated and the vector field computed
Returns:
true at success
See Also:
PsUpdateIf.update(java.lang.Object)

setEnabledUpdates

public void setEnabledUpdates(boolean flag)
Flag specifies whether this workshop reacts on updates or not.

Parameters:
flag - true for 'workshop should react' is default

isEnabledUpdates

public boolean isEnabledUpdates()
If this workshop reacts on events.

See Also:
setEnabledUpdates(boolean)

setEnabledConvert

public void setEnabledConvert(boolean flag)
Controls the user interface for converting vertex based vector fields into element based vector fields.

You need to call update(this) to apply changes.

Parameters:
flag - default is true

isEnabledConvert

public boolean isEnabledConvert()
Whether the user interface allows conversion to other base.

See Also:
setEnabledConvert(boolean)

setCenterType

public void setCenterType(int centerIndex,
                          int type)
Sets the type of given feature center to different type.
You need to call update(this) to apply the changes!

Parameters:
centerIndex - starts at 0
type - see the TYPE_... constants

setCenterInfluence

public void setCenterInfluence(int centerIndex,
                               double influence)
Sets all parameters of the given feature center to the given value.
You need to call update(this) to apply the changes!

Parameters:
centerIndex - starts at 0

selectCenter

public void selectCenter(int index)
Selects the specified feature center.
You must call update(this) afterwards.

Parameters:
index - starts at 0

getCenterType

public int getCenterType(int index)
Type of the given feature. Compare the TYPE_... constants.

Parameters:
index - starts at 0
Returns:
-1 at error

getNumCenters

public int getNumCenters()
Number of feature center added in this session.

Returns:
-1 at error

getSelectedCenter

public int getSelectedCenter()
Index of the feature center currently active in the info panel.

Returns:
index starting with 0; -1 at error

getSelectedVFIndex

public int getSelectedVFIndex()
Index of currently active vector field as used in the underlying geometry.

Returns:
-1 at error

getSelectedVF

public PgVectorField getSelectedVF()
Currently active vector field used in this workshop.

Returns:
null if no vector field active

addCenter

public void addCenter(int type)
Adds a feature center of given type with default values for parameters.
You need to call update(this) to apply the changes!

Parameters:
type - see the TYPE_... constants.

addCenter

public void addCenter(int type,
                      double infl)
Adds a feature center of given type. Sets all parameters to 'infl'.
You need to call update(this) to apply the changes!

Parameters:
type - see the TYPE_... constants.
infl - value for all parameters of this feature

addCenter

public void addCenter(PdVector position,
                      int type,
                      double infl)
Adds a feature center of given type at specified position. Sets all parameters to 'infl'.
You need to call update(this) to apply the changes!

Parameters:
position - zeros are added if dimension of this parameter is to small, and excessive entries are ignored.
type - see the TYPE_... constants.
infl - value for all parameters of this feature

addCenter

public void addCenter(PdVector position,
                      int type)
Adds a feature center of given type at specified position with default values for parameters.
You need to call update(this) to apply the changes!

Parameters:
position - zeros are added if dimension of this parameter is to small, and excessive entries are ignored.
type - see the TYPE_... constants.

removeCenter

public void removeCenter(int index)
Removes the given feature center.
You need to call update(this) afterwards!

Parameters:
index - starts at 0

clearCenter

public void clearCenter()
Removes all feature centers that where added in this session.
You need to call update(this) to apply the changes!


getElementSet

public PgElementSet getElementSet()
The underlying geometry as and element set.

Returns:
null if workshop not initialized

setGeometry

public void setGeometry(PgPointSet geom)
Parameters:
geom - Special things happen if geometrie is an element set. (Tangential vector fields etc.)

removeGeometry

public void removeGeometry()
Description copied from class: PjWorkshop
Remove the assigned geometry and its backup clone. Subclasses frequently overwrite this method but are adviced to call this method.

Overrides:
removeGeometry in class PjWorkshop

makeNewVF

public void makeNewVF(int type)
Creates a new vector field, puts it onto the surface and selects it.
Must call update(this) to apply.

Parameters:
type - element based or vertex based
See Also:
PgVectorField, PgVectorField.setBasedOn(int)

setSelectedVF

public void setSelectedVF(int index)
Selects a vector field from the list of fields in underlying geometry.
You need to call update(this) afterwards.

Parameters:
index - starts at 0

fixVF

public void fixVF()
'Burns' the features into the vector field irreversably.
Need to call update(this) afterwards!


setMakeTangential

public void setMakeTangential(boolean flag)
Specifies whether the vector field should be made tangential (for element sets). Tangential vector fields are orthogonal to normal vectors.
Call update(this) to apply changes.

Parameters:
flag - true is default

cancel

public void cancel()
Removes all added features to get the original state and closes the workshop. (Removes geometry, display, ...).

Overrides:
cancel in class PjWorkshop
See Also:
PjWorkshop.cancel()

close

public void close()
Applies the features to the vector field and closes the workshop. (Removes geometry, display, ...).

Overrides:
close in class PjWorkshop
See Also:
PjWorkshop.close()

reset

public void reset()
TODO: Not implemented yet (call of init() not tested yet).

Overrides:
reset in class PjWorkshop

calculateVF

public void calculateVF()
Re-calculates the vector field.


getInterpolatedElementBased

public static PgVectorField getInterpolatedElementBased(PgVectorField input,
                                                        PgVectorField output)
If this vector field is element based, simply a copy is returned. Otherwise, an element based vector field is created by adding the vectors of all vertices that belong to an element, divided by the number of vertices.

Parameters:
output - if not null then the created vector field is copied to it

getInterpolatedVertexBased

public static PgVectorField getInterpolatedVertexBased(PgVectorField input,
                                                       PgVectorField output)

vectorFieldFromEigenVectors

public static PdVector[][] vectorFieldFromEigenVectors(PdVector[][] vec,
                                                       PgElementSet geom)
Given a vertex based (1,1)-tensor field t as a double array of vectors, where each vector points into an eigendirection of t and has the length of the absolute of the corresponding eigenvalue, the method changes the order of the vectors at a vertex and the sign of the vector, in order to make it consistent on the geometry. This is useful for example to visualsize the tensor field with LIC.

Parameters:
vec - vertex based (1,1)-tensor field represented by eigenvectors that have the length of the absolute of the corresponding eigenvalue. The first index specifies the eigenvector (0 or 1), the second one the vertex by index.

rotateVectorField

public static void rotateVectorField(PgVectorField vf)
Rotate a vector field by 90 degree in the tangent plane of the geometry (for element based vector fields this mean in the plane of the triangle, for vertex based vector fields this means in the plane orthogonal to the vertex normal). Method only applies to vector fields that life on a geometry in a 3-dimension euclidean space. Element normals resp. vertex normal must be correct.


rotateVectorField

public static void rotateVectorField(PgVectorField vf,
                                     double angle)
Rotate a vector field in the tangent plane of the geometry (for element based vector fields this mean in the plane of the triangle, for vertex based vector fields this means in the plane orthogonal to the vertex normal). Method only applies to vector fields that life on a geometry in a 3-dimension euclidean space. Element normals resp. vertex normal must be correct.

Parameters:
vf - vector field to be rotated.
angle - angle of the rotation in radians.

normalizeVectorField

public static void normalizeVectorField(PgVectorField vf)
Normalize all vectors of a vector field to unit length.


JavaView© v3.95.000

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