JavaView© v3.95.000

jv.geom
Class PgPointSet

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PgGeometry
          extended byjv.geom.PgPointSet
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
PgElementSet, PgPolygon, PgPolygonSet

public class PgPointSet
extends PgGeometry

Base class for most geometric objects with points resp. vertices, for example point sets, polygons, element set, and other simplicial complexes.

The class has an array of n-dimensional points where each point is an instance of type PdVector containing the n coordinate components. Additionally, there exist instance variables for vertex normals, vertex colors, vertex texture coordinates, and other vertex properties. Note, that such vertex properties are not stored with each vertex but each property is stored in an additional array of same length as the array of vertices. If a property is not available then the corresponding array is null.

The dimension of all points is determined as argument of the constructor and cannot be changed later. The dimension is the same for all points of the point set. There exist several utility functions to allocate and modify the number of points, for example,

	setNumVertices(int)
 
allocates num vertices. Internally, there exists a cache to reduce the number of actual memory allocations. The size of the cache is managed by protected methods.

Whenever the number of vertices is changed, the class automatically adjusts the size of those vertex properties which are currently in use, i.e. whose array is not null.

Applications may modify the coordinates of vertices and of vertex properties by direct method calls such as

	setVertex(int, PdVector)
 
which sets the vertex with index ind equal to the vertex v by copying the coordinates. Alternatively, if an application modifies a larger number of vertices then the application may prefer to obtain the coordinate array from the point set and directly modify the array
	PdVector [] vertex = pointSet.getVertices();
	for (int i=0; i<pointSet.getNumVertices(); i++)
		vertex[i].copy(v);
 
The same choice is available for arrays containing vertex properties. Note, that subclasses, such as PgElementSet, may not reference all vertices, e.g. if the currently active elements consists of a subset of all vertices. Also note, that the actual size of the vertex array may differ from m_numVertices for efficiency reasons. Therefore, do not use vertex.length but use getNumVertices().

A good start to obtain further insight are methods like computeTorus (if source code access to JavaView is available), or the tutorial applets of JavaView.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jv.object.PsObject
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.PgGeometryIf
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, 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, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PgPointSet()
          Constructor of a point set in three-dimensional space.
PgPointSet(int aVertexDim)
          Constructor of a point set in n-dimensional space.
 
