All Frameworks  Class Hierarchy  This Framework  Indexes

SPAintr Global Function api_raytest_body


outcome api_raytest_body(SPAposition const& ray_point,
SPAunit_vector const& ray_direction,
double ray_radius,
int hits_wanted,
BODY* target_body,
hit*& hit_list,
AcisOptions* ao= NULL)
Gets the list of hits when a ray is fired at a body.

Role: This API fires a ray at a body from the given ray point in the given ray direction with given ray radius. It returns a list that contains the n hits nearest the ray point (where n is the number of hits recorded). Only entities in the forward direction along the ray can be hit. Hits_wanted indicates the maximum number of hits to return. To return all hits, specify hits_wanted as zero. The list of hits is created on the heap and it is the responsibility of the caller to delete the hits in this list.

When several connected entities are wanted, e.g., all edges of a face, pick one entity, for example, the face, and the others are found by following the model pointers.

If the ray hits the interior of a face at a point at least the length of the ray radius from any edge or vertex of the face, it returns the face. If the ray hits an edge of a face or passes within ray radius of the edge, it returns the edge. If the ray passes within ray radius of a vertex, it returns the vertex.

To pick edges or vertices, it is often helpful to increase the ray radius. To pick a face, keep the ray radius small to avoid picking edges or vertices of the face. If the ray lies in the surface (planar or ruled) of a face and crosses the interiors of the face, the edges or vertices of the face are returned.

A call to this API will cause boxes to be computed, causing a model change and creating a bulletin board. To make the process Read-only, call api_note_state before the call to api_raytest_body, api_note_state, api_change_state, and api_delete_ds after the call to api_raytest_body.

Errors: Pointer to body is NULL or not to a BODY.
 Zero length ray_direction specified.
 Ray radius less than SPAresabs.

Effect: Changes model

Journal: Not Available

Parameters:
ray_point
starting point of the ray.
ray_direction
direction of the ray.
ray_radius
radius of the ray.
hits_wanted
number of hits requested.
target_body
target body.
hit_list
list of entities hits along the ray returned.
ao
ACIS options.

This object is included in the file: intrapi.hxx

Copyright (c) 1989-2007 by Spatial Corp. All rights reserved.