jvx.vector

## Class PwVectorField

- java.lang.Object
- - jv.object.PsObject
  - - jvx.project.PjWorkshop
    - - jvx.vector.PwVectorField

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf

      public class PwVectorField
      extends PjWorkshop

  Creates a vector field on a given geometry.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `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_BOUNDARY_PANEL, 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`

    - ### Fields inherited from interface jv.project.PjWorkshopIf

      `MODE_BUG, MODE_STANDARD, MODE_VALIDATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PwVectorField()`
    `PwVectorField(PvDisplayIf disp)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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()` Close workshop and remove itself as listener from various classes.
    `void` | `fixVF()` 'Burns' the features into the vector field irreversible.
    `int` | `getCenterType(int index)` Type of the given feature.
    `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.
    `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` | `ok()` Applies the features to the vector field and closes the workshop.
    `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 tangential vector field by 90 degree in the tangent plane of the geometry.
    `static void` | `rotateVectorField(PgVectorField vf, double angle)` Rotate a vector field in the tangent plane of the geometry.
    `void` | `selectCenter(int centerIndex)` 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` | `setGeometry(PgGeometry geom)` Assign a geometry on which this workshop operates, and create a backup clone of the geometry.
    `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, getMode, getSavedGeometry, getViewer, isModal, isStandalone, setDisplays, setModal, setMode, setStandalone, 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`

    - #### setGeometry

          public void setGeometry(PgGeometry geom)

      Description copied from class: `PjWorkshop`
      Assign a geometry on which this workshop operates, and create a backup clone of the geometry. The backup geometry is restored if the workshop is canceled.

      Subclasses frequently overwrite this method but are advised to call this method.

      Specified by:
        `setGeometry` in interface `PjWorkshopIf`
      Overrides:
        `setGeometry` in class `PjWorkshop`
      Parameters:
        `geom` - Special things happen if geometry 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 advised to call this method.
      Overrides:
        `removeGeometry` 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)`

    - #### 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 centerIndex)

      Selects the specified feature center.

      You must call `update(this)` afterwards.

      Parameters:
        `centerIndex` - 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!

    - #### 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 irreversible.

      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()

      Close workshop and remove itself as listener from various classes. The workshop will no longer be working after this call.

      Subclasses may remove workshop from geometry as update listener, or remove any temporary geometries from display, if necessary.

      Implementation in this class simply calls `removeGeometry()`.

      Overrides:
        `close` in class `PjWorkshop`

    - #### ok

          public void ok()

      Applies the features to the vector field and closes the workshop. (Removes geometry, display, ...).
      Overrides:
        `ok` 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 visualize 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 tangential vector field by 90 degree in the tangent plane of the geometry. For element based vector fields this means 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 live on a geometry in (HACK: currently) 2- or 3-dimensional Euclidean space. HACK: 3D version currently relies on correct element normals respectively vertex normal, but this will change.

    - #### 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 means 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 live on a geometry in (HACK: currently) 2- or 3-dimensional Euclidean space. HACK: currently relies on correct element normals resp. vertex normal, but this will change.

      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.

"

The software JavaView? is copyright protected. All Rights Reserved.
"