Method Summary
 int addVectorField(PgVectorField vf)
          Add a vertex or element based vector field to geometry.
 int addVertex(PdVector aVertex)
          Add new vertex to the end of the vertex list Method just calls setVertex(int, PdVector).
 boolean applyAmbientMatrix()
          Multiply the ambient matrix to all vertices and vectors.
 boolean applyModelingMatrix()
          Multiply the modeling matrix to all vertices and vectors.
 void assureVertexColors()
          Assures respectively allocates correct length of vertex color array.
 void assureVertexNormals()
          Assures respectively allocates correct length of vertex normal array.
 void assureVertexSizes()
          Assures respectively allocates correct length of vertex size array.
 void assureVertexTextures()
          Assures respectively allocates correct length of vertex texture array.
 boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)
          Blend between two point sets using this = s*ag + t*bg.
 void clearTagVertex(int anIndex, int aTag)
          Clear a single tag of a vertex.
 java.lang.Object clone()
          Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.
 void computeCone(int numULines, int numVLines, double bottomRadius, double height)
          Generate cone in z-direction centered at the origin with given bottom radius and height.
 void computeCylinder(int numULines, int numVLines, double radius, double length)
          Generate cylinder in z-direction centered at the origin with given radius and length.
 void computeDisk(int numULines, int numVLines, double radius)
          Generate disk in xy-plane with given radius.
 void computePlane(int numULines, int numVLines, double uMin, double vMin, double uMax, double vMax)
          Generate rectangle in z=0 plane with given min/max values.
 void computeRotation(PgPolygon meridian, int numULines)
          Generate rotational symmetric surface from given meridian around x-axis.
 void computeSnail(int numULines, int numVLines, double numWindings)
          Generate a winding snail.
 void computeSphere(int numULines, int numVLines, double radius)
          Generate sphere at origin with given radius.
 void computeTorus(int numULines, int numVLines, double radius, double thick)
          Generate torus in x-y plane with given radius of soal and thickness of tube.
 void copy(PsObject object)
          Copy instance variables by duplication, not by copying a reference.
 void flipOrientation()
          Change orientation of normal vectors.
 PdVector[] getAmbientBounds()
          Compute bounding box of this geometry from the set of all vertices, or return null if no vertices.
 PdVector[] getBounds()
          Compute bounding box of the vertices which are transformed with ambient and model matrix.
 PdVector getCenterOfBndBox()
          Compute center of geometry as midpoint of the bounding box.
 PdVector getCenterOfGravity()
          Compute center of geometry as the mean all vertices, i.e. center of gravity.
 int getDimOfColors()
          Get dimension of colors, i.e. number of components of each color vector.
 int getDimOfTextures()
          Get dimension of textures, i.e. number of components of each of the texture vectors.
 int getDimOfVectors()
          Get dimension of vectors, i.e. number of components of each of the vectors.
 int getEulerCharacteristic()
          Compute Euler characteristic of a polyhedral complex.
 int[] getFVector()
          Compute F-vector that is the number of points, edges, faces, etc.
 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.
 java.awt.Color getGlobalVertexColor()
          Get global vertex color which is used if no local colors are available.
 java.awt.Color getGlobalVertexNormalColor()
          Get global vertex normal color which is used if no local colors are available.
 double getGlobalVertexNormalLength()
          Get length factor of vertex normal vectors when drawn in display.
 double getGlobalVertexNormalSize()
          Get thickness in pixels of vertex normals when drawn in display.
 double getGlobalVertexSize()
          Get global radius in pixels of circle to visualize vertices in display.
 java.awt.Color getGlobalVertexTagColor()
          Get global color of tagged vertices.
 int getIndexOfVectorField(PgVectorField vf)
          Get index of vector fields, assumes user data is stored in a vector.
 PgJvxSrc getJvx()
          Fills a geometry container with data from this instance, for example, to print to file.
 int[] getMarkedVertices()
          Get indices of all selected vertices marked with tag PsObject#IS_SELECTED.
 int getMaxNumVertices()
          Get total length of allocated vertex array.
 int getNumVectorFields()
          Get number of vector fields.
 int getNumVertices()
          Get number of vertices in vertex array.
 PgVectorField getSelectedVectorField()
          Get the currently selected vector field, or null if there is none.
 double getShininess()
          Get shininess of highlights of geometry.
 java.awt.Color getSpecularColor()
          Get specular color of geometry.
 PgTexture getTexture()
          Get current texture of surface.
 java.awt.Image getTextureImage()
          Get image object of texture.
 java.lang.String getTextureImageName()
          Get name of texture image, a full URL or a relative file name.
 double getTransparency()
          Get transparency of geometry.
 PgVectorField getVectorField(int anInd)
          Get a vector field via its index.
 PgVectorField getVectorField(java.lang.String name)
          Get a vector field via its name.
 PdVector getVertex(int anIndex)
          Get a reference to an individual vertex.
 java.awt.Color getVertexColor(int anIndex)
          Get a reference to an individual vertex color.
 java.awt.Color[] getVertexColors()
          Get color array for read and write access, but do not modify the size of any color vector.
 PdVector getVertexNormal(int anIndex)
          Get a reference to an individual vertex normal.
 PdVector[] getVertexNormals()
          Get vertex normal array for read and write access, but do not modify the size of any normal vector.
 double getVertexSize(int anIndex)
          Get relative size of an individual vertex.
 PdVector getVertexSizes()
          Get array of relative vertex sizes for read and write access.
 PdVector getVertexTexture(int anIndex)
          Get a reference to an individual vertex texture coordinate.
 PdVector[] getVertexTextures()
          Get vertex texture array for read and write access, but do not modify the size of any texture vector.
 PdVector[] getVertices()
          Get vertex array for read and write access, but do not modify the size of any vector.
 boolean hasTagVertex(int anIndex, int aTag)
          Check whether vertex has given tag.
 int hasVertex(PdVector aVertex)
          Looks in the vertex list if there is a vertex with same coordinates like the passed one.
 int hasVertex(PdVector aVertex, double eps)
          Looks in the vertex list if there is a vertex within a given euclidean distance.
 boolean hasVertexColors()
          Check if vertex colors have been allocated.
 boolean hasVertexNormals()
          Check if vertex normals have been allocated.
 boolean hasVertexSizes()
          Check if relative vertex sizes have been allocated.
 boolean hasVertexTextures()
          Check if vertex textures have been allocated.
 void init()
          Initialize and reset instance variables after call to super.init().
 PvPickEvent intersectionWithLine(PdVector rayBase, PdVector rayDir)
          Find intersection of this point set with a given ray.
 boolean isDefaultLabelEnabled()
          Deprecated. since JavaView 3.61.003, use isEnabledIndexLabels().
 boolean isEnabledIndexLabels()
          Determine whether drawing of default labels, i.e. item indices, is enabled.
 boolean isShowingIndices()
          Check whether showing of indices is switched on.
 boolean isShowingSingleVectorField()
          Set flag to show a single or multiple vector fields simultaneously.
 boolean isShowingTaggedVertices()
          Determine whether showing of tagged vertices is enabled.
 boolean isShowingTransparency()
          Determines whether usage of transparence is enabled.
 boolean isShowingVectorArrow()
          Deprecated. use isShowingVectorArrows()
 boolean isShowingVectorArrows()
          Determine whether showing of tip of vectors as arrow is enabled.
 boolean isShowingVectorColors()
          Determine whether showing of individual vector colors is enabled.
 boolean isShowingVectorField()
          Deprecated. use isShowingVectorFields()
 boolean isShowingVectorFields()
          Determine whether showing of vector fields is enabled.
 boolean isShowingVertexColors()
          Determine whether showing of vertex colors is enabled.
 boolean isShowingVertexLabels()
          Determine whether showing of vertex labels is enabled.
 boolean isShowingVertexNormalArrow()
          Determines whether drawing of arrow of vertex normals is enabled.
 boolean isShowingVertexNormals()
          Determine whether showing of vertex normals is enabled.
 boolean isShowingVertexOutline()
          Determines whether drawing of border of vertex circles is enabled.
 boolean isShowingVertexSizes()
          Determine whether showing of vertex sizes is enabled.
 boolean isShowingVertexTexture()
          Determine whether showing of vertex textures is enabled.
 boolean isShowingVertices()
          Determine whether showing of vertices is enabled.
 boolean makeColorFromVectorLength()
          Create color from the length of vectors of the selected vector field.
 void makeQuadrVertexTexture(int uDiscr, int vDiscr)
          Generate default vertex texture in [0,1]*[0,1] for a quadrilateral surface.
 boolean makeVertexColorsFromXYZ()
          Create color from the vertex position within its bounding box which is interpreted as RGB cube.
 boolean makeVertexColorsFromZ()
          Create color from the vertical z-height within its bounding box ranging from low blue to high red.
 boolean makeVertexColorsFromZHue()
          Create color from the vertical z-height within its bounding box ranging through hue rainbow.
 boolean makeVertexNormals()
          Check existence and allocate vertex array structure.
 boolean makeVertexTextureFromBndBox(int ix, int iy)
          Create vertex texture from a plane of the bounding box.
 boolean makeVertexTextureFromCylinder(PdVector center, PdVector axis)
          Create vertex texture from cylinder with given axis.
 boolean makeVertexTextureFromSphere(PdVector center)
          Create vertex texture from sphere with given center.
 boolean makeVertexTextureFromUV(int numULines, int numVLines, int flip)
          Create vertex texture of a parametrized surface with (u,v)-grid.
 boolean merge(PgGeometryIf aGeom)
          Merge two point sets and store union in this.
 void paint(PvGeometryIf dc)
          Major rendering method fills an internal container class supplied by the display.
 boolean projectFromAmbientSpace()
          Apply projection matrix and perform projection determined by projection flag of the surface in a Euclidean model R3, R2, or R1 with parallel projection.
 void projectToSphere(PdVector center, double radius)
          Project all vertices to the sphere with given center and radius.
 PgGeometry reflect(PdMatrix mat, boolean bOrient, boolean bVector)
          Generate a cloned geometry and transform vertices by a matrix.
 void removeAllVectorFields()
          Remove all user added vector fields.
 int removeHiddenVectorFields()
          Remove all invisible vector fields.
 int[] removeMarkedVertices()
          Remove vertices marked with tag PsObject#IS_DELETED from the vertex list.
 void removeTexture()
          Remove all texture information from surface and switch off showing of texture.
 boolean removeVectorField(PgGeometryIf vf)
          Remove a vector field from geometry.
 int[] removeVertex(int ind)
          Remove vertex at specified position in the vertex list.
 void removeVertexColors()
          Remove local vertex colors from a geometry and use global vertex color instead.
 void removeVertexNormals()
          Remove vertex normals from a geometry.
 void removeVertexSizes()
          Remove vertex sizes from a geometry.
 void scale(double factor)
          Scale each vertex of geometry by given factor w.r.t. its center using formula: vertex = (1-s)*center + s*vertex.
 void scale(double factor, PdVector center)
          Deprecated. use scale(double) instead
 int selectVectorField(PgVectorField vf)
          Select a vector field.
 void setCenterOfBndBox(PdVector center)
          Move each vertex of geometry by vector center-oldCenter.
 void setDefaultLabelEnabled(boolean flag)
          Deprecated. since JavaView 3.61.003, use setEnabledIndexLabels(boolean).
 void setDimOfColors(int aSize)
          Let all colors have same number of components aSize<>0.
 void setDimOfTextures(int dim)
          Set dimension of texture domain.
 void setDimOfVectors(int aSize)
          Let all vectors have same number of components aSize<>0.
 void setDimOfVertices(int dim)
          Set dimension of vertices.
 void setEnabledIndexLabels(boolean flag)
          Determine whether drawing of default labels, i.e. item indices, is enabled.
 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.
 void setGlobalVertexColor(java.awt.Color color)
          Set global vertex color to be used if no local colors are available.
 void setGlobalVertexNormalColor(java.awt.Color color)
          Set global vertex normal color to be used if no local colors are available.
 void setGlobalVertexNormalLength(double length)
          Get length factor of vertex normal vectors when drawn in display.
 void setGlobalVertexNormalSize(double size)
          Get thickness in pixels of vertex normals when drawn in display.
 void setGlobalVertexSize(double size)
          Set global radius in pixels of circle to visualize vertices in display.
 void setGlobalVertexSize(int size)
          Deprecated. since JavaView 2.99.020, use setGlobalVertexSize(double).
 void setGlobalVertexTagColor(java.awt.Color color)
          Set global color of tagged vertices.
 void setJvx(PgJvxSrc src)
          Fill this instance with data from a geometry source, for example, previously read from file.
 void setNumVertices(int numVertices)
          Allocate given number of vertices, and allocate normals, colors etc.
 void setShininess(double val)
          Set shininess of highlights of geometry.
 void setSpecularColor(java.awt.Color col)
          Set specular color of geometry.
 void setState(int aKey, boolean aState)
          Set drawing flags of this geometry from within the display.
 void setTagVertex(int anIndex, int aTag)
          Set a tag of a vertex.
 void setTexture(PgTexture texture)
          Set current texture of surface with reference to texture image.
 void setTextureImage(java.awt.Image image)
          Set texture image for vertex and element textures.
 void setTextureImageName(java.lang.String name)
          Set name of texture image, a URL or a relative file name.
 void setTransparency(double alpha)
          Set transparency of geometry.
 void setVertex(int anIndex, double x)
          Copy new coordinate to vertex at specified position in the vertex list.
 void setVertex(int anIndex, double x, double y)
          Copy new coordinates to vertex at specified position in the vertex list.
 void setVertex(int anIndex, double x, double y, double z)
          Copy new coordinates to vertex at specified position in the vertex list.
 boolean setVertex(int anIndex, PdVector aVertex)
          Copy new vertex to vertex at specified position in the vertex list.
 void setVertexColor(int anIndex, java.awt.Color col)
          Copy new color to vertex color at specified position in the color list.
 void setVertexColors(java.awt.Color[] colorList)
          Copy vertex colors of list to existing array of vertex colors.
 void setVertexNormal(int anIndex, PdVector nor)
          Copy new normal to vertex normal at specified position in the normal list.
 void setVertexNormals(PdVector[] normalList)
          Copy vertex normals of list to existing array of vertex normals.
 void setVertexSize(int anIndex, double aSize)
          Assign a new relative vertex size at specified position in the size list.
 void setVertexSizes(PdVector aVertexSize)
          Assign a set of relative vertex sizes.
 void setVertexTexture(int anIndex, PdVector tex)
          Copy new texture to vertex texture at specified position in the texture list.
 void setVertexTextures(PdVector[] texCoords)
          Use the given textures coordinates as vertex-based texture coordinates.
 void setVertices(PdVector[] vertex)
          Copy the first getNumVertices() vertices of source array into an existing vertex array.
 void showIndices(boolean flag)
          Enable and disable showing of indices in display.
 void showSingleVectorField(boolean flag)
          Set flag to show a single or multiple vector fields simultaneously.
 void showTaggedVertices(boolean flag)
          Set flag to enable drawing of tagged vertices.
 void showTransparency(boolean flag)
          Enable usage of transparency.
 void showVectorArrow(boolean flag)
          Deprecated. use showVectorArrows(boolean)
 void showVectorArrows(boolean flag)
          Set flag to enable drawing of tip of vectors as arrow.
 void showVectorColors(boolean flag)
          Set flag to enable drawing of individual vector colors.
 void showVectorField(boolean flag)
          Deprecated. use showVectorFields(boolean)
 void showVectorFields(boolean flag)
          Set flag to enable drawing of all vector fields.
 void showVertexColors(boolean flag)
          Set flag to enable drawing of individual vertex colors.
 void showVertexLabels(boolean flag)
          Set flag to enable drawing of vertex labels in display.
 void showVertexNormalArrow(boolean flag)
          Set flag to enable drawing of arrow of vertex normal.
 void showVertexNormals(boolean flag)
          Set flag to enable drawing of vertex normals.
 void showVertexOutline(boolean flag)
          Set flag whether drawing of border of vertex circles is enabled.
 void showVertexSizes(boolean flag)
          Set flag to enable drawing of vertex sizes.
 void showVertexTexture(boolean flag)
          Set flag to enable drawing of vertex textures.
 void showVertices(boolean flag)
          Set flag to enable drawing of vertices.
 java.lang.String toString()
          Create a multi-line string representation with detailed information about all instance variables.
 void translate(PdVector diff)
          Translate each vertex of geometry by given vector.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addElement, addPolygon, clearTagElement, clearTagPolygon, fillMethodMenu, fillMethodMenu, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getElement, getGeometryInfo, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTitle, getType, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, removeDisplay, removeElement, removeMethodMenus, removePolygon, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setEnabledInstanceSharing, setGeometryInfo, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setTagElement, setTagPolygon, setTitle, setType, setVersion, setVersionType, setVisible, showBndBox, showCenter, showName, showTitle
 
Methods inherited from class jv.object.PsObject
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
assureInspector, getInfoPanel, getName, hasTag, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Constructor Detail

PgPointSet

public PgPointSet()
Constructor of a point set in three-dimensional space.


PgPointSet

public PgPointSet(int aVertexDim)
Constructor of a point set in n-dimensional space.

Parameters:
aVertexDim - number of coordinates per vertex.
Method Detail

init

public void init()
Initialize and reset instance variables after call to super.init().

Overrides:
init in class PgGeometry

setState

public void setState(int aKey,
                     boolean aState)
Set drawing flags of this geometry from within the display. Currently, this method is not intended for public use. Subclasses should overwrite this method and call super for unhandled keys.

Specified by:
setState in interface PgGeometryIf
Overrides:
setState in class PgGeometry
Parameters:
aKey - flag to be set, choose among PvGeometryIf.SHOW_...
aState - enable or disable state

getJvx

public PgJvxSrc getJvx()
Fills a geometry container with data from this instance, for example, to print to file.

Specified by:
getJvx in interface PgGeometryIf
Overrides:
getJvx in class PgGeometry
Returns:
geometry container filled with data from this instance.

setJvx

public void setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.

Specified by:
setJvx in interface PgGeometryIf
Overrides:
setJvx in class PgGeometry
Parameters:
src - a geometry source used to fill this instance with data.

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.

Specified by:
clone in interface PgGeometryIf
Overrides:
clone in class PgGeometry
See Also:
copy(PsObject)

copy

public void copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.

The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use jv.object.PsObject#copy(PsObject) instead of jv.project.PgGeometry#copy(PsObject).

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

toString

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

Specified by:
toString in interface PgGeometryIf
Overrides:
toString 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.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PgGeometry

getTexture

public PgTexture getTexture()
Get current texture of surface.


setTexture

public void setTexture(PgTexture texture)
Set current texture of surface with reference to texture image. Passing null as argument will remove texture but will not remove texture coordinates. Use removeTexture to remove texture coordinates too and switch off display of texture.


removeTexture

public void removeTexture()
Remove all texture information from surface and switch off showing of texture. Removes texture image and texture coordinates from elements and vertices both.


getTextureImageName

public java.lang.String getTextureImageName()
Get name of texture image, a full URL or a relative file name.

Specified by:
getTextureImageName in interface PgGeometryIf
Overrides:
getTextureImageName in class PgGeometry

setTextureImageName

public void setTextureImageName(java.lang.String name)
Set name of texture image, a URL or a relative file name. If instance variable texture does not exist then allocate a new instance.

Specified by:
setTextureImageName in interface PgGeometryIf
Overrides:
setTextureImageName in class PgGeometry
Parameters:
name - Name of a texture image file.

getTextureImage

public java.awt.Image getTextureImage()
Get image object of texture.

Specified by:
getTextureImage in interface PgGeometryIf
Overrides:
getTextureImage in class PgGeometry

setTextureImage

public void setTextureImage(java.awt.Image image)
Set texture image for vertex and element textures. If instance variable texture does not exist then allocate a new instance.

Specified by:
setTextureImage in interface PgGeometryIf
Overrides:
setTextureImage in class PgGeometry
Parameters:
image - texture image object.

getShininess

public double getShininess()
Get shininess of highlights of geometry.


setShininess

public void setShininess(double val)
Set shininess of highlights of geometry.


getSpecularColor

public java.awt.Color getSpecularColor()
Get specular color of geometry.


setSpecularColor

public void setSpecularColor(java.awt.Color col)
Set specular color of geometry.


isShowingTransparency

public boolean isShowingTransparency()
Determines whether usage of transparence is enabled.


showTransparency

public void showTransparency(boolean flag)
Enable usage of transparency.


getTransparency

public double getTransparency()
Get transparency of geometry.


setTransparency

public void setTransparency(double alpha)
Set transparency of geometry.


applyModelingMatrix

public boolean applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors. The modeling matrix of this geometry is set to the identity matrix.

Overrides:
applyModelingMatrix in class PgGeometry
Returns:
true if operation was applied successfully.
Since:
JavaView 2.36

applyAmbientMatrix

public boolean applyAmbientMatrix()
Multiply the ambient matrix to all vertices and vectors. The ambient matrix of this geometry is set to the identity matrix.

Overrides:
applyAmbientMatrix in class PgGeometry
Returns:
true if operation was applied successfully.
Since:
JavaView 2.36

projectFromAmbientSpace

public boolean projectFromAmbientSpace()
Apply projection matrix and perform projection determined by projection flag of the surface in a Euclidean model R3, R2, or R1 with parallel projection. Dimension of vertices may be decremented by one after this operation.

Overrides:
projectFromAmbientSpace in class PgGeometry
Returns:
true if operation was applied successfully.
Since:
JavaView 2.89.000

getBounds

public PdVector[] getBounds()
Compute bounding box of the vertices which are transformed with ambient and model matrix.

The two returned bounding box vectors are 3-dimensional. If dimension of vertices is less than 3 then remaining components are zeroed.

An empty geometry is located at the origin in 3d space.

Note, transformations not supported yet.

Overrides:
getBounds in class PgGeometry
Returns:
two 3d vectors which are the extremal corners of the bounding cube
See Also:
getAmbientBounds()

getAmbientBounds

public PdVector[] getAmbientBounds()
Compute bounding box of this geometry from the set of all vertices, or return null if no vertices. Method returns two vectors whose size is equal to the dimenstion of this geometry. The two bounding vectors are first, the minimal corner, and second, the maximal corner of the bounding m_dim-cube. Both vectors uniquely determine the bounding box.

Returns null if no vertices are allocated yet.

Note, the bounding box does not include transformations from the ambient or model matrix.

Overrides:
getAmbientBounds in class PgGeometry
Returns:
two vectors which are the extremal corners of the bounding cube
See Also:
getBounds()

getCenterOfBndBox

public PdVector getCenterOfBndBox()
Compute center of geometry as midpoint of the bounding box. If geometry has no vertices, center is undetermined.

The center has same dimension as all vertices.

Returns:
Center of bounding box
See Also:
getCenterOfGravity(), PgGeometry.getCenter()

setCenterOfBndBox

public void setCenterOfBndBox(PdVector center)
Move each vertex of geometry by vector center-oldCenter. Method calls translate to shift vertices.

See Also:
PgGeometry.getCenter(), PgGeometry.setCenter(PdVector)

getCenterOfGravity

public PdVector getCenterOfGravity()
Compute center of geometry as the mean all vertices, i.e. center of gravity. Return origin if no vertices available. Return null if missing dimension of vertices.

The center has same dimension as all vertices.

See Also:
PgGeometry.getCenter()

setDimOfVertices

public void setDimOfVertices(int dim)
Set dimension of vertices. Make rare use, and try to assign dimension of vertices already in the constructor.


getNumVertices

public final int getNumVertices()
Get number of vertices in vertex array. Note, that the actual size of the vertex array may be larger for efficiency reasons. Therefore, do not use vertex.length.


getMaxNumVertices

public final int getMaxNumVertices()
Get total length of allocated vertex array. Usually, only a subset is filled with data. Method is for internal use, see getNumVertices() for daily work.


getVertices

public PdVector[] getVertices()
Get vertex array for read and write access, but do not modify the size of any vector.

Note, that the actual size of the vertex array may differ from getNumVertices() for efficiency reasons. Therefore, do not use vertex.length but use getNumVertices().

Note, the array is void as soon as the number of vertices changes. After issuing setNumVertices(int) then call this method again.


getVertex

public PdVector getVertex(int anIndex)
Get a reference to an individual vertex.

Specified by:
getVertex in interface PgGeometryIf
Overrides:
getVertex in class PgGeometry
Parameters:
anIndex - index of vertex

getVertexColor

public java.awt.Color getVertexColor(int anIndex)
Get a reference to an individual vertex color.

Parameters:
anIndex - index of vertex

getVertexNormal

public PdVector getVertexNormal(int anIndex)
Get a reference to an individual vertex normal.

Parameters:
anIndex - index of vertex

getVertexSize

public double getVertexSize(int anIndex)
Get relative size of an individual vertex.

Parameters:
anIndex - index of vertex
Since:
JavaView 2.43

getVertexTexture

public PdVector getVertexTexture(int anIndex)
Get a reference to an individual vertex texture coordinate.

Parameters:
anIndex - index of vertex

getGlobalVertexColor

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


getGlobalVertexTagColor

public java.awt.Color getGlobalVertexTagColor()
Get global color of tagged vertices.


getGlobalVertexSize

public double getGlobalVertexSize()
Get global radius in pixels of circle to visualize vertices in display.


getGlobalVertexNormalColor

public java.awt.Color getGlobalVertexNormalColor()
Get global vertex normal color which is used if no local colors are available.


getGlobalVertexNormalLength

public double getGlobalVertexNormalLength()
Get length factor of vertex normal vectors when drawn in display.


getGlobalVertexNormalSize

public double getGlobalVertexNormalSize()
Get thickness in pixels of vertex normals when drawn in display.


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.


setGlobalVertexColor

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


setGlobalVertexTagColor

public void setGlobalVertexTagColor(java.awt.Color color)
Set global color of tagged vertices.


setGlobalVertexSize

public void setGlobalVertexSize(double size)
Set global radius in pixels of circle to visualize vertices in display.


setGlobalVertexSize

public void setGlobalVertexSize(int size)
Deprecated. since JavaView 2.99.020, use setGlobalVertexSize(double).

Set global radius in pixels of circle to visualize vertices in display.


setGlobalVertexNormalColor

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


setGlobalVertexNormalLength

public void setGlobalVertexNormalLength(double length)
Get length factor of vertex normal vectors when drawn in display.


setGlobalVertexNormalSize

public void setGlobalVertexNormalSize(double size)
Get thickness in pixels of vertex normals when drawn in display.


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.


getVertexColors

public java.awt.Color[] getVertexColors()
Get color array for read and write access, but do not modify the size of any color vector. Note, that subclasses may not reference all vertex colors. Also note, that the actual size of the array may be larger than the number of used vertices for efficiency reasons. Therefore, do not use length of array.


getVertexNormals

public PdVector[] getVertexNormals()
Get vertex normal array for read and write access, but do not modify the size of any normal vector. Note, that subclasses may not reference all vertex normals. Also note, that the actual size of the array may be larger than the number of used vertices for efficiency reasons. Therefore, do not use length of array.


getVertexSizes

public PdVector getVertexSizes()
Get array of relative vertex sizes for read and write access. Note, that subclasses may not reference all vertex sizes. Also note, that the actual size of the array may be larger than the number of used vertices for efficiency reasons. Therefore, do not use length of array.

Since:
JavaView 2.43

getVertexTextures

public PdVector[] getVertexTextures()
Get vertex texture array for read and write access, but do not modify the size of any texture vector. Note, that subclasses may not reference all vertex textures. Also note, that the actual size of the array may be larger than the number of used vertices for efficiency reasons. Therefore, do not use length of array. Each vertex has associated a 2-dimensional vector with normalized texture coordinates.


isEnabledIndexLabels

public boolean isEnabledIndexLabels()
Determine whether drawing of default labels, i.e. item indices, is enabled. Usually, the default label is the index of an item in an array. For example, the index of a vertex in the vertex array of a point set. By default, usage of default labels is enabled.

See Also:
isShowingIndices()

isDefaultLabelEnabled

public boolean isDefaultLabelEnabled()
Deprecated. since JavaView 3.61.003, use isEnabledIndexLabels().

Determine whether drawing of default labels, i.e. item indices, is enabled. Usually, the default label is the index of an item in an array. For example, the index of a vertex in the vertex array of a point set. By default, usage of default labels is enabled.

See Also:
isShowingIndices()

isShowingIndices

public boolean isShowingIndices()
Check whether showing of indices is switched on. If no label is specified for an item the a default label is drawing.

See Also:
isEnabledIndexLabels(), setEnabledIndexLabels(boolean)

isShowingVertexLabels

public boolean isShowingVertexLabels()
Determine whether showing of vertex labels is enabled.


isShowingVertices

public boolean isShowingVertices()
Determine whether showing of vertices is enabled.


isShowingTaggedVertices

public boolean isShowingTaggedVertices()
Determine whether showing of tagged vertices is enabled.


isShowingVertexColors

public boolean isShowingVertexColors()
Determine whether showing of vertex colors is enabled.


isShowingVertexNormals

public boolean isShowingVertexNormals()
Determine whether showing of vertex normals is enabled.


isShowingVertexNormalArrow

public boolean isShowingVertexNormalArrow()
Determines whether drawing of arrow of vertex normals is enabled.


isShowingVertexSizes

public boolean isShowingVertexSizes()
Determine whether showing of vertex sizes is enabled.

Since:
JavaView 2.43

isShowingVertexTexture

public boolean isShowingVertexTexture()
Determine whether showing of vertex textures is enabled.


isShowingVectorField

public boolean isShowingVectorField()
Deprecated. use isShowingVectorFields()

Determine whether showing of vector fields is enabled.


isShowingVectorFields

public boolean isShowingVectorFields()
Determine whether showing of vector fields is enabled.


isShowingSingleVectorField

public boolean isShowingSingleVectorField()
Set flag to show a single or multiple vector fields simultaneously.


isShowingVectorArrow

public boolean isShowingVectorArrow()
Deprecated. use isShowingVectorArrows()

Determine whether showing of tip of vectors as arrow is enabled.


isShowingVectorArrows

public boolean isShowingVectorArrows()
Determine whether showing of tip of vectors as arrow is enabled.


isShowingVectorColors

public boolean isShowingVectorColors()
Determine whether showing of individual vector colors is enabled.


isShowingVertexOutline

public boolean isShowingVertexOutline()
Determines whether drawing of border of vertex circles is enabled.


showVertexOutline

public void showVertexOutline(boolean flag)
Set flag whether drawing of border of vertex circles is enabled.


setEnabledIndexLabels

public void setEnabledIndexLabels(boolean flag)
Determine whether drawing of default labels, i.e. item indices, is enabled. Usually, the default label is the index of an item in an array. For example, the index of a vertex in the vertex array of a point set. By default, usage of of default labels is enabled.

See Also:
showIndices(boolean)

setDefaultLabelEnabled

public void setDefaultLabelEnabled(boolean flag)
Deprecated. since JavaView 3.61.003, use setEnabledIndexLabels(boolean).

Determine whether drawing of default labels, i.e. item indices, is enabled. Usually, the default label is the index of an item in an array. For example, the index of a vertex in the vertex array of a point set. By default, usage of of default labels is enabled.

See Also:
showIndices(boolean)

showIndices

public void showIndices(boolean flag)
Enable and disable showing of indices in display. If no label is specified for an item then a default label is drawing. Usually, the default label is the index of an item in an array. For example, the index of a vertex in the vertex array of a point set. By default, showing of labels is disabled.

See Also:
isEnabledIndexLabels(), setEnabledIndexLabels(boolean)

showVertexLabels

public void showVertexLabels(boolean flag)
Set flag to enable drawing of vertex labels in display.


showVertices

public void showVertices(boolean flag)
Set flag to enable drawing of vertices.


showTaggedVertices

public void showTaggedVertices(boolean flag)
Set flag to enable drawing of tagged vertices.


showVertexColors

public void showVertexColors(boolean flag)
Set flag to enable drawing of individual vertex colors.


showVertexNormals

public void showVertexNormals(boolean flag)
Set flag to enable drawing of vertex normals.


showVertexNormalArrow

public void showVertexNormalArrow(boolean flag)
Set flag to enable drawing of arrow of vertex normal.


showVertexSizes

public void showVertexSizes(boolean flag)
Set flag to enable drawing of vertex sizes.

Since:
JavaView 2.43

showVertexTexture

public void showVertexTexture(boolean flag)
Set flag to enable drawing of vertex textures.


showVectorField

public void showVectorField(boolean flag)
Deprecated. use showVectorFields(boolean)

Set flag to enable drawing of all vector fields.


showVectorFields

public void showVectorFields(boolean flag)
Set flag to enable drawing of all vector fields.


showSingleVectorField

public void showSingleVectorField(boolean flag)
Set flag to show a single or multiple vector fields simultaneously.


showVectorArrow

public void showVectorArrow(boolean flag)
Deprecated. use showVectorArrows(boolean)

Set flag to enable drawing of tip of vectors as arrow.


showVectorArrows

public void showVectorArrows(boolean flag)
Set flag to enable drawing of tip of vectors as arrow.


showVectorColors

public void showVectorColors(boolean flag)
Set flag to enable drawing of individual vector colors.


makeVertexNormals

public boolean makeVertexNormals()
Check existence and allocate vertex array structure. If instance of a derived class then derived class is responsible to compute values of vertex normals.

Not implemented yet: If instance of PgPointSet then calculate vertex normals of a point set as eigenvector with smallest eigenvalue of the covariance matrix. Then the vertex neighbourhood must exist.

Since:
JavaView 2.66

setNumVertices

public void setNumVertices(int numVertices)
Allocate given number of vertices, and allocate normals, colors etc. if they already exist. Internally, there may exist more vertices than requested serving as buffer and to reduce allocation times.


getDimOfColors

public int getDimOfColors()
Get dimension of colors, i.e. number of components of each color vector.


setDimOfColors

public void setDimOfColors(int aSize)
Let all colors have same number of components aSize<>0.

Parameters:
aSize - Number of components of each color vector.

getDimOfVectors

public int getDimOfVectors()
Get dimension of vectors, i.e. number of components of each of the vectors.


setDimOfVectors

public void setDimOfVectors(int aSize)
Let all vectors have same number of components aSize<>0. It is more efficient to call method before setNumVertices().

Parameters:
aSize - Number of coordinates of each vector.

getDimOfTextures

public int getDimOfTextures()
Get dimension of textures, i.e. number of components of each of the texture vectors.


setDimOfTextures

public void setDimOfTextures(int dim)
Set dimension of texture domain. TODO: do not allocate vertex texture coordinates here since user might use element textures.


hasVertexColors

public boolean hasVertexColors()
Check if vertex colors have been allocated.

See Also:
assureVertexColors()

hasVertexNormals

public boolean hasVertexNormals()
Check if vertex normals have been allocated.

See Also:
assureVertexNormals()

hasVertexSizes

public boolean hasVertexSizes()
Check if relative vertex sizes have been allocated.

Since:
JavaView 2.43
See Also:
assureVertexSizes()

hasVertexTextures

public boolean hasVertexTextures()
Check if vertex textures have been allocated.

See Also:
assureVertexTextures()

assureVertexColors

public void assureVertexColors()
Assures respectively allocates correct length of vertex color array. Length of array is equal to length of vertex array.


assureVertexNormals

public void assureVertexNormals()
Assures respectively allocates correct length of vertex normal array. Length of array is equal to length of vertex array. Dimension of normal vectors is equal to dimension of vertices.


assureVertexSizes

public void assureVertexSizes()
Assures respectively allocates correct length of vertex size array. Length of array is equal to length of vertex array. Dimension of size vector is equal to maximal number of vertices.

Since:
JavaView 2.43

assureVertexTextures

public void assureVertexTextures()
Assures respectively allocates correct length of vertex texture array. Length of array is equal to length of vertex array. Dimension of texture coordinates is equal to getDimOfTextures().


paint

public void paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. See jv.project.PgGeometryIf for detailed information.

Specified by:
paint in interface PgGeometryIf
Overrides:
paint in class PgGeometry
See Also:
PgGeometryIf

clearTagVertex

public void clearTagVertex(int anIndex,
                           int aTag)
Clear a single tag of a vertex. For possible tags see PvGeometryIf.

Specified by:
clearTagVertex in interface PgGeometryIf
Overrides:
clearTagVertex in class PgGeometry
See Also:
setTagVertex(int, int), hasTagVertex(int, int)

hasTagVertex

public boolean hasTagVertex(int anIndex,
                            int aTag)
Check whether vertex has given tag. For possible tags see PvGeometryIf.

Specified by:
hasTagVertex in interface PgGeometryIf
Overrides:
hasTagVertex in class PgGeometry
See Also:
setTagVertex(int, int), clearTagVertex(int, int)

setTagVertex

public void setTagVertex(int anIndex,
                         int aTag)
Set a tag of a vertex. For possible tags see PvGeometryIf.

Specified by:
setTagVertex in interface PgGeometryIf
Overrides:
setTagVertex in class PgGeometry
See Also:
clearTagVertex(int, int), hasTagVertex(int, int)

hasVertex

public int hasVertex(PdVector aVertex,
                     double eps)
Looks in the vertex list if there is a vertex within a given euclidean distance. Method calls PdVector.equals(PdVector, double).

Parameters:
aVertex - vertex to be found in vertex list
Returns:
index of first found identical vertex (-1 if none)

hasVertex

public int hasVertex(PdVector aVertex)
Looks in the vertex list if there is a vertex with same coordinates like the passed one. Method calls PdVector.equals(PdVector).

Parameters:
aVertex - vertex to be found in vertex list
Returns:
index of first found identical vertex (-1 if none)

addVertex

public int addVertex(PdVector aVertex)
Add new vertex to the end of the vertex list Method just calls setVertex(int, PdVector).

Specified by:
addVertex in interface PgGeometryIf
Overrides:
addVertex in class PgGeometry
Parameters:
aVertex - vertex to be added to vertex list
Returns:
index of added vertex in vertex list

removeVertex

public int[] removeVertex(int ind)
Remove vertex at specified position in the vertex list. Index Method just marks vertex with tag PsObject.IS_DELETED and invokes removeMarkedVertices().

Note, when removeMarkedVertices() is called then many subclasses remove elements which refer to the deleted vertex. Therefore, it is not advised to use this method for frequent updating of a geometry.

Specified by:
removeVertex in interface PgGeometryIf
Overrides:
removeVertex in class PgGeometry
Returns:
array with indices of new positions of vertices

setVertices

public void setVertices(PdVector[] vertex)
Copy the first getNumVertices() vertices of source array into an existing vertex array. Length of argument vertex list must be equal or larger than getNumVertices(). The dimension of all argument vertices must be equal to getDimOfVertices() of the geometry.

Parameters:
vertex - array with new vertices

getMarkedVertices

public int[] getMarkedVertices()
Get indices of all selected vertices marked with tag PsObject#IS_SELECTED.

Returns:
array with indices of all selected vertices

removeMarkedVertices

public int[] removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from the vertex list. Method should usually be overwritten in subclasses to ensure that vertices are no longer referenced by elements or polygons.

Returns:
array with indices of new positions of vertices

removeVertexColors

public void removeVertexColors()
Remove local vertex colors from a geometry and use global vertex color instead.

Showing of vertex colors must be switched off explicitly using showVertexColors(boolean).


setVertexColors

public void setVertexColors(java.awt.Color[] colorList)
Copy vertex colors of list to existing array of vertex colors. Length of argument list must be equal or larger than getNumVertices(). All vertex colors are copied. The dimension of all argument colors must be equal to getDimOfColors() of the geometry.

Showing of vertex colors must be switched on in order to be visible.

Parameters:
colorList - array with new vertex colors

removeVertexNormals

public void removeVertexNormals()
Remove vertex normals from a geometry.

Showing of vertex normals must be switched off explicitly using showVertexNormals(boolean).


setVertexNormals

public void setVertexNormals(PdVector[] normalList)
Copy vertex normals of list to existing array of vertex normals. Length of argument list must be equal or larger than getNumVertices(). All vertex normals are copied. The dimension of all argument normals must be equal to getDimOfVectors() of the geometry.

Showing of vertex normals must be switched on in order to be visible.

Parameters:
normalList - array with new vertex normals

removeVertexSizes

public void removeVertexSizes()
Remove vertex sizes from a geometry.

Showing of vertex sizes must be switched off explicitly using showVertexSizes(boolean).

Since:
JavaView 2.43

setVertexSizes

public void setVertexSizes(PdVector aVertexSize)
Assign a set of relative vertex sizes. Length of argument list must be equal or larger than getNumVertices(). All vertex sizes are copied.

Showing of vertex sizes must be switched on in order to be visible.

Parameters:
aVertexSize - array with new vertex size for all vertices
Since:
JavaView 2.43

setVertexTextures

public void setVertexTextures(PdVector[] texCoords)
Use the given textures coordinates as vertex-based texture coordinates. Length of argument list must be equal or larger than getNumVertices(). All vertex textures are copied. The dimension of all argument textures must be equal to getDimOfTextures() of the geometry.

Showing of textures must be switched on in order to be visible.

Parameters:
texCoords - array with new vertex textures

setVertex

public boolean setVertex(int anIndex,
                         PdVector aVertex)
Copy new vertex to vertex at specified position in the vertex list. Vertex must have same dimension as geometry. If too large then the exceeding components are truncated, if too small then missing components are filled with zero.

Specified by:
setVertex in interface PgGeometryIf
Overrides:
setVertex in class PgGeometry
Parameters:
anIndex - index of vertex position
aVertex - vertex to be copied to vertex list
Returns:
false, if index out of range, or argument missing

setVertex

public void setVertex(int anIndex,
                      double x)
Copy new coordinate to vertex at specified position in the vertex list. Number of vertices is increased if required. Dimension of vertices of geometry must be equal 1.

Parameters:
anIndex - index of vertex
x - x coordinate of vertex

setVertex

public void setVertex(int anIndex,
                      double x,
                      double y)
Copy new coordinates to vertex at specified position in the vertex list. Number of vertices is increased if required. Dimension of vertices of geometry must be equal 2.

Parameters:
anIndex - index of vertex
x - x coordinate of vertex
y - y coordinate of vertex

setVertex

public void setVertex(int anIndex,
                      double x,
                      double y,
                      double z)
Copy new coordinates to vertex at specified position in the vertex list. Number of vertices is increased if required. Dimension of vertices of geometry must be equal 3.

Parameters:
anIndex - index of vertex
x - x coordinate of vertex
y - y coordinate of vertex
z - z coordinate of vertex

setVertexColor

public void setVertexColor(int anIndex,
                           java.awt.Color col)
Copy new color to vertex color at specified position in the color list.

Parameters:
anIndex - index of vertex position
col - color to be copied to color list

setVertexNormal

public void setVertexNormal(int anIndex,
                            PdVector nor)
Copy new normal to vertex normal at specified position in the normal list.

Parameters:
anIndex - index of vertex position
nor - normal to be copied to normal list

setVertexSize

public void setVertexSize(int anIndex,
                          double aSize)
Assign a new relative vertex size at specified position in the size list.

Parameters:
anIndex - index of vertex position
aSize - size to be copied to size list
Since:
JavaView 2.43

setVertexTexture

public void setVertexTexture(int anIndex,
                             PdVector tex)
Copy new texture to vertex texture at specified position in the texture list.

Parameters:
anIndex - index of vertex position
tex - texture to be copied to texture list

addVectorField

public int addVectorField(PgVectorField vf)
Add a vertex or element based vector field to geometry. Adding the same vector field again will have no effect unless the vector field is removed. Geometry is registered in vector field with PgVectorField#setGeometry(PgPointSet)


getNumVectorFields

public int getNumVectorFields()
Get number of vector fields.


getIndexOfVectorField

public int getIndexOfVectorField(PgVectorField vf)
Get index of vector fields, assumes user data is stored in a vector.

Returns:
index of vector field, or -1 if it does not exist

getVectorField

public PgVectorField getVectorField(java.lang.String name)
Get a vector field via its name.


getVectorField

public PgVectorField getVectorField(int anInd)
Get a vector field via its index. Note, the index of a vector field may change when vector fields are added or removed to this geometry, and also when a geometry including vector fields is saved and reloaded to a file.


removeVectorField

public boolean removeVectorField(PgGeometryIf vf)
Remove a vector field from geometry.


removeAllVectorFields

public void removeAllVectorFields()
Remove all user added vector fields.


removeHiddenVectorFields

public int removeHiddenVectorFields()
Remove all invisible vector fields.

Returns:
number of removed vector fields
Since:
JavaView 2.30

getSelectedVectorField

public PgVectorField getSelectedVectorField()
Get the currently selected vector field, or null if there is none.


selectVectorField

public int selectVectorField(PgVectorField vf)
Select a vector field. If showing of a single vector field is enabled then the previous selected field is made invisible and the new selection is made visible.

See Also:
isShowingSingleVectorField()

computeRotation

public void computeRotation(PgPolygon meridian,
                            int numULines)
Generate rotational symmetric surface from given meridian around x-axis. Compute vertex normals.

Parameters:
meridian - meridian curve given a polygon
numULines - discretization in angular direction

computeCone

public void computeCone(int numULines,
                        int numVLines,
                        double bottomRadius,
                        double height)
Generate cone in z-direction centered at the origin with given bottom radius and height. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in angular direction
numVLines - discretization in z-axis direction
bottomRadius - radius of bottom disk of cone
height - height of cone from bottom disk to tip

computeCylinder

public void computeCylinder(int numULines,
                            int numVLines,
                            double radius,
                            double length)
Generate cylinder in z-direction centered at the origin with given radius and length. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in angular direction
numVLines - discretization in z-axis direction
radius - radius of cylinder
length - height of cylinder

computeDisk

public void computeDisk(int numULines,
                        int numVLines,
                        double radius)
Generate disk in xy-plane with given radius. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in radial direction
numVLines - discretization in angular direction
radius - radius of disk

computePlane

public void computePlane(int numULines,
                         int numVLines,
                         double uMin,
                         double vMin,
                         double uMax,
                         double vMax)
Generate rectangle in z=0 plane with given min/max values. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in x direction
numVLines - discretization in y direction
uMin - u coordinate of lower left corner of rectangle
vMin - v coordinate of lower left corner of rectangle
uMax - u coordinate of upper right corner of rectangle
vMax - v coordinate of upper right corner of rectangle

computeSphere

public void computeSphere(int numULines,
                          int numVLines,
                          double radius)
Generate sphere at origin with given radius. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
radius - radius of sphere

computeTorus

public void computeTorus(int numULines,
                         int numVLines,
                         double radius,
                         double thick)
Generate torus in x-y plane with given radius of soal and thickness of tube. Compute vertex normals. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
radius - radius of soal
thick - radius of torus tube

computeSnail

public void computeSnail(int numULines,
                         int numVLines,
                         double numWindings)
Generate a winding snail. Sample method to have simple geometry available for test purposes.

Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
numWindings - number of half-turns of snail house

merge

public boolean merge(PgGeometryIf aGeom)
Merge two point sets and store union in this. Number of vertices is the sum of both geometries.

The merged geometry will local colors allocated and assignd if

		1. both the global color of both geometries are different, or
		2. either geometry has local colors.
 
If local colors are allocated but one of the geometries does not have local colors then its local colors are be assumed to be its global color. The merged geometry will show globalVertexColors if
		1. the global color of both geometries is the same, and
		2. both geometries are showing the global color.
 
In all other cases the merged geometry will show local colors. The global color of the merged geometry is never changed.

Specified by:
merge in interface PgGeometryIf
Overrides:
merge in class PgGeometry
Parameters:
aGeom - Second geometry, will not be modified.
Returns:
true on success, false is argument null.

blend

public boolean blend(double s,
                     PgGeometry ag,
                     double t,
                     PgGeometry bg)
Blend between two point sets using this = s*ag + t*bg.

Specified by:
blend in interface PgGeometryIf
Overrides:
blend in class PgGeometry
Parameters:
s - weight of vertices of first geometry
ag - first geometry used for blending
t - weight of vertices of second geometry
bg - second geometry used for blending
Returns:
true on success

flipOrientation

public void flipOrientation()
Change orientation of normal vectors. This method just multiplies each normal vector with -1 and, therefore, must be overwritten by subclasses such as PgElementSet and PgPolygon.


projectToSphere

public void projectToSphere(PdVector center,
                            double radius)
Project all vertices to the sphere with given center and radius.


translate

public void translate(PdVector diff)
Translate each vertex of geometry by given vector. Method translates the actual center of the geometry too.


scale

public void scale(double factor)
Scale each vertex of geometry by given factor w.r.t. its center using formula: vertex = (1-s)*center + s*vertex. A factor value 1 will not change the geometry, and a factor 0 will shrink geometry to its center.

See Also:
PgGeometry.getCenter()

scale

public void scale(double factor,
                  PdVector center)
Deprecated. use scale(double) instead

Scale each vertex of geometry by given factor w.r.t. to given center.


makeColorFromVectorLength

public boolean makeColorFromVectorLength()
Create color from the length of vectors of the selected vector field.


makeVertexColorsFromXYZ

public boolean makeVertexColorsFromXYZ()
Create color from the vertex position within its bounding box which is interpreted as RGB cube. If dimension of vertices is smaller than three then only the first vertex components are used in the color computation.


makeVertexColorsFromZ

public boolean makeVertexColorsFromZ()
Create color from the vertical z-height within its bounding box ranging from low blue to high red. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.


makeVertexColorsFromZHue

public boolean makeVertexColorsFromZHue()
Create color from the vertical z-height within its bounding box ranging through hue rainbow. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.


makeQuadrVertexTexture

public void makeQuadrVertexTexture(int uDiscr,
                                   int vDiscr)
Generate default vertex texture in [0,1]*[0,1] for a quadrilateral surface. v-direction runs first from 0. to 1..

Parameters:
uDiscr - Number of lines in u direction.
vDiscr - Number of lines in v direction.

makeVertexTextureFromBndBox

public boolean makeVertexTextureFromBndBox(int ix,
                                           int iy)
Create vertex texture from a plane of the bounding box. Plane is determined by the integer arguments (ix,iy). For example, (0,1) uses the xy-plane, and (1,2) the yz-plane of the bounding box. Bounding box is normalized to unit cube. Dimension of vertices must be 2 or greater.

Parameters:
ix - index of x-direction of plane
iy - index of y-direction of plane

makeVertexTextureFromUV

public boolean makeVertexTextureFromUV(int numULines,
                                       int numVLines,
                                       int flip)
Create vertex texture of a parametrized surface with (u,v)-grid. Product uLines*vLines must be equal to numVertices of this point set.

Parameters:
numULines - number of parameter lines in u-direction.
numVLines - number of parameter lines in v-direction.
flip - Either 0 or 1 indicating (u,v) or (v,u) mapping.
Returns:
false if numVertices!=numULines*numVLines
Since:
JavaView 3.50.001

makeVertexTextureFromCylinder

public boolean makeVertexTextureFromCylinder(PdVector center,
                                             PdVector axis)
Create vertex texture from cylinder with given axis. Dimension of vertices and of both arguments must be 3 or greater. Axis must have unit length.

Parameters:
center - an arbitrary point on the axis of the cylinder
axis - unit length direction of the axis of the cylinder

makeVertexTextureFromSphere

public boolean makeVertexTextureFromSphere(PdVector center)
Create vertex texture from sphere with given center. Dimension of vertices must be 3 or greater.

Parameters:
center - Center of sphere

reflect

public PgGeometry reflect(PdMatrix mat,
                          boolean bOrient,
                          boolean bVector)
Generate a cloned geometry and transform vertices by a matrix. For example, this method is called to calculate mirror images of a geometry. Orientation of geometry affects surface vectors.

Specified by:
reflect in interface PgGeometryIf
Overrides:
reflect in class PgGeometry
Parameters:
mat - 3*3 or 4*4 transformation matrix
bOrient - flag whether to keep the orientation of the geometry
bVector - flag whether to keep the orientation of vectors
Returns:
new reflected copy of the geometry

intersectionWithLine

public PvPickEvent intersectionWithLine(PdVector rayBase,
                                        PdVector rayDir)
Find intersection of this point set with a given ray. Closest vertex is located. Method is used for interactive picking.

Specified by:
intersectionWithLine in interface PgGeometryIf
Overrides:
intersectionWithLine in class PgGeometry
Parameters:
rayBase - base point of ray eventually hitting the point set
rayDir - direction point of ray eventually hitting the point set
Returns:
full information about hit point.

getEulerCharacteristic

public int getEulerCharacteristic()
Compute Euler characteristic of a polyhedral complex.

Note, in subclasses the number of vertices may include some vertices which are not referenced by simplices. The number of unused vertices might be subtracted from the number of vertices found in the F-vector when computing the Euler characteristic, or apply a method to remove unused vertices before calculating the Euler characteristic.

Since:
JavaView 2.85.005

getFVector

public int[] getFVector()
Compute F-vector that is the number of points, edges, faces, etc.


JavaView© v3.95.000

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