Documentation of 'jvx.vector.PwVectorField' Java class
PwVectorField ("JavaView Reference Manual")
"JavaView? v5.03.003"
jvx.vector

Class 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
    Author:
    Eike Preuss
    Version:
    07.10.07, 4.50 revised (kp) Full revision of update mechanism and optimization.
    09.12.06, 4.00 revised (kp) Moved to jvx.vector from jvx.geom.
    13.07.04, 3.50 revised (ep) Reworked the update mechanism.
    12.07.04, 3.40 revised (ep) Removed most 'vector transformation' type of functionality.
    23.05.03, 3.30 revised (ep) Added 1/z^k type.
    14.03.03, 3.20 revised (ep) Bug with missing normals corrected.
    04.03.03, 3.10 revised (kh) static Method vectorFieldFromEigenVectors added.
    28.01.03, 3.00 revised (ep) Removing singularities now functions properly.
    28.01.03, 2.90 revised (ep) Additional parameter 'sheer' for linear fields.
    18.12.02, 2.80 revised (ep) Show edges.
    20.06.02, 2.70 revised (ep) New: Make element based from vertex based vector field.
    14.11.01, 2.60 revised (ep) Removed bug that occurred when dialog is opened but no vector field is created.
    22.10.01, 2.50 revised (ep) Removed an update-bug.
    26.09.01, 2.40 revised (ep) Disable some things for geometries with vertex dimension > 2.
    19.09.01, 2.30 revised (ep) Restore visibility of elements after close.
    30.08.01, 2.20 revised (ep) Added constructor without display parameter.
    07.06.01, 2.10 revised (ep) Send an update in addVF and removeVF, and some checks for null.
    28.05.01, 2.00 revised (ep) Do not set display to XY.
    11.05.00, 1.00 created (ep)
    • 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
      • 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.
        Version:
        03.02.07, 2.00 revised (kp) Method now overloads PjWorkshop#setGeometry(PgGeometry).
      • 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!

      • 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.
      • parallelTransport

        public static PdVector parallelTransport(PgElementSet geom,
                                                 PdVector vector,
                                                 int e,
                                                 int i,
                                                 PdVector outVec)
        Parallel transport a vector from element e into its neighbour element with local neighbour index i.
        Parameters:
        vector - A vector in e.
        e - Element.
        i - Local neighbour index of neighbour element.
        Author:
        Matthias Nieser
        Version:
        08.03.2015, 2.00 revised (kp) Moved to jvx.vector.PwVectorField from dev.vecmath.PuVectorGeom.
        09.06.09, 1.00 created (mn)
      • calcVertexAngle

        public static double calcVertexAngle(PgVectorField field,
                                             int v1,
                                             int v2)
        Calculate the angle between tangential vectors in two adjacent vertices, by parallel transporting v from the into the tangent plane of w and then measuring the angle.
        Parameters:
        field - vector field to measure the angles in. The vector field contains the underlying geometry.
        v1 - A vertex.
        v2 - A vertex adjacent to v1.
        Returns:
        The angle measured in radians.
        Author:
        Felix Kaelberer
        Version:
        08.03.2015, 2.00 revised (kp) Moved to jvx.vector.PwVectorField from dev.vecmath.PuVectorGeom.
        22.06.2006, 1.00 created (fk)
      • calcAngle

        public static double calcAngle(PgVectorField field,
                                       int e1,
                                       int e2)
        Calculate the angle between the vectors of two adjacent elements by parallel transporting one vector to the other.
        Parameters:
        field - vector field to measure the angles in. The vector field contains the underlying geometry.
        e1 - An element.
        e2 - An element adjacent to e1.
        Returns:
        The angle in radians in [0, 2*pi].
        Author:
        Felix Kaelberer
        Version:
        08.03.2015, 2.00 revised (kp) Moved to jvx.vector.PwVectorField from dev.vecmath.PuVectorGeom.
        22.06.2006, 1.00 created (fk)
      • angleWithNormals

        public static double angleWithNormals(PdVector v,
                                              PdVector vNormal,
                                              PdVector w,
                                              PdVector wNormal)
        Measure the angle between two tangential vectors v and w, which are tangential to the planes defined by the two normals vNormal and wNormal respectively. Before measuring the angle, one vector is parallel transported into the tangential plane of the other.
        Parameters:
        v - One vector
        vNormal - Normal vector to the tangential plane of v.
        w - Another vector
        wNormal - Normal vector to the tangential plane of w.
        Returns:
        Angle between v and w, in radians.
        Author:
        Felix Kaelberer, Matthias Nieser
        Version:
        08.03.2015, 2.00 revised (kp) Moved to jvx.vector.PwVectorField from dev.vecmath.PuVectorGeom.
        22.06.2006, 1.00 created (fk) Extracted functionality from method calcMatching().
      • 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
      • 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.
        Author:
        Klaus Hildebrandt
        Version:
        12.02.03, 1.00 created (kh) separated from PwCurvature.getPrincipalCurvatureFromEdgeCurvature
      • 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.

        Author:
        Klaus Hildebrandt, Konrad Polthier
        Version:
        27.10.12, 2.00 revised (kp) Check validity of data, streamlined code.
        27.07.11, 1.60 revised (mn) Bugfix with assure element normals
        22.08.07, 1.50 revised (kp) Implement rotation in 2D.
        08.11.04, 1.00 created (kh)
      • 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.
        Author:
        Klaus Hildebrandt
        Version:
        27.10.12, 2.00 revised (kp) Check validity of data, streamlined code.
        08.11.04, 1.00 created (kh)
      • normalizeVectorField

        public static void normalizeVectorField(PgVectorField vf)
        Normalize all vectors of a vector field to unit length.
        Author:
        Klaus Hildebrandt
        Version:
        09.12.06, 1.10 revised (kp) Only operate on number of vectors, not max number.
        08.11.04, 1.00 created (kh)
"JavaView? v5.03.003"

"

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

You see the box below because you did not login.