ILNumerics Ultimate VS

IPickingResultVerticesScreen Property

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
3-dim array with detailed vertex information of the primitives picked as screen coordinates

[ILNumerics Visualization Engine]

Namespace:  ILNumerics.Drawing
Assembly:  ILNumerics.Drawing (in ILNumerics.Drawing.dll) Version: ILNumerics Ultimate VS 4
Syntax

RetArray<float> VerticesScreen { get; }

Property Value

Type: RetArraySingle
Remarks

The data for each primitive are stored as matrix slices along the 0-1 dimension. One such slice is stored for each primitive along the third dimension. The length of VerticesScreen in the third dimension VerticesScreen.S[2] therefore gives the number of primtives picked.

If the specified 'target' shape in the call to PickPrimitiveAt(Drawable, Point, Int64, Boolean) if of a triangle type (Triangles,TrianglesFan, or TrianglesStrip) then the storage is layed out as follows:

VerticesScreen is of size 3 x 4 x n, where n is the number of primitives picked.

VerticesScreen [:;:;0]
x1  y1  z1  s
x2  y2  z2  t
x3  y3  z3  ZI

Here, x1..x3 are the screen X coordinates of the closest triangle under the point provided to PickPrimitiveAt(Drawable, Point, Int64, Boolean). Y1...Y3 and Z1...Z3 are the Y and Z screen coordinates correspondingly.

s and t are the barycentric coordinates of the point provided in terms of the barycentric coordinate system for the triangle. Using s and t makes it easy to interpolate over the area of the triangle. In order to, let's say interpolate the Z value for the point given, one can use the following formula:

Z_i = z1 * s + z2 * t + z3 * (1-s-t)

Note that ZI in the result represents exactly that interpolated Z value at the point given.

For target shapes of type Lines the storage layout of VerticesScreen is as follows:

VerticesScreen [:;:;0]
x1  y1  z1  t
x2  y2  z2  ZI
Here, t is the fractional position of the projection of point onto the line connecting the vertices stored in x1,x2,y1,y2,z1,z2. In order to compute the X coordinate of the vertex position of the mouse cursor in terms of the picked line primitive, on can use the following formula:
x1 * t + x2 * (1 - t)
or
x1 + (x2 - x1) * t.

Examples

The ordered screen Z coordinates of the crossing points for lines and triangles below the picking point are retrieved by:
VerticesScreen["end;end;:"][":"]
For Points targets the storage scheme is as follows:
VerticesScreen [:;:;0]
x1  y1  z1  D
Here, D denotes the current distance from the point picked and the mouse location. D is at most Points.Width.

Note that the values in VerticesWorld relate to the true extend of the primitive as stored in the shape vertex buffer. This may or may not directly correspond to the primitive rendered on screen. A common situation where there is no direct correspondence is when clipping occours. If the primitive was clipped at the rendering edge (frustum) or at some custom clipping plane, the values given in VerticesWorld correpond to the original primitive, the values in VerticesScreen correspond to the clipped triangle.

[ILNumerics Visualization Engine]

See Also

Reference