public final class PvPickEvent
extends java.lang.Object
PvPickListenerIf
,
PjProject
,
PvDisplayIf
Constructor and Description |
---|
PvPickEvent(int dim)
Constructor with dimension of scene in display.
|
Modifier and Type | Method and Description |
---|---|
PdBary |
getBary()
Get barycentric coordinates inside the picked element.
|
int |
getDimOfVertex()
Get dimension of scene position of cursor in world coordinate of scene in display.
|
double |
getDistance()
Get distance of picked vertex to nearest position on geometry.
|
int |
getElementInd()
Get index of element in element array of picked geometry.
|
int |
getElementSubInd()
Get the index of a subtringle if element has more than three edges.
|
int |
getElemInd()
Deprecated.
use #getElementInd() which provides the same functionality.
|
PgGeometryIf |
getGeometry()
Get the picked geometry, may be
null . |
double |
getHorDistance()
Get distance of picked vertex to nearest position on geometry.
|
java.awt.Point |
getLocation()
Get position of cursor in pixel coordinates of drawing canvas of event.
|
PiVector |
getMarkBox()
Get bounds of user dragged rectangle with four components in pixel coordinates.
|
PdVector[] |
getMarkBoxWorld()
Get bounds of user dragged rectangle with four components converted to world-coordinates.
|
PdVector |
getNormal()
Get normal vector at picked surface points.
|
PvDisplayIf |
getSource()
Get source display where this event occurred.
|
PdVector |
getVertex()
Get the point on the geometry nearest to the picked vertex, i.e. the intersection
of the pick ray (viewBase,viewDir) with the geometry.
|
int |
getVertexInd()
Get index of vertex in vertex array of picked geometry if pick was close to a vertex.
|
PdVector |
getVertexNearest()
Deprecated.
use getVertex()
|
PdVector |
getViewBase()
Get position of cursor in world coordinate of scene in display.
|
PdVector |
getViewDir()
Get normalized viewing direction as the vector pointing from the camera
to its interest.
|
void |
set(PdVector pos,
int elemInd,
int elemSubInd,
PdBary bary)
Convenient method to assign the four parameters of an event simultaneously.
|
void |
setBary(PdBary bary)
Set barycentric coordinates inside the picked element.
|
void |
setDistance(double dist)
Set distance of picked vertex to nearest position on geometry.
|
void |
setElementInd(int elem)
Set index of element in element array of picked geometry.
|
void |
setElementSubInd(int elemSub)
Set the index of a subtringle if element has more than three edges.
|
void |
setGeometry(PgGeometryIf geom)
Set the picked geometry from display, may be
null . |
void |
setHorDistance(double horDist)
Set distance of picked vertex to nearest position on geometry.
|
void |
setLocation(java.awt.Point pos)
Set position of cursor in pixel coordinates of drawing canvas of event.
|
void |
setMarkBox(PiVector box)
Set bounds of user dragged rectangle with four components in pixel coordinates.
|
void |
setMarkBoxWorld(PdVector[] box)
Set bounds of user dragged rectangle with four components in world-coordinates.
|
void |
setNormal(PdVector normal)
Get normal vector at picked surface points.
|
void |
setSource(PvDisplayIf disp)
Set source display where this event occurred.
|
void |
setVertex(PdVector vertex)
Set the point on the geometry nearest to the picked vertex, i.e. the intersection
of the pick ray (viewBase,viewDir) with the geometry.
|
void |
setVertexInd(int ind)
Set index of vertex in vertex array of picked geometry if pick was close to a vertex.
|
void |
setVertexNearest(PdVector vertex)
Deprecated.
use setVertex(PdVector)
|
void |
setViewBase(PdVector base)
Set position of cursor in world coordinate of scene in display.
|
void |
setViewDir(PdVector pos)
Set viewing direction as the vector pointing from the camera
to its interest.
|
public PvPickEvent(int dim)
dim
- Dimension of scene in displaypublic PvDisplayIf getSource()
public void setSource(PvDisplayIf disp)
disp
- display where this event occurredpublic int getDimOfVertex()
public PgGeometryIf getGeometry()
null
.
A geometry must be the active geometry to receive a pick event.
Return value may be null
.public void setGeometry(PgGeometryIf geom)
null
.
A geometry must be the active geometry to receive a pick event.geom
- picked geometrypublic PiVector getMarkBox()
null
.public void setMarkBox(PiVector box)
box
- lower left and upper right corner of dragged rectangle in pixel coordinatespublic PdVector[] getMarkBoxWorld()
null
.public void setMarkBoxWorld(PdVector[] box)
box
- lower left and upper right corner of dragged rectangle in world-coordinatespublic java.awt.Point getLocation()
public void setLocation(java.awt.Point pos)
pos
- Location of mouse cursor in 2d pixel coordinatespublic PdVector getVertex()
getViewBase()
,
getViewDir()
public void setVertex(PdVector vertex)
vertex
- World coordinates of the nearest point on the geometry.setViewBase(PdVector)
,
setViewDir(PdVector)
public PdVector getVertexNearest()
null
.public void setVertexNearest(PdVector vertex)
vertex
- World coordinates of the nearest point on the geometry.public int getVertexInd()
public void setVertexInd(int ind)
ind
- index of a vertexpublic double getDistance()
public void setDistance(double dist)
dist
- distance of picked vertex to nearest position on geometry.public double getHorDistance()
public void setHorDistance(double horDist)
horDist
- horizontal distance of picked vertex to nearest position on geometry.public PdVector getNormal()
null
.public void setNormal(PdVector normal)
normal
- World coordinates of normal vector in scene.public PdBary getBary()
null
.getElementSubInd()
public void setBary(PdBary bary)
getElementSubInd()
public int getElementInd()
public int getElemInd()
public void setElementInd(int elem)
elem
- index of elementpublic int getElementSubInd()
public void setElementSubInd(int elemSub)
elemSub
- index of subtrianglepublic PdVector getViewBase()
null
.getVertex()
,
getViewDir()
public void setViewBase(PdVector base)
base
- World coordinates of mouse position in scene.setViewDir(PdVector)
public PdVector getViewDir()
public void setViewDir(PdVector pos)
pos
- viewing direction in world coordinatespublic void set(PdVector pos, int elemInd, int elemSubInd, PdBary bary)
pos
- coordinates of picked vertexelemInd
- index of picked elementelemSubInd
- index of sub elementbary
- barycentric coordinates inside an element"