Picking Topology   

<<< Display Tolerances Chapters Rendering Functions >>>

Contents

[back to top]


51.1 Introduction

PK_BODY_pick_topols picks faces, edges or vertices (or combinations of these entities) from an array of instanced bodies using a straight line ray. The ray is defined in the same (world) coordinate system as the body instances.

[back to top]

51.1.1 Approximate versus accurate picking

By default, PK_BODY_pick_topols uses approximate representations of curves in a body, rather than accurate geometry. You can choose the degree of approximation by specifying tolerance values in PK_BODY_pick_topols_o_t.

 

Warning: When using approximate picking, intersection point and distance values returned by PK_BODY_pick_topols are approximate, and must not be used as arguments to modeling functions.

If necessary, you can force PK_BODY_pick_topols to use accurate geometry rather than an approximation by setting the pick_approx option in PK_BODY_pick_topols_o_t to PK_pick_approximate_no_c.

 

    Performance issue: Using accurate geometry with PK_BODY_pick_topols slows down performance, and is not recommended for any interactive picking operations.

[back to top]

51.1.2 Rendering and picking

PK_BODY_pick_topols is intended to be used in conjunction with PK_TOPOL_render_line, where entities which have been rendered previously can be checked for intersection or proximity to a ray which passes through the current view point and in the current viewing direction (transformed from 2-D screen coordinates into 3-D world coordinates).

This function can then be used to simulate face, edge and vertex picking from the viewing screen.

 

Note: To enhance performance and reliability, PK_BODY_pick_topols should be called with the same tolerance values as used in preceding calls to PK_TOPOL_render_line: see Section 51.1.1, "Approximate versus accurate picking". The intersection point and distance values returned are also approximate values, to within these tolerances.

See Chapter 50, "Display Tolerances", for further information on the curve approximation tolerances used by PK_TOPOL_render_line.

[back to top]


51.2 Axial ordering

The default options selected by PK_BODY_pick_topols_o_m are:

These values instruct the function to find the closest face. If max_faces > 1 and more than one face is intersected by the ray, it orders the returned array of faces using the relative position of the intersections between the faces and the ray, measured in the same direction as the ray.

This is called an axial ordering method. Picked faces are always returned ordered in this way. If more than max_faces intersect the ray, those lying furthest along the ray are discarded.

If max_edges > 0 and/or max_vertices > 0, the function picks edges and/or vertices which lie within a specified distance from the ray. By default, the function orders picked edges and vertices along the axis using their hit point position. This is a point on the axis where the distance from the edge or vertex to the ray is at a minimum.

[back to top]

51.2.1 Picking from hidden line drawings

The axial ordering method allows faces, edges and vertices to be picked at the same time using the same ordering method. This is appropriate when simulating picking edges and vertices from a hidden line drawing, when only those entities which are closest to the eye-point can be considered as candidates for picking.

If faces are being picked as if from a hidden line drawing, there is an option which ignores back facing faces which can be used. In all other cases, the back facing face option must be set to be false explicitly.

[back to top]


51.3 Radial ordering

Picked edges and vertices can be ordered by radial distance instead, by measuring the distance between an edge or vertex and the ray.

The radial ordering method is appropriate when simulating picking edges and vertices from a wire frame drawing on the viewing screen, where the closest entities are those which appear closest to the screen cursor.

The set of candidate faces for picking may be limited to those whose surfaces are of a given class through the option geom_classes .

Applications can use this picking function to find:

 

When finding Use this test

the closest single entity

max_faces, max_edges or max_vertices set to 1

an array of nearby entities

max_faces, max_edges or max_vertices set to an arbitrary upper limit such as 20

[back to top]

51.3.1 Using the excess count field

When returning an array of entities, Parasolid can warn the application if the potential number of picked entities exceeded the specified maximum value. This is done by returning an excess count of faces, edges or vertices, indicating that Parasolid is finding many more candidate entities than usual.

 

Note: Application writers can use the excess counts to monitor whether the max_edge_dist or max_vertex_dist values are too large. These values can then be reduced dynamically when the excess count indicates that picking is being made from a locally dense regions of the model, or reduce the sampling rate if the picking function is being called dynamically.

[back to top]

<<< Display Tolerances Chapters Rendering Functions >>>