public class PwVectorField extends PjWorkshop
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 |
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
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
Constructor and Description |
---|
PwVectorField() |
PwVectorField(PvDisplayIf disp) |
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 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).
|
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).
|
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.
|
getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, openDialog, setDisplays, setModal, setMode, setStandalone, setViewer
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFather, getName, setParent
public static final int TYPE_ROTATION
public static final int TYPE_GRADIENT
public static final int TYPE_STRAIGHT
public static final int TYPE_LINEAR
public static final int TYPE_Z_K
public static final int TYPE_1_Z_K
public PwVectorField()
public PwVectorField(PvDisplayIf disp)
public void init()
PjWorkshop
init
in class PjWorkshop
public void setDisplay(PvDisplayIf disp)
setDisplay
in interface PjWorkshopIf
setDisplay
in class PjWorkshop
public void setGeometry(PgGeometry geom)
PjWorkshop
Subclasses frequently overwrite this method but are advised to call this method.
setGeometry
in interface PjWorkshopIf
setGeometry
in class PjWorkshop
geom
- Special things happen if geometry is an element set, tangential vector fields etc.public void removeGeometry()
PjWorkshop
removeGeometry
in class PjWorkshop
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PjWorkshop
event
- if event is 'this' then the various objects are updated and the vector field computedPsUpdateIf.update(java.lang.Object)
public void setEnabledConvert(boolean flag)
You need to call update(this)
to apply changes.
flag
- default is truepublic boolean isEnabledConvert()
setEnabledConvert(boolean)
public void setCenterType(int centerIndex, int type)
You need to call update(this)
to apply the changes!
centerIndex
- starts at 0type
- see the TYPE_... constantspublic void setCenterInfluence(int centerIndex, double influence)
You need to call update(this)
to apply the changes!
centerIndex
- starts at 0public void selectCenter(int centerIndex)
You must call update(this)
afterwards.
centerIndex
- starts at 0public int getCenterType(int index)
index
- starts at 0public int getNumCenters()
public int getSelectedCenter()
public int getSelectedVFIndex()
public PgVectorField getSelectedVF()
public void addCenter(int type)
You need to call update(this)
to apply the changes!
type
- see the TYPE_... constants.public void addCenter(int type, double infl)
You need to call update(this)
to apply the changes!
type
- see the TYPE_... constants.infl
- value for all parameters of this featurepublic void addCenter(PdVector position, int type, double infl)
You need to call update(this)
to apply the changes!
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 featurepublic void addCenter(PdVector position, int type)
You need to call update(this)
to apply the changes!
position
- zeros are added if dimension of this parameter is to small,
and excessive entries are ignored.type
- see the TYPE_... constants.public void removeCenter(int index)
You need to call update(this)
afterwards!
index
- starts at 0public void clearCenter()
You need to call update(this)
to apply the changes!
public void makeNewVF(int type)
Must call update(this)
to apply.
type
- element based or vertex basedPgVectorField
,
PgVectorField.setBasedOn(int)
public void setSelectedVF(int index)
You need to call update(this)
afterwards.
index
- starts at 0public void fixVF()
Need to call update(this)
afterwards!
public void setMakeTangential(boolean flag)
Call update(this)
to apply changes.
flag
- true is defaultpublic void cancel()
cancel
in class PjWorkshop
PjWorkshop.cancel()
public void close()
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()
.
close
in class PjWorkshop
public void ok()
ok
in class PjWorkshop
PjWorkshop.close()
public void reset()
reset
in class PjWorkshop
public void calculateVF()
public static PgVectorField getInterpolatedElementBased(PgVectorField input, PgVectorField output)
output
- if not null
then the created vector field is
copied to itpublic static PgVectorField getInterpolatedVertexBased(PgVectorField input, PgVectorField output)
public static PdVector[][] vectorFieldFromEigenVectors(PdVector[][] vec, PgElementSet geom)
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.public static void rotateVectorField(PgVectorField vf)
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 respectively vertex normal, but this will change.
public static void rotateVectorField(PgVectorField vf, double angle)
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.
vf
- vector field to be rotated.angle
- angle of the rotation in radians.public static void normalizeVectorField(PgVectorField vf)
"