Rhino C++ API  8.6
Public Member Functions | Public Attributes | List of all members
ON_RayShooter Class Reference

#include <opennurbs_plus.h>

Public Member Functions

 ON_RayShooter ()
 
 ON_RayShooter (const ON_RayShooter &src)
 
void ConstructHelper ()
 
ON_RayShooteroperator= (const ON_RayShooter &src)
 
bool SetRayHelper (ON_3dPoint P, ON_3dPoint Q)
 
bool Shoot (const ON_3dPoint &P, const ON_3dVector &D, const ON_SimpleArray< const ON_Surface * > &surface_list, ON_X_EVENT &hit)
 
bool Shoot (const ON_3dPoint &P, const ON_3dVector &D, const ON_SimpleArray< const ON_SurfaceTreeNode * > &snode_list, ON_X_EVENT &hit)
 
bool Shoot (const ON_3dPoint &P, const ON_3dVector &D, const ON_Surface *surface, ON_X_EVENT &hit)
 
bool Shoot (const ON_3dPoint &P, const ON_3dVector &D, const ON_SurfaceTreeNode *snode, ON_X_EVENT &hit)
 
bool Shoot (ON_3dPoint P, ON_3dVector D, int snode_count, const ON_SurfaceTreeNode *const *snode_list, ON_X_EVENT &hit)
 
bool ShootRayHelper (const ON_SurfaceTreeNode *stree, double mins, double maxs, ON_X_EVENT &hit)
 

Public Attributes

ON_CurveTree m_curve_tree
 Workspace for holding ray information. More...
 
double m_min_travel_distance
 
ON_CurveTreeBezier m_tree_bez
 

Constructor & Destructor Documentation

◆ ON_RayShooter() [1/2]

ON_RayShooter::ON_RayShooter ( )

◆ ON_RayShooter() [2/2]

ON_RayShooter::ON_RayShooter ( const ON_RayShooter src)

Member Function Documentation

◆ ConstructHelper()

void ON_RayShooter::ConstructHelper ( )

For expert users ...

◆ operator=()

ON_RayShooter& ON_RayShooter::operator= ( const ON_RayShooter src)

◆ SetRayHelper()

bool ON_RayShooter::SetRayHelper ( ON_3dPoint  P,
ON_3dPoint  Q 
)

◆ Shoot() [1/5]

bool ON_RayShooter::Shoot ( const ON_3dPoint P,
const ON_3dVector D,
const ON_SimpleArray< const ON_Surface * > &  surface_list,
ON_X_EVENT hit 
)

◆ Shoot() [2/5]

bool ON_RayShooter::Shoot ( const ON_3dPoint P,
const ON_3dVector D,
const ON_SimpleArray< const ON_SurfaceTreeNode * > &  snode_list,
ON_X_EVENT hit 
)

◆ Shoot() [3/5]

bool ON_RayShooter::Shoot ( const ON_3dPoint P,
const ON_3dVector D,
const ON_Surface surface,
ON_X_EVENT hit 
)

Description: Shoot a ray at a surface or collection of surfaces. Parameters: P - [in] start point D - [in] direction of infinite ray surface - [in] suface_list - [in] snode -[in] snode_list - [in] hit - [in/out] If hit.m_type = ON_X_EVENT::csx_point and 0.0 < hit.m_a[0], then a new hit will be returned only if it closer to the start of the ray. Example: Shoot a ray at a collection of "mirrors" and let it reflect.

  ON_3dPoint P = ...; ///< ray starting point
  ON_3dVector D = ...; ///< ray direction
  int max_reflection_count = 100; ///< number of reflections
  ON_SimpleArray<const ON_Surface*> surface_list = ...;

/ polyline = path of reflected ray ON_Polyline polyline(m_max_bounce_count+1); polyline.Append(P);

/ shoot ... ON_RayShooter ray; ON_X_EVENT hit; ON_3dPoint Q; ON_3dVector V[3], N, T, R; double d; R = D; for ( i = 0; i < max_reflection_count; i++ ) { memset(&hit,0,sizeof(hit)); T = R; if ( !T.Unitize() ) break; if ( !ray.Shoot(Q,T,surface_list,hit) ) break; Q = hit.m_A[0]; polyline.Append(Q); if ( !hit.m_snodeB[0] ) break; hit.m_snodeB[0]->Evaluate(hit.m_b[0],hit.m_b[1],1,3,&V[0].x); N = ON_CrossProduct(V[1],V[2]); if ( !N.Unitize() ) break; d = N*T; R = T + (-2.0*d)*N; ///< R = reflection direction }

Returns: True if the ray hits a surface.

◆ Shoot() [4/5]

bool ON_RayShooter::Shoot ( const ON_3dPoint P,
const ON_3dVector D,
const ON_SurfaceTreeNode snode,
ON_X_EVENT hit 
)

◆ Shoot() [5/5]

bool ON_RayShooter::Shoot ( ON_3dPoint  P,
ON_3dVector  D,
int  snode_count,
const ON_SurfaceTreeNode *const *  snode_list,
ON_X_EVENT hit 
)

◆ ShootRayHelper()

bool ON_RayShooter::ShootRayHelper ( const ON_SurfaceTreeNode stree,
double  mins,
double  maxs,
ON_X_EVENT hit 
)

Parameters: mins - [in] minimum normalized line parameter maxs - [in] maximum normalized line parameter

Member Data Documentation

◆ m_curve_tree

ON_CurveTree ON_RayShooter::m_curve_tree

Workspace for holding ray information.

◆ m_min_travel_distance

double ON_RayShooter::m_min_travel_distance

Minimum 3d distance the ray must travel from "P" before an intersection is considered a "hit".
The default is zero.

◆ m_tree_bez

ON_CurveTreeBezier ON_RayShooter::m_tree_bez