- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
difference between api_ray_fi re and api_raytes t_ents ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-11-2011 07:09 AM
What is the difference between api_ray_fire and api_raytest_ents ?
I have one instance of some surfaces that cannot be "picked" by api_raytest_ents and can be "picked" by api_ray_fire.
and another instance, a simple single cone that can be partially "picked" with api_ray_fire: for the same projection direction, the surface is picked at some position, but at other the surfaces is not.
The projection points (transformed from screen XY to world XYZ) and direction (towards the model) all look perfect; no wild values or even un-initialized values; (when drawing the points and vectors (as lines), they all intersect the surface).
Do I have to do some sort of transformation on the input projection point and direction ?
The code is as follow :
SPAposition pointAcis( parameters.m_PointToProject.xx, parameters.m_PointToProject.yy, parameters.m_PointToProject.zz );
DCoord projectedPoint;
// getting the number of iteration based on how many direction we have to go
unsigned int totalNumber = surfaces.GetCount();
bool areSurfacesSelected = ( totalNumber > 0 );
if ( !areSurfacesSelected )
{
return;
}
bool isVectorNotNull = ( VecSize3( parameters.m_ProjectionVector ) > get_resabs() );
if ( !isVectorNotNull )
{
return;
}
// project point on surface following given vector (direction)
SPAunit_vector projectionDirection( parameters.m_ProjectionVector.xx, parameters.m_ProjectionVector.yy, parameters.m_ProjectionVector.zz );
projectionDirection = normalise( projectionDirection );
// Create the ENTITY_LIST with all selected surface
ENTITY** targetEntities = ACIS_NEW ENTITY*[totalNumber];
for( unsigned int count = 0; count < totalNumber; count++ )
targetEntities[count] = surfaces[count]->GetACISFace();
double radius = SPAresabs;
hit* hit_list = NULL;
int hits = 1;
outcome out = api_raytest_ents( pointAcis, projectionDirection, radius, hits, totalNumber, targetEntities, hit_list );
and with api_ray_fire:
SPAposition pointAcis( parameters.m_PointToProject.xx, parameters.m_PointToProject.yy, parameters.m_PointToProject.zz );
DCoord projectedPoint;
// getting the number of iteration based on how many direction we have to go
unsigned int totalNumber = surfaces.GetCount();
bool areSurfacesSelected = ( totalNumber > 0 );
if ( !areSurfacesSelected )
{
return;
}
bool isVectorNotNull = ( VecSize3( parameters.m_ProjectionVector ) > get_resabs() );
if ( !isVectorNotNull )
{
return;
}
// project point on surface following given vector (direction)
SPAunit_vector projectionDirection( parameters.m_ProjectionVector.xx, parameters.m_ProjectionVector.yy, parameters.m_ProjectionVector.zz );
projectionDirection = normalise( projectionDirection );
ENTITY_LIST* faceList = ACIS_NEW ENTITY_LIST;
for( unsigned int count = 0; count < totalNumber; count++ )
{
faceList->add((ENTITY*) surfaces[count]->GetACISFace());
}
rayfire_options options;
options.set_entity_type(FACE_TYPE);
options.set_single_hit_per_entity(true);
ray pickRay(
SPAposition(parameters.m_PointToProject.xx, parameters.m_PointToProject.yy, parameters.m_PointToProject.zz),projectionDirectio n );
entity_hit_list hitList;
outcome out(0);
API_NOP_BEGIN
out = api_ray_fire(*faceList, pickRay, hitList,&options, acisJournalOptions );
API_NOP_END
Thanks.
Maximilien.
Re: difference between api_ray_fi re and api_raytes t_ents ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2011 07:43 AM
Hi Maximilien,
api_ray_fire, introduced in R20, is more geometrically accurate and correct; it uses an improved algorithm which was implemented to solve problems just like the one you found. api_raytest_ents is kept to preserve the old behavior for exisitng applications.
We recommend to use api_ray_fire.
Best,
Ray

