JavaView® v2.00.008

jv.geom
Class PgVectorField

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.project.PgGeometry
              |
              +--jv.geom.PgVectorField
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable

public class PgVectorField
extends PgGeometry

Vector field along an associated curves or surfaces. Each vector has a point on the associated geometry as base point. The base points must be implicitly reconstructed from the associated geometry and the flag 'basedOn'.

Note, usually the vector field is also registered in the geometry.

Version:
10.12.00, 1.50 revised (ep) Method getDimOfVectors() added.
18.07.00, 1.40 revised (kp) Instance variable m_useGlobalVectorColor renamed to m_bShowVectorColors.
26.06.00, 1.30 revised (ep) Copy() method added.
09.04.00, 1.20 revised (kp) Name changed to PgVectorField_IP from PgVectorField_IP.
20.11.99, 1.10 revised (ep) Removed reference to vertices.
00.00.98, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
PgPointSet, Serialized Form

Field Summary
static int ELEMENT_BASED
          VectorField is given at element centers.
protected  int m_basedOn
          Switch vertex based / element based (standard=VERTEX_BASED).
protected  PgPointSet m_basePoints
          Associated point set containing the base points of the vectors.
protected  boolean m_bShowVectorArrow
          Flag whether tip of vector is shown as arrow.
protected  boolean m_bShowVectorColors
          Flag if global color of vectors used in display, applied if no individual vector coloring available.
protected  int m_dimOfVectors
          Uniform number of components of all vectors.
protected  PdColor m_globalVectorColor
          Global color of all vector fields used in display.
protected  PuDouble m_globalVectorLength
          Scaling factor of all vector fields used in display.
protected  PuDouble m_globalVectorSize
          Thickness in pixels of each vector used in display.
protected  int m_maxNumVectors
          Number of allocated vectors in vector array.
protected  int m_numVectors
          Number of used vectors in vector array.
protected  PgElementSet m_surface
          Associated element set (if any).
protected  PdVector[] m_vector
          Array of m_dim - dimensional vectors.
protected  java.awt.Color[] m_vectorColor
          Color of each vector, usually empty array.
static int VERTEX_BASED
          VectorField is given at vertices.
 
Fields inherited from class jv.project.PgGeometry
m_ambientProj, m_ambientSpace, m_authorInfo, m_bShowBndBox, m_bShowCenter, m_bShowing, m_bShowTitle, m_center, m_dim, m_dimOfSimplex, m_displayList, m_geometryInfo, m_labelAttribute, m_methodMenu, m_modelMatrix, m_title, m_version, m_versionType
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H3_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_S3_SPHERE, AMBIENT_SPACES, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PgVectorField(int aVectorDim)
          Constructor of an empty vector field which is VERTEX_BASED on default.
PgVectorField(int aVectorDim, int basedOn)
          Constructor of an empty vector field which is VERTEX_BASED on default.
 
Method Summary
 void assureVectorColors()
          Ensure that array of colors for each vector exists and its size is equal to number of vectors.
 boolean blend(double s, PgVectorField a, double t, PgVectorField b)
          Blend between two vector fields this = s*a + t*b, e.g. used in interpolation.
 void clearTagVector(int anIndex, int aTag)
           
 java.lang.Object clone()
          Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.
 boolean computeGradient(PgElementSet domain, PgPointSet image)
          Compute vector field as gradient of a map from domain triangulation to R.
 void copy(PgGeometry aGeom)
          Copy instance variables by duplication, not by copying a reference.
 int getBasedOn()
          Get flag whether vector field is vertex or element based.
 int getDimOfVectors()
           
 java.awt.Color getGlobalVectorColor()
          Get global vector color which is used if no local colors are available.
 double getGlobalVectorLength()
          Get length factor of vectors when drawn in display.
 double getGlobalVectorSize()
          Get thickness in pixels of vectors when drawn in display.
protected  int getMaxNumVectors()
           
 int getNumVectors()
           
 PdVector getVector(int anIndex)
           
 java.awt.Color[] getVectorColors()
           
 PdVector[] getVectors()
          Get vertex array for read and write access, but do not modify the size of any vector.
 PdVector[] getVertices()
           
 void init()
          Initializes and resets geometry.
 void makeTangent()
           
 boolean merge(PgGeometryIf aField)
          Merge vector field with current object and store union of both objects in 'this'.
 void paint(PvGeometryIf dc)
          Major rendering method fills an internal container class supplied by the display.
protected  void project(int elemInd)
          Projects given vector onto element plane.
 boolean removeVector(int anIndex)
           
 void setBasedOn(int basedOn)
           
 void setGeometry(PgElementSet aElementSet)
           
 void setGeometry(PgPointSet aVertexSet)
           
 void setGlobalVectorColor(java.awt.Color color)
          Set global vector color to be used if no local colors are available.
 void setGlobalVectorLength(double length)
          Get length factor of vectors when drawn in display.
 void setGlobalVectorSize(double size)
          Get thickness in pixels of vectors when drawn in display.
