public class PgVectorField extends PgGeometry
Note, usually the vector field should also be registered in the geometry.
Usage example:
... PgElementSet surf = new PgElementSet(... ... PgVectorField field = new PgVectorField(3, PgVectorField.ELEMENT_BASED); field.setGeometry(surf); //base points are element midpoints of surface surf.addVectorField(field); //if you don't do this, the vector field will not be visible ...
PgPointSet
,
PgElementSet
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ELEMENT_BASED
VectorField is given at element centers.
|
static int |
VERTEX_BASED
VectorField is given at vertices.
|
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
AMBIENT_H2_HYPERBOLIC, AMBIENT_H3_HYPERBOLIC, AMBIENT_H4_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R1_EUCLIDEAN, AMBIENT_R2_EUCLIDEAN, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_R5_EUCLIDEAN, AMBIENT_S1_SPHERE, AMBIENT_S2_SPHERE, AMBIENT_S3_SPHERE, AMBIENT_S4_SPHERE, AMBIENT_SPACES, BLEND_ALPHA, BLEND_MATERIAL, BLEND_REPLACE, FILTER_DIRECT, FILTER_LINEAR, FILTER_QUADRATIC, HAS_METHOD_MENU, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, INSPECTOR_TEXTURE, INSPECTOR_TEXTURE_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, m_numLabelTypes, METHOD_EXT, PERIODIC_BOTH, PERIODIC_HEIGHT, PERIODIC_NONE, PERIODIC_WIDTH, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE, SIDE_BACK, SIDE_BOTH, SIDE_FRONT, SIDE_NONE
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
add(PgVectorField field)
Add a vector field to this.
|
boolean |
applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors.
|
void |
assureVectorColors()
Ensure that array of colors for each vector exists and its size is equal to number of
vectors.
|
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two vector fields
this = s*a + t*b , e.g. used in interpolation. |
void |
clearTagVector(int anIndex,
int aTag)
Removes the given tag from a vector.
|
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
boolean |
computeGradient(PgElementSet domain,
PdVector image)
Compute vector field as the gradient of a map from a domain triangulation to R.
|
boolean |
computeGradient(PgElementSet domain,
PdVector[] image,
int coordinate)
Compute vector field as the gradient (of one coordinate) of a map from
a domain triangulation to R^n.
|
boolean |
computeGradient(PgElementSet domain,
PgPointSet image)
Compute vector field as gradient of a map from domain triangulation to R.
|
boolean |
computeGradient(PgElementSet domain,
PgPointSet image,
int coordinate)
Compute vector field as the gradient (of one coordinate) of a map from
a domain triangulation to R^n.
|
void |
copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.
|
int |
getBasedOn()
Get flag whether vector field is vertex or element based.
|
int |
getDimOfVectors()
Get the dimension of vectors, i.e. the number of coordinates of each vector.
|
PgPointSet |
getGeometry()
If vector field lies on an element set, then this element set is delivered by this method
(so the return value might in fact be an PgElementSet).
|
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.
|
int |
getNumVectors()
Get the number of used vectors.
|
PdVector |
getVector(int anIndex)
Returns a reference to one specific vector.
|
java.awt.Color[] |
getVectorColors()
Get array of vector colors.
|
PdVector[] |
getVectors()
Get vertex array for read and write access, but do not modify the size of any vector.
|
PdVector[] |
getVertices()
Get array of base vertices for read access.
|
void |
init()
Initializes and resets geometry.
|
boolean |
isShowingIndividualMaterial()
Get flag if this vector field uses its own material properties
instead of inheriting material properties of the base geometry.
|
boolean |
isShowingVectorArrows()
Get flag if this vector field shows an arrow at the tip of each vector.
|
boolean |
isShowingVectorColors()
Determine whether showing of individual vector colors is enabled.
|
void |
makeTangent()
Projects the vectors into plane of their base elements
(element based vector fields), or to the plane orthogonal
to the vertex normal (vertex based vector fields, geometry must
have vertex normals, otherwise this method simply returns).
|
boolean |
merge(PgGeometryIf aField)
Merge vector field with current object and store union of both objects in 'this'.
|
void |
multScalar(double scalar)
Scale all vectors in the field by a constant factor.
|
void |
paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display.
|
PgGeometry |
reflect(PdMatrix mat,
boolean bOrient,
boolean bVector)
Generate a cloned geometry and transform vertices by a matrix.
|
boolean |
removeVector(int anIndex) |
void |
setBasedOn(int basedOn)
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.
|
void |
setDimOfVectors(int aDim)
Sets the dimension of all vectors.
|
void |
setGeometry(PgPointSet geom)
Assign a geometry to serve as the carrier of this vector field.
|
void |
setGlobalVectorColor(java.awt.Color color)
Set global vector color to be used if no local colors are available.
|
void |
setGlobalVectorLength(double length)
Set length factor of vectors when drawn in display.
|
void |
setGlobalVectorSize(double size)
Set thickness in pixels of vectors when drawn in display.
|
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 numVectors)
Set number of vectors.
|
void |
setTagVector(int anIndex,
int aTag)
Sets the given tag for a vector.
|
void |
setVector(int anIndex,
double x)
Sets vector at given index as scalar value, i.e. as 1-dim vector.
|
void |
setVector(int anIndex,
double x,
double y)
Sets vector at given index to the 2-dim vector (x,y).
|
void |
setVector(int anIndex,
double x,
double y,
double z)
Sets vector at given index to the 3-dim vector (x,y,z).
|
boolean |
setVector(int anIndex,
PdVector aVector)
Copies vector to vector field at specified index.
|
void |
setVectorColors(java.awt.Color[] colorList)
Copy vector colors of list to existing array of vector colors.
|
boolean |
setVectors(PdVector[] aVectorList)
Copy all vectors of vector list to an existing array of vectors.
|
void |
showIndividualMaterial(boolean flag)
Set flag if this vector field uses its own material properties
instead of inheriting material properties of the base geometry.
|
void |
showVectorArrows(boolean flag)
Set flag if this vector field shows an arrow at the tip of each vector.
|
void |
showVectorColors(boolean flag)
Set flag to enable drawing of individual vector colors.
|
void |
sub(PgVectorField field)
Subtract vector fields, this = this - field.
|
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.
|
addDisplay, addElement, addPolygon, addVertex, applyAmbientMatrix, clearTagElement, clearTagPolygon, clearTagVertex, convertWorldToModel, fillMethodMenu, fillMethodMenu, getAmbientBounds, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getBounds, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getElement, getGeometryInfo, getJvx, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTextureImage, getTextureImageName, getTitle, getType, getVersion, getVersionType, getVertex, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, hasTagVertex, intersectionWithLine, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, projectFromAmbientSpace, removeDisplay, removeElement, removeMethodMenus, removePolygon, removeVertex, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setDimOfVertices, setElement, setEnabledInstanceSharing, setGeometryInfo, setJvx, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setState, setTagElement, setTagPolygon, setTagVertex, setTextureImage, setTextureImageName, setTitle, setType, setVersion, setVersionType, setVertex, setVisible, showBndBox, showCenter, showName, showTitle
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, updatePanels
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
assureInspector, getInfoPanel, getName, hasTag, setName
getFather, setParent
public static final int VERTEX_BASED
public static final int ELEMENT_BASED
public PgVectorField(int aVectorDim)
aVectorDim
- uniform number of components of all vectorsPgVectorField(int, int)
public PgVectorField(int aVectorDim, int basedOn)
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.
The dimension of each vector may differ from the dimension of the underlying geometry.
aVectorDim
- uniform number of components of all vectorsbasedOn
- flag determining how to compute the vector base point from geometrypublic void init()
PgGeometry
init
in class PgGeometry
public java.lang.String toString()
toString
in interface PgGeometryIf
toString
in class PgGeometry
public java.lang.Object clone()
null
.
Link to associated point set and element set is set to null
.
clone
in interface PgGeometryIf
clone
in class PgGeometry
copy(PsObject)
public void copy(PsObject object)
The base surface and base points are kept unchanged, and they must typically be set by hand using setGeometry().
The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use PsObject#copy(PsObject) instead of PgGeometry#copy(PsObject).
copy
in class PgGeometry
PsObject.clone()
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PgGeometry
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public void setGeometry(PgPointSet geom)
addVectorField(PgVectorField)
of the geometry.
HACK: Automatically adjust the number of vectors either to the number of vertices or elements of the geometry depending on the value of getBasedOn().
public PgPointSet getGeometry()
public boolean applyModelingMatrix()
applyModelingMatrix
in class PgGeometry
true
if operation was applied successfully.public int getBasedOn()
public void setBasedOn(int basedOn)
basedOn
- must be VERTEX_BASED or ELEMENT_BASED.public double getGlobalVectorLength()
public double getGlobalVectorSize()
public java.awt.Color getGlobalVectorColor()
public void setGlobalVectorLength(double length)
public void setGlobalVectorSize(double size)
public void setGlobalVectorColor(java.awt.Color color)
public PdVector[] getVectors()
public boolean setVectors(PdVector[] aVectorList)
PgPointSet.getDimOfVectors()
of the geometry.
Dimension of vectors of this vector field is adjusted.
aVectorList
- array with new vectorspublic boolean isShowingVectorArrows()
public void showVectorArrows(boolean flag)
flag
- true if arrows are shownpublic boolean isShowingIndividualMaterial()
public void showIndividualMaterial(boolean flag)
flag
- true if individual material of this vector field is usedpublic boolean isShowingVectorColors()
public void showVectorColors(boolean flag)
public void assureVectorColors()
public java.awt.Color[] getVectorColors()
public void setVectorColors(java.awt.Color[] colorList)
colorList
- array with new vertex colorspublic PdVector[] getVertices()
public int getDimOfVectors()
public void setMaxNumVectors(int aNumVectors)
public int getNumVectors()
public void setNumVectors(int numVectors)
public void setDimOfVectors(int aDim)
PdVector
.PdVector.setSize(int)
public void paint(PvGeometryIf dc)
PgGeometry
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgGeometry
PgGeometryIf
public void clearTagVector(int anIndex, int aTag)
public void setTagVector(int anIndex, int aTag)
public PdVector getVector(int anIndex)
setVector(int, PdVector)
to change values of vectors.public boolean removeVector(int anIndex)
public boolean setVector(int anIndex, PdVector aVector)
aVector
- vector to be copiedanIndex
- index beginning with 0public void setVector(int anIndex, double x)
public void setVector(int anIndex, double x, double y)
public void setVector(int anIndex, double x, double y, double z)
public boolean merge(PgGeometryIf aField)
merge
in interface PgGeometryIf
merge
in class PgGeometry
aField
- Vector field to be merged into 'this'true
if method was successfullpublic boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)
this = s*a + t*b
, e.g. used in interpolation.blend
in interface PgGeometryIf
blend
in class PgGeometry
s
- weight of vertices of first geometryag
- first geometry used for blendingt
- weight of vertices of second geometrybg
- second geometry used for blendingpublic boolean computeGradient(PgElementSet domain, PgPointSet image)
As a result the current vector field is the element based gradient of the map, tangential to triangles in the domain.
domain
- domain triangulation, may be a curved surfaceimage
- vertices of point set are the image values of mappublic boolean computeGradient(PgElementSet domain, PgPointSet image, int coordinate)
As a result the current vector field is the element based gradient of the map, tangential to triangles in the domain.
domain
- domain triangulation, may be a curved surfaceimage
- vertices of point set are the image values of mapcoordinate
- index of a coordinate component of the image the gradient is computed frompublic boolean computeGradient(PgElementSet domain, PdVector[] image, int coordinate)
As a result the current vector field is the element based gradient of the map, tangential to triangles in the domain.
domain
- domain triangulation, may be a curved surfaceimage
- the image values of a piecewise linear map at the vertices of the domaincoordinate
- index of a coordinate component of the image the gradient is computed frompublic boolean computeGradient(PgElementSet domain, PdVector image)
As a result the current vector field is the element based gradient of the map, tangential to triangles in the domain.
domain
- domain triangulation, may be a curved surfaceimage
- the image values of a piecewise linear map at the vertices of the domainpublic void makeTangent()
public PgGeometry reflect(PdMatrix mat, boolean bOrient, boolean bVector)
reflect
in interface PgGeometryIf
reflect
in class PgGeometry
mat
- 3*3 or 4*4 transformation matrixbOrient
- flag whether to keep the orientation of the geometrybVector
- flag whether to keep the orientation of vectorspublic void multScalar(double scalar)
public void sub(PgVectorField field)
public void add(PgVectorField field)
"