Rhino C++ API  8.13
Public Member Functions | Public Attributes | List of all members
CRhinoSnapContext Class Reference

#include <rhinoSdkSnap.h>

Public Member Functions

 CRhinoSnapContext ()
 
 ~CRhinoSnapContext ()
 
bool CreateActiveCurve (int dim, int israt, int order)
 
void GetSnapDepth (const ON_3dPoint &snap_point, double *snap_depth, double *snap_distance) const
 
bool IntSnap (bool bApparentIntersections)
 
bool NearSnapToBezier (const ON_BezierCurve &bez, double *t, bool bCheckVisibility=false) const
 
bool NearSnapToLine (const ON_Line &line, double *t, bool bCheckVisibility=false) const
 
bool PerpSnapToBezier (const ON_BezierCurve &bez, ON_3dPoint point, double seet_t, double *t) const
 
bool QuadSnapToBezier (const ON_BezierCurve &bez, const ON_Plane &plane, double seet_t, double *t) const
 
void SetCheckVisibility (bool b)
 
bool SetSnapXform (const CRhinoView *view, double screen_x, double screen_y, int near_snap_radius=RhinoOsnapPickboxRadius(), int point_snap_radius=RhinoOsnapPickboxRadius())
 
bool SnapToBBox (const ON_BoundingBox &bbox) const
 
bool SnapToPoint (const ON_3dPoint &point, bool bCheckVisibility=false) const
 
bool SnapToPointNoZ (const ON_3dPoint &point, bool bCheckVisibility=false) const
 
bool TanSnapToBezier (const ON_BezierCurve &bez, ON_3dPoint point, double seet_t, double *t) const
 
bool TestOverlapSnap (const ON_BezierCurve *pBez, ON_3dPoint &pt)
 Snap to the end of a bezier if its within the pickbox. More...
 
bool TransformSnapContext (const ON_Xform &object_to_world, const ON_Xform &world_to_object)
 
void UpdateClippingPlanes (const CRhinoViewport *pViewport, const ON_UuidList *filter)
 
void UpdateClippingPlanes (const CRhinoViewport *pViewport=0)
 

Public Attributes

CRhinoInferredCurve m_active_curve
 
ON_3dPoint m_basepoint
 
bool m_bCheckVisibility
 
bool m_bIntSnapCheck
 volatile More...
 
bool m_bSetClippingPlanes
 
bool m_bSnapToCurves
 passed flag from CRhinoGetPoint More...
 
bool m_bUseSmartTracking
 
ON_Plane m_cplane
 construction plane of the view. Used for quad osnap More...
 
const CRhinoObjectm_do_not_snap_to_me
 do not snap to this object More...
 
CRhinoInferredCurveArray m_inferred_curves
 
unsigned int m_input_snap_mode
 the actual unmodified osnap mode that was passed to CRhinoDoc::SnapTo More...
 
CRhinoIntSnapCandidate m_int_snap [2]
 
ON_ClassArray< CRhinoIntSnapCandidatem_int_snap_candidates
 
int m_int_snap_count
 volatile More...
 
ON_Xform m_near_snap_xform
 
unsigned int m_object_filter
 bits set from ON::object_type enum More...
 
ON::active_space m_object_space
 
ON_Xform m_object_to_world
 
ON_Xform m_point_snap_xform
 
ON_2dPoint m_screen_point
 in m_view window coordinates More...
 
ON_Line m_snap_line
 mouse pick line from near to far More...
 
unsigned int m_snap_mode
 check for snaps in the following order More...
 
ON_ClippingRegion m_snap_region
 m_snap_region.m_xform = n_near_snap_xform. More...
 
ON_UUID m_snap_viewport_id
 id of viewport being snapped in More...
 
const CRhinoViewm_view
 if not NULL, defines cplane for quad snaps More...
 
ON_Xform m_w2s
 world to screen transformation More...
 

Constructor & Destructor Documentation

◆ CRhinoSnapContext()

CRhinoSnapContext::CRhinoSnapContext ( )

◆ ~CRhinoSnapContext()

CRhinoSnapContext::~CRhinoSnapContext ( )

Member Function Documentation

◆ CreateActiveCurve()

bool CRhinoSnapContext::CreateActiveCurve ( int  dim,
int  israt,
int  order 
)

Destroy the current active curve if there is one and create a new one If there is an Active Curve and it matches the input dim, israt & order, reuse it

◆ GetSnapDepth()

void CRhinoSnapContext::GetSnapDepth ( const ON_3dPoint snap_point,
double *  snap_depth,
double *  snap_distance 
) const

Description: Utility for getting snap point depth and distance Parameters: bez - [in] snap_depth - [out] relative depth (world units) snap_distance - [out] relative distance (normalized units) Returns: TRUE if a near snap point is found.

◆ IntSnap()

bool CRhinoSnapContext::IntSnap ( bool  bApparentIntersections)