protected  void setMaxNumVectors(int aNumVectors)
          All vector allocation should be done in 'setMaxNumVectors' method should not be called directly, only subclass#setMaxNumVectors() may call it.
 void setNumVectors(int aNumVectors)
           
 void setTagVector(int anIndex, int aTag)
           
 void setVector(int anIndex, double x, double y)
           
 void setVector(int anIndex, double x, double y, double z)
           
 boolean setVector(int anIndex, PdVector aVector)
           
 boolean setVectors(PdVector[] aVectorList)
          Copy all vectors of vector list to an existing array of vectors.
 java.lang.String toString()
          Create a multi-line string representation with detailed information about all instance variables.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addElement, addPolygon, addVertex, blend, clearTagElement, clearTagPolygon, clearTagVertex, fillMethodMenu, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getBounds, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplays, getElement, getGeometryInfo, getJvx, getLabelAttribute, getMaterialPanel, getModelMatrix, getPolygon, getTextureImage, getTextureImageName, getTitle, getVersion, getVersionType, getVertex, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, hasTagVertex, intersectionWithLine, isConfigurable, isShowingBndBox, isShowingCenter, isShowingTitle, isVisible, reflect, removeDisplay, removeElement, removePolygon, removeVertex, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setGeometryInfo, setJvx, setLabelAttribute, setLabelAttribute, setModelMatrix, setPolygon, setTagElement, setTagPolygon, setTagVertex, setTextureImage, setTextureImageName, setTitle, setVersion, setVersionType, setVertex, setVisible, showBndBox, showCenter, showTitle
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
getInfoPanel, getName, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Field Detail

m_basePoints

protected PgPointSet m_basePoints
Associated point set containing the base points of the vectors.

m_surface

protected PgElementSet m_surface
Associated element set (if any).

VERTEX_BASED

public static final int VERTEX_BASED
VectorField is given at vertices.

ELEMENT_BASED

public static final int ELEMENT_BASED
VectorField is given at element centers.

m_basedOn

protected int m_basedOn
Switch vertex based / element based (standard=VERTEX_BASED).

m_dimOfVectors

protected int m_dimOfVectors
Uniform number of components of all vectors.

m_numVectors

protected int m_numVectors
Number of used vectors in vector array.

m_maxNumVectors

protected int m_maxNumVectors
Number of allocated vectors in vector array.

m_vector

protected PdVector[] m_vector
Array of m_dim - dimensional vectors. Dimension of all vectors is constant, and is determined as argument of the constructor. Applications usually call getVectors() to obtain vector array.
See Also:
PgPointSet.getDimOfVectors(), getVectors()

m_vectorColor

protected java.awt.Color[] m_vectorColor
Color of each vector, usually empty array.
See Also:
m_bShowVectorColors

m_bShowVectorArrow

protected boolean m_bShowVectorArrow
Flag whether tip of vector is shown as arrow.

m_globalVectorColor

protected PdColor m_globalVectorColor
Global color of all vector fields used in display.

m_globalVectorLength

protected PuDouble m_globalVectorLength
Scaling factor of all vector fields used in display.

m_globalVectorSize

protected PuDouble m_globalVectorSize
Thickness in pixels of each vector used in display.

m_bShowVectorColors

protected boolean m_bShowVectorColors
Flag if global color of vectors used in display, applied if no individual vector coloring available.
Constructor Detail

PgVectorField

public PgVectorField(int aVectorDim)
Constructor of an empty vector field which is VERTEX_BASED on default.
Parameters:
aVectorDim - uniform number of components of all vectors
See Also:
PgVectorField(int, int)

PgVectorField

public PgVectorField(int aVectorDim,
                     int basedOn)
Constructor of an empty vector field which is VERTEX_BASED on default.

The parameter 'basedOn' must be VERTEX_BASED or ELEMENT_BASED. Specifies the number of vectors this instance can hold and alters the interpretation by the viewer (VERTEX_BASED vectors are shown at the vertices, ELEMENT_BASED vectors are shown at the element centers) and possibly other classes.

Parameters:
aVectorDim - uniform number of components of all vectors
basedOn - flag determining how to compute the vector base point from geometry
Method Detail

init

public void init()
Description copied from class: PgGeometry
Initializes and resets geometry.
Overrides:
init in class PgGeometry

toString

public java.lang.String toString()
Create a multi-line string representation with detailed information about all instance variables.
Overrides:
toString in class PgGeometry

clone

public java.lang.Object clone()
Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null. Tags of this object are not copied but maybe copied of subclasses.

Link to associated point set and element set is set to null.

Overrides:
clone in class PgGeometry
See Also:
copy(PgGeometry)

copy

public void copy(PgGeometry aGeom)
Copy instance variables by duplication, not by copying a reference.
Overrides:
copy in class PgGeometry

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.
Overrides:
update in class PgGeometry
Following copied from interface: jv.object.PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
PsObject, PsUpdateIf.getFather(), PsUpdateIf.setParent(PsUpdateIf)

getNumVectors

public int getNumVectors()

getMaxNumVectors

protected int getMaxNumVectors()

setGeometry

public void setGeometry(PgPointSet aVertexSet)

setGeometry

public void setGeometry(PgElementSet aElementSet)

getBasedOn

public int getBasedOn()
Get flag whether vector field is vertex or element based.
Returns:
either VERTEX_BASED or ELEMENT_BASED

setBasedOn

public void setBasedOn(int basedOn)
Parameters:
basedOn - has to be VERTEX_BASED or ELEMENT_BASED. Specifies the number of vectors this instance can hold and alters the interpretation by the viewer (VERTEX_BASED vectors are shown at the vertices, ELEMENT_BASED vectors are shown at the element centers) and possibly other classes.

getGlobalVectorLength

public double getGlobalVectorLength()
Get length factor of vectors when drawn in display.

getGlobalVectorSize

public double getGlobalVectorSize()
Get thickness in pixels of vectors when drawn in display.

getGlobalVectorColor

public java.awt.Color getGlobalVectorColor()
Get global vector color which is used if no local colors are available.

setGlobalVectorLength

public void setGlobalVectorLength(double length)
Get length factor of vectors when drawn in display.

setGlobalVectorSize

public void setGlobalVectorSize(double size)
Get thickness in pixels of vectors when drawn in display.

setGlobalVectorColor

public void setGlobalVectorColor(java.awt.Color color)
Set global vector color to be used if no local colors are available.

getVectors

public PdVector[] getVectors()
Get vertex array for read and write access, but do not modify the size of any vector. Note, that the actual size of the vector array may differ from getNumVectors() for efficiency reasons. Therefore, do not use vector.length but use getNumVectors().

setVectors

public boolean setVectors(PdVector[] aVectorList)
Copy all vectors of vector list to an existing array of vectors. Length of argument vector list must be equal or larger than getNumVectors(). All vectors are copied. The dimension of all argument vectors must be equal to PgPointSet.getDimOfVectors() of the geometry.
Parameters:
aVectorList - array with new vectors

getVectorColors

public java.awt.Color[] getVectorColors()

getVertices

public PdVector[] getVertices()

setMaxNumVectors

protected void setMaxNumVectors(int aNumVectors)
All vector allocation should be done in 'setMaxNumVectors' method should not be called directly, only subclass#setMaxNumVectors() may call it. The user should change the number of vectors via setNumVectors().

setNumVectors

public void setNumVectors(int aNumVectors)

assureVectorColors

public void assureVectorColors()
Ensure that array of colors for each vector exists and its size is equal to number of vectors.

paint

public void paint(PvGeometryIf dc)
Description copied from class: PgGeometry
Major rendering method fills an internal container class supplied by the display. See jv.project.PgGeometryIf for detailed information.
Overrides:
paint in class PgGeometry
Following copied from class: jv.project.PgGeometry
See Also:
PgGeometryIf

clearTagVector

public void clearTagVector(int anIndex,
                           int aTag)

setTagVector

public void setTagVector(int anIndex,
                         int aTag)

getVector

public PdVector getVector(int anIndex)

removeVector

public boolean removeVector(int anIndex)

setVector

public boolean setVector(int anIndex,
                         PdVector aVector)

setVector

public void setVector(int anIndex,
                      double x,
                      double y)

setVector

public void setVector(int anIndex,
                      double x,
                      double y,
                      double z)

merge

public boolean merge(PgGeometryIf aField)
Merge vector field with current object and store union of both objects in 'this'. Number of vectors is the sum of both objects.
Overrides:
merge in class PgGeometry
Parameters:
aField - Vector field to be merged into 'this'
Returns:
true if method was successfull

blend

public boolean blend(double s,
                     PgVectorField a,
                     double t,
                     PgVectorField b)
Blend between two vector fields this = s*a + t*b, e.g. used in interpolation.
Parameters:
double - s, t weights of vectors of each elementSet
PgPointSet - a, b two pointSets used for blending
Returns:
true on success

computeGradient

public boolean computeGradient(PgElementSet domain,
                               PgPointSet image)
Compute vector field as gradient of a map from domain triangulation to R. Image is given as a point set with 1-dimensional vertices, each vertex of the point set is the image of the vertex with same index of the domain.

As a result the current vector field is the element based gradient of the map, tangential to triangles in the domain.

Parameters:
PgElementSet - domain domain triangulation, may be a curved surface
PgPointSet - image vertices of point set are the image values of map

makeTangent

public void makeTangent()

project

protected void project(int elemInd)
Projects given vector onto element plane.

getDimOfVectors

public int getDimOfVectors()

JavaView® v2.00.008

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