public class PgPointSet extends PgGeometry
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.
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 |
---|
PgPointSet()
Constructor of a point set in three-dimensional space.
|
PgPointSet(int aVertexDim)
Constructor of a point set in n-dimensional space.
|
Modifier and Type | Method and Description |
---|---|
void |
addGeometryItem(java.lang.String item)
List of geometry items available in this geometry, such as "Name", "Vertex" etc.
|
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 ind,
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 object 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 ind)
Get a vector field via its index.
|
PgVectorField |
getVectorField(java.lang.String name)
Get a vector field via its name.
|
PdVector |
getVertex(int ind)
Get a reference to an individual vertex.
|
java.awt.Color |
getVertexColor(int ind)
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 ind)
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 ind)
Get relative size of an individual vertex.
|
PdVector |
getVertexSizes()
Get array of relative vertex sizes for read and write access.
|
PdVector |
getVertexTexture(int ind)
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 ind,
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 rayBaseWorld,
PdVector rayDirWorld)
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 |
setMaxNumVertices(int numVertices)
Allocate given number of vertices, and allocate normals, colors etc.
|
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 ind,
int aTag)
Set a tag of a vertex.
|
void |
setTexture(PgTexture texture)
Copy current texture of surface and assign reference to current 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 ind,
double x)
Copy new coordinate to vertex at specified position in the vertex list.
|
void |
setVertex(int ind,
double x,
double y)
Copy new coordinates to vertex at specified position in the vertex list.
|
void |
setVertex(int ind,
double x,
double y,
double z)
Copy new coordinates to vertex at specified position in the vertex list.
|
boolean |
setVertex(int ind,
PdVector aVertex)
Copy new vertex to vertex at specified position in the vertex list.
|
void |
setVertexColor(int ind,
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 ind,
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 ind,
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 ind,
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.
|
addDisplay, addElement, addPolygon, clearTagElement, clearTagPolygon, convertWorldToModel, 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
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 PgPointSet()
public PgPointSet(int aVertexDim)
aVertexDim
- number of coordinates per vertex.public void init()
init
in class PgGeometry
public void addGeometryItem(java.lang.String item)
public void setState(int aKey, boolean aState)
setState
in interface PgGeometryIf
setState
in class PgGeometry
aKey
- flag to be set, choose among PvGeometryIf.SHOW_...aState
- enable or disable statepublic PgJvxSrc getJvx()
getJvx
in interface PgGeometryIf
getJvx
in class PgGeometry
public void setJvx(PgJvxSrc src)
setJvx
in interface PgGeometryIf
setJvx
in class PgGeometry
src
- a geometry source used to fill this instance with data.public java.lang.Object clone()
null
.clone
in interface PgGeometryIf
clone
in class PgGeometry
copy(PsObject)
public void copy(PsObject object)
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).
copy
in class PgGeometry
clone()
public java.lang.String toString()
toString
in interface PgGeometryIf
toString
in class PgGeometry
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 PgTexture getTexture()
public void setTexture(PgTexture texture)
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.public void removeTexture()
public java.lang.String getTextureImageName()
getTextureImageName
in interface PgGeometryIf
getTextureImageName
in class PgGeometry
public void setTextureImageName(java.lang.String name)
setTextureImageName
in interface PgGeometryIf
setTextureImageName
in class PgGeometry
name
- Name of a texture image file.public java.awt.Image getTextureImage()
getTextureImage
in interface PgGeometryIf
getTextureImage
in class PgGeometry
public void setTextureImage(java.awt.Image image)
setTextureImage
in interface PgGeometryIf
setTextureImage
in class PgGeometry
image
- texture image object.public double getShininess()
public void setShininess(double val)
public java.awt.Color getSpecularColor()
public void setSpecularColor(java.awt.Color col)
public boolean isShowingTransparency()
public void showTransparency(boolean flag)
public double getTransparency()
public void setTransparency(double alpha)
public boolean applyModelingMatrix()
applyModelingMatrix
in class PgGeometry
true
if operation was applied successfully.public boolean applyAmbientMatrix()
applyAmbientMatrix
in class PgGeometry
true
if operation was applied successfully.public boolean projectFromAmbientSpace()
projectFromAmbientSpace
in class PgGeometry
true
if operation was applied successfully.public PdVector[] getBounds()
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.
getBounds
in class PgGeometry
getAmbientBounds()
public PdVector[] getAmbientBounds()
Returns null
if no vertices are allocated yet.
Note, the bounding box does not include transformations from the ambient or model matrix.
getAmbientBounds
in class PgGeometry
getBounds()
public PdVector getCenterOfBndBox()
The center has same dimension as all vertices.
getCenterOfGravity()
,
PgGeometry.getCenter()
public void setCenterOfBndBox(PdVector center)
center-oldCenter
.
Method calls translate
to shift vertices.public PdVector getCenterOfGravity()
The center has same dimension as all vertices.
PgGeometry.getCenter()
public void setDimOfVertices(int dim)
setDimOfVertices
in class PgGeometry
public final int getNumVertices()
public final int getMaxNumVertices()
public PdVector[] getVertices()
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.
public PdVector getVertex(int ind)
getVertex
in interface PgGeometryIf
getVertex
in class PgGeometry
ind
- index of vertexpublic java.awt.Color getVertexColor(int ind)
ind
- index of vertexpublic PdVector getVertexNormal(int ind)
ind
- index of vertexpublic double getVertexSize(int ind)
ind
- index of vertexpublic PdVector getVertexTexture(int ind)
ind
- index of vertexpublic java.awt.Color getGlobalVertexColor()
public java.awt.Color getGlobalVertexTagColor()
public double getGlobalVertexSize()
public java.awt.Color getGlobalVertexNormalColor()
public double getGlobalVertexNormalLength()
public double getGlobalVertexNormalSize()
public double getGlobalVectorLength()
public double getGlobalVectorSize()
public java.awt.Color getGlobalVectorColor()
public void setGlobalVertexColor(java.awt.Color color)
public void setGlobalVertexTagColor(java.awt.Color color)
public void setGlobalVertexSize(double size)
public void setGlobalVertexSize(int size)
public void setGlobalVertexNormalColor(java.awt.Color color)
public void setGlobalVertexNormalLength(double length)
public void setGlobalVertexNormalSize(double size)
public void setGlobalVectorLength(double length)
public void setGlobalVectorSize(double size)
public void setGlobalVectorColor(java.awt.Color color)
public java.awt.Color[] getVertexColors()
public PdVector[] getVertexNormals()
public PdVector getVertexSizes()
public PdVector[] getVertexTextures()
public boolean isEnabledIndexLabels()
isShowingIndices()
public boolean isDefaultLabelEnabled()
isShowingIndices()
public boolean isShowingIndices()
public boolean isShowingVertexLabels()
public boolean isShowingVertices()
public boolean isShowingTaggedVertices()
public boolean isShowingVertexColors()
public boolean isShowingVertexNormals()
public boolean isShowingVertexNormalArrow()
public boolean isShowingVertexSizes()
public boolean isShowingVertexTexture()
public boolean isShowingVectorField()
public boolean isShowingVectorFields()
public boolean isShowingSingleVectorField()
public boolean isShowingVectorArrow()
public boolean isShowingVectorArrows()
public boolean isShowingVectorColors()
public boolean isShowingVertexOutline()
public void showVertexOutline(boolean flag)
public void setEnabledIndexLabels(boolean flag)
showIndices(boolean)
public void setDefaultLabelEnabled(boolean flag)
showIndices(boolean)
public void showIndices(boolean flag)
public void showVertexLabels(boolean flag)
public void showVertices(boolean flag)
public void showTaggedVertices(boolean flag)
public void showVertexColors(boolean flag)
public void showVertexNormals(boolean flag)
public void showVertexNormalArrow(boolean flag)
public void showVertexSizes(boolean flag)
public void showVertexTexture(boolean flag)
public void showVectorField(boolean flag)
public void showVectorFields(boolean flag)
public void showSingleVectorField(boolean flag)
public void showVectorArrow(boolean flag)
public void showVectorArrows(boolean flag)
public void showVectorColors(boolean flag)
public boolean makeVertexNormals()
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.
public void setMaxNumVertices(int numVertices)
public void setNumVertices(int numVertices)
public int getDimOfColors()
public void setDimOfColors(int aSize)
aSize<>0
.aSize
- Number of components of each color vector.public int getDimOfVectors()
public void setDimOfVectors(int aSize)
aSize<>0
.
It is more efficient to call method before setNumVertices()
.aSize
- Number of coordinates of each vector.public int getDimOfTextures()
public void setDimOfTextures(int dim)
public boolean hasVertexColors()
assureVertexColors()
public boolean hasVertexNormals()
assureVertexNormals()
public boolean hasVertexSizes()
assureVertexSizes()
public boolean hasVertexTextures()
assureVertexTextures()
public void assureVertexColors()
public void assureVertexNormals()
public void assureVertexSizes()
public void assureVertexTextures()
getDimOfTextures()
.public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgGeometry
PgGeometryIf
public void clearTagVertex(int ind, int aTag)
PvGeometryIf
.clearTagVertex
in interface PgGeometryIf
clearTagVertex
in class PgGeometry
setTagVertex(int, int)
,
hasTagVertex(int, int)
public boolean hasTagVertex(int ind, int aTag)
PvGeometryIf
.hasTagVertex
in interface PgGeometryIf
hasTagVertex
in class PgGeometry
setTagVertex(int, int)
,
clearTagVertex(int, int)
public void setTagVertex(int ind, int aTag)
PvGeometryIf
.setTagVertex
in interface PgGeometryIf
setTagVertex
in class PgGeometry
clearTagVertex(int, int)
,
hasTagVertex(int, int)
public int hasVertex(PdVector aVertex, double eps)
PdVector.equals(PdVector, double)
.aVertex
- vertex to be found in vertex listpublic int hasVertex(PdVector aVertex)
PdVector.equals(PdVector)
.aVertex
- vertex to be found in vertex listpublic int addVertex(PdVector aVertex)
setVertex(int, PdVector)
.addVertex
in interface PgGeometryIf
addVertex
in class PgGeometry
aVertex
- vertex to be added to vertex listpublic int[] removeVertex(int ind)
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.
removeVertex
in interface PgGeometryIf
removeVertex
in class PgGeometry
ind
- index of vertex to be removedpublic void setVertices(PdVector[] vertex)
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.vertex
- array with new verticespublic int[] getMarkedVertices()
public int[] removeMarkedVertices()
public void removeVertexColors()
Showing of vertex colors must be switched off explicitly using
showVertexColors(boolean)
.
public void setVertexColors(java.awt.Color[] colorList)
Showing of vertex colors must be switched on in order to be visible.
colorList
- array with new vertex colorspublic void removeVertexNormals()
Showing of vertex normals must be switched off explicitly using
showVertexNormals(boolean)
.
public void setVertexNormals(PdVector[] normalList)
Showing of vertex normals must be switched on in order to be visible.
normalList
- array with new vertex normalspublic void removeVertexSizes()
Showing of vertex sizes must be switched off explicitly using
showVertexSizes(boolean)
.
public void setVertexSizes(PdVector aVertexSize)
Showing of vertex sizes must be switched on in order to be visible.
aVertexSize
- array with new vertex size for all verticespublic void setVertexTextures(PdVector[] texCoords)
Showing of textures must be switched on in order to be visible.
texCoords
- array with new vertex texturespublic boolean setVertex(int ind, PdVector aVertex)
setVertex
in interface PgGeometryIf
setVertex
in class PgGeometry
ind
- index of vertex positionaVertex
- vertex to be copied to vertex listpublic void setVertex(int ind, double x)
ind
- index of vertexx
- x coordinate of vertexpublic void setVertex(int ind, double x, double y)
ind
- index of vertexx
- x coordinate of vertexy
- y coordinate of vertexpublic void setVertex(int ind, double x, double y, double z)
ind
- index of vertexx
- x coordinate of vertexy
- y coordinate of vertexz
- z coordinate of vertexpublic void setVertexColor(int ind, java.awt.Color col)
ind
- index of vertex positioncol
- color to be copied to color listpublic void setVertexNormal(int ind, PdVector nor)
ind
- index of vertex positionnor
- normal to be copied to normal listpublic void setVertexSize(int ind, double aSize)
ind
- index of vertex positionaSize
- size to be copied to size listpublic void setVertexTexture(int ind, PdVector tex)
ind
- index of vertex positiontex
- texture to be copied to texture listpublic int addVectorField(PgVectorField vf)
public int getNumVectorFields()
public int getIndexOfVectorField(PgVectorField vf)
public PgVectorField getVectorField(java.lang.String name)
public PgVectorField getVectorField(int ind)
public boolean removeVectorField(PgGeometryIf vf)
public void removeAllVectorFields()
public int removeHiddenVectorFields()
public PgVectorField getSelectedVectorField()
public int selectVectorField(PgVectorField vf)
isShowingSingleVectorField()
public void computeRotation(PgPolygon meridian, int numULines)
meridian
- meridian curve given a polygonnumULines
- discretization in angular directionpublic void computeCone(int numULines, int numVLines, double bottomRadius, double height)
numULines
- discretization in angular directionnumVLines
- discretization in z-axis directionbottomRadius
- radius of bottom disk of coneheight
- height of cone from bottom disk to tippublic void computeCylinder(int numULines, int numVLines, double radius, double length)
numULines
- discretization in angular directionnumVLines
- discretization in z-axis directionradius
- radius of cylinderlength
- height of cylinderpublic void computeDisk(int numULines, int numVLines, double radius)
numULines
- discretization in radial directionnumVLines
- discretization in angular directionradius
- radius of diskpublic void computePlane(int numULines, int numVLines, double uMin, double vMin, double uMax, double vMax)
numULines
- discretization in x directionnumVLines
- discretization in y directionuMin
- u coordinate of lower left corner of rectanglevMin
- v coordinate of lower left corner of rectangleuMax
- u coordinate of upper right corner of rectanglevMax
- v coordinate of upper right corner of rectanglepublic void computeSphere(int numULines, int numVLines, double radius)
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionradius
- radius of spherepublic void computeTorus(int numULines, int numVLines, double radius, double thick)
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionradius
- radius of soalthick
- radius of torus tubepublic void computeSnail(int numULines, int numVLines, double numWindings)
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionnumWindings
- number of half-turns of snail housepublic boolean merge(PgGeometryIf aGeom)
this
.
Number of vertices is the sum of both geometries.
The merged geometry will local colors allocated and assigned 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.
merge
in interface PgGeometryIf
merge
in class PgGeometry
aGeom
- Second geometry, will not be modified.true
on success, false
is argument null.public boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)
this = s*ag + t*bg
.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 void flipOrientation()
public void projectToSphere(PdVector center, double radius)
public void translate(PdVector diff)
public void scale(double factor)
PgGeometry.getCenter()
public void scale(double factor, PdVector center)
public boolean makeColorFromVectorLength()
public boolean makeVertexColorsFromXYZ()
In 2D colors at corners of square are blue, red, yellow and green. In 1D colors at corners of line are red and green.
public boolean makeVertexColorsFromZ()
public boolean makeVertexColorsFromZHue()
public void makeQuadrVertexTexture(int uDiscr, int vDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.public boolean makeVertexTextureFromBndBox(int ix, int iy)
ix
- index of x-direction of planeiy
- index of y-direction of planepublic boolean makeVertexTextureFromUV(int numULines, int numVLines, int flip)
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.false
if numVertices!=numULines*numVLinespublic boolean makeVertexTextureFromCylinder(PdVector center, PdVector axis)
center
- an arbitrary point on the axis of the cylinderaxis
- unit length direction of the axis of the cylinderpublic boolean makeVertexTextureFromSphere(PdVector center)
center
- Center of spherepublic 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 PvPickEvent intersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)
intersectionWithLine
in interface PgGeometryIf
intersectionWithLine
in class PgGeometry
rayBaseWorld
- 3D base point of ray eventually hitting the surface.rayDirWorld
- 3D direction vector of ray eventually hitting the surface.public int getEulerCharacteristic()
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.
public int[] getFVector()
"