Description: Utility for snapping to intersection of bezier segments. Parameters: bApparentIntersections - [in] if true, the segments are projected to a common plane before being intersected. Returns: True if an intersection is found.

◆ NearSnapToBezier()

bool CRhinoSnapContext::NearSnapToBezier ( const ON_BezierCurve bez,
double *  t,
bool  bCheckVisibility = false 
) const

Description: Utility for snapping to near point on bezier segments. Parameters: bez - [in] t - [out] parameter of near snap point if found bCheckVisibility - If true only locations that are visible are snapped to. Returns: TRUE if a near snap point is found.

◆ NearSnapToLine()

bool CRhinoSnapContext::NearSnapToLine ( const ON_Line line,
double *  t,
bool  bCheckVisibility = false 
) const

◆ PerpSnapToBezier()

bool CRhinoSnapContext::PerpSnapToBezier ( const ON_BezierCurve bez,
ON_3dPoint  point,
double  seet_t,
double *  t 
) const

Description: Utility for snapping to perp point on bezier segments. Parameters: bez - [in] point - [in] base point for tan snap seed_t - [in] start searching here t - [out] parameter of near snap point if found Returns: TRUE if a near snap point is found.

◆ QuadSnapToBezier()

bool CRhinoSnapContext::QuadSnapToBezier ( const ON_BezierCurve bez,
const ON_Plane plane,
double  seet_t,
double *  t 
) const

Description: Utility for snapping to quadrant point on bezier segments. Parameters: bez - [in] plane - [in] defines coordinate system for quad snapping seed_t - [in] start searching here t - [out] parameter of near snap point if found Returns: TRUE if a near snap point is found.

◆ SetCheckVisibility()

void CRhinoSnapContext::SetCheckVisibility ( bool  b)
inline

Set to true to make osnapping only snap to locations that are visible and not covered by shaded objects. For example when snapping to blocks the low level bCheckVisibility parameter in SnapToPoint etc. cannot be set, because the block members have no knowledge of the block selection status. This check visibility setting makes it possible to override the parameter when necessary.

◆ SetSnapXform()

bool CRhinoSnapContext::SetSnapXform ( const CRhinoView view,
double  screen_x,
double  screen_y,
int  near_snap_radius = RhinoOsnapPickboxRadius(),
int  point_snap_radius = RhinoOsnapPickboxRadius() 
)

C++ default operator= and copy constructor work fine. Do not override. CRhinoSnapContext& operator=(const CRhinoSnapContext& src); CRhinoSnapContext(const CRhinoSnapContext& src); Description: Get transformation that maps snapping frustum to clipping box. This transformation is stored in m_snap_xform and must be set before any of the SnapTo...() functions can be called. Parameters: view - [in] view where snap is happening screen_x - [in] view window x coordinate (0 = left side) screen_y - [in] view window y coordinate (0 = top side) near_snap_radius - [in] radius of snapping box in pixels point_snap_radius - [in] radius of snapping box in pixels Returns: TRUE if m_snap_xform is successfully set.

◆ SnapToBBox()

bool CRhinoSnapContext::SnapToBBox ( const ON_BoundingBox bbox) const

Returns: TRUE if bbox intersects the snap region

◆ SnapToPoint()

bool CRhinoSnapContext::SnapToPoint ( const ON_3dPoint point,
bool  bCheckVisibility = false 
) const

Parameters: bCheckVisibility - If true only locations that are visible are snapped to. Returns: TRUE if point is in snap region

◆ SnapToPointNoZ()

bool CRhinoSnapContext::SnapToPointNoZ ( const ON_3dPoint point,
bool  bCheckVisibility = false 
) const

Description: Point snapper that ignores clpping coordinate Z. Makes snapping work on temporary geometry that is outside near and far clipping planes. Parameters: bCheckVisibility - If true only locations that are visible are snapped to. Returns: TRUE if point is in snap region

◆ TanSnapToBezier()

bool CRhinoSnapContext::TanSnapToBezier ( const ON_BezierCurve bez,
ON_3dPoint  point,
double  seet_t,
double *  t 
) const

Description: Utility for snapping to tan point on bezier segments. Parameters: bez - [in] point - [in] base point for tan snap seed_t - [in] start searching here t - [out] parameter of near snap point if found Returns: TRUE if a near snap point is found.

◆ TestOverlapSnap()

bool CRhinoSnapContext::TestOverlapSnap ( const ON_BezierCurve pBez,
ON_3dPoint pt 
)

Snap to the end of a bezier if its within the pickbox.

◆ TransformSnapContext()

bool CRhinoSnapContext::TransformSnapContext ( const ON_Xform object_to_world,
const ON_Xform world_to_object 
)

Description: When the an object's location is transformed before it is displayed, this function can be used to modify a the snap context's transforms and other picking information. Parameters: object_to_world - [in] transformation that maps object into world coordinates world_to_object - [in] inverse of object_to_world
Example: SnapTo( .., const CRhinoSnapContext& snap_context, ... ) { CRhinoSnapContext object_sc = snap_context; object_sc.Transform( object_to_world, world_to_object ); / now use object_sc for snapping calculation ... }

◆ UpdateClippingPlanes() [1/2]

void CRhinoSnapContext::UpdateClippingPlanes ( const CRhinoViewport pViewport,
const ON_UuidList filter 
)

Description: Updates the clipping plane information in m_snap_region. The m_bSetClippingPlanes and m_view fields must be before calling UpdateClippingPlanes(). Parameters: pViewport - [in] When set pViepwort is used to force update the clipping planes. Otherwise active viewport is used. filter - [in] optional list of UUIDs to pay attention to when updating clipping planes. Only planes with ids in the filter list will be used if filter is not null and contains entries

◆ UpdateClippingPlanes() [2/2]

void CRhinoSnapContext::UpdateClippingPlanes ( const CRhinoViewport pViewport = 0)

Description: Updates the clipping plane information in m_snap_region. The m_bSetClippingPlanes and m_view fields must be before calling UpdateClippingPlanes(). Parameters: pViewport - [in] When set pViepwort is used to force update the clipping planes. Otherwise active viewport is used.

Member Data Documentation

◆ m_active_curve

CRhinoInferredCurve CRhinoSnapContext::m_active_curve

9-24-03 Lowell changed the way active curve is handled so it can be separate from smart-cursor inferred curves

◆ m_basepoint

ON_3dPoint CRhinoSnapContext::m_basepoint

m_basepoint is typically the point provided at the GetPoint() "From" prompt and is used for tan and perp snapping.

◆ m_bCheckVisibility

bool CRhinoSnapContext::m_bCheckVisibility

◆ m_bIntSnapCheck

bool CRhinoSnapContext::m_bIntSnapCheck

volatile

used to build a list of segments to test for intesection snaps true if eligible events should be added to the intersection snap list.

◆ m_bSetClippingPlanes

bool CRhinoSnapContext::m_bSetClippingPlanes

If m_bSetClippingPlanes is true (the default), then CRhinoSnapContext will use lazy evaluation to automatically set m_snap_region.m_clip_planes[] when m_view is set. If m_bSetClippingPlanes is false, then you have to set m_snap_region.m_clip_planes[] if they are required.

◆ m_bSnapToCurves

bool CRhinoSnapContext::m_bSnapToCurves

passed flag from CRhinoGetPoint

◆ m_bUseSmartTracking

bool CRhinoSnapContext::m_bUseSmartTracking

◆ m_cplane

ON_Plane CRhinoSnapContext::m_cplane

construction plane of the view. Used for quad osnap

◆ m_do_not_snap_to_me

const CRhinoObject* CRhinoSnapContext::m_do_not_snap_to_me

do not snap to this object

◆ m_inferred_curves

CRhinoInferredCurveArray CRhinoSnapContext::m_inferred_curves

◆ m_input_snap_mode

unsigned int CRhinoSnapContext::m_input_snap_mode

the actual unmodified osnap mode that was passed to CRhinoDoc::SnapTo

CRhinoAppSettings::osnap_mode bits

◆ m_int_snap

CRhinoIntSnapCandidate CRhinoSnapContext::m_int_snap[2]

◆ m_int_snap_candidates

ON_ClassArray<CRhinoIntSnapCandidate> CRhinoSnapContext::m_int_snap_candidates

◆ m_int_snap_count

int CRhinoSnapContext::m_int_snap_count

volatile

◆ m_near_snap_xform

ON_Xform CRhinoSnapContext::m_near_snap_xform

◆ m_object_filter

unsigned int CRhinoSnapContext::m_object_filter

bits set from ON::object_type enum

◆ m_object_space

ON::active_space CRhinoSnapContext::m_object_space

To snap to objects in page views set m_object_space = ON::page_space. Default is to snap to objects in model views.

◆ m_object_to_world

ON_Xform CRhinoSnapContext::m_object_to_world

◆ m_point_snap_xform

ON_Xform CRhinoSnapContext::m_point_snap_xform

◆ m_screen_point

ON_2dPoint CRhinoSnapContext::m_screen_point

in m_view window coordinates

◆ m_snap_line

ON_Line CRhinoSnapContext::m_snap_line

mouse pick line from near to far

◆ m_snap_mode

unsigned int CRhinoSnapContext::m_snap_mode

check for snaps in the following order

CRhinoAppSettings::osnap_mode bits

◆ m_snap_region

ON_ClippingRegion CRhinoSnapContext::m_snap_region

m_snap_region.m_xform = n_near_snap_xform.

◆ m_snap_viewport_id

ON_UUID CRhinoSnapContext::m_snap_viewport_id

id of viewport being snapped in

◆ m_view

const CRhinoView* CRhinoSnapContext::m_view

if not NULL, defines cplane for quad snaps

◆ m_w2s

ON_Xform CRhinoSnapContext::m_w2s

world to screen transformation