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

#include <opennurbs_plus_x.h>

Public Types

enum  DIRECTION {
  no_x_dir = 0, at_end_dir = 1, from_above_dir = 2, from_below_dir = 3,
  from_on_dir = 4, to_above_dir = 5, to_below_dir = 6, to_on_dir = 7
}
 
enum  TYPE {
  no_x_event = 0, ccx_point = 1, ccx_overlap = 2, csx_point = 3,
  csx_overlap = 4
}
 

Public Member Functions

 ON_X_EVENT ()
 NO VIRTUAL FUNCTIONS IN THIS CLASS. More...
 
void Dump (ON_TextLog &text_log) const
 
bool IsCCXEvent () const
 
bool IsCSXEvent () const
 
bool IsOverlapEvent () const
 
bool IsPointEvent () const
 
bool IsValid (ON_TextLog *text_log, double intersection_tolerance, double overlap_tolerance, const class ON_Curve *curveA, const class ON_Interval *curveA_domain, const class ON_Curve *curveB, const class ON_Interval *curveB_domain, const class ON_Surface *surfaceB, const class ON_Interval *surfaceB_domain0, const class ON_Interval *surfaceB_domain1) const
 
bool Local_Min (int ei) const
 
void Set_Local_Min (int ei, bool newvalue)
 

Static Public Member Functions

static int CleanList (double event_tolerance, double overlap_tolerance, int xevent_count, ON_X_EVENT *xevent, ON_Interval *domain=nullptr)
 
static int Compare (const ON_X_EVENT *a, const ON_X_EVENT *b)
 This class must use default copy constructor, operator=, and destructor. More...
 
static bool CompareEquivalent (const ON_X_EVENT &XA, const ON_X_EVENT &XB, double RelativePointTol, ON_TextLog *log)
 
static void CopyEventPart (const ON_X_EVENT &src, int src_end, ON_X_EVENT &dst, int dst_end)
 
static double IntersectionTolerance (double intersection_tolerance)
 
static bool IsValidCurveCurveOverlap (ON_Interval curveA_domain, int sample_count, double overlap_tolerance, const class ON_CurveTreeNode *cnodeA, const class ON_CurveTreeNode *cnodeB, const ON_Interval *curveB_domain=0)
 
static bool IsValidCurvePlaneOverlap (ON_Interval curveA_domain, int sample_count, double endpoint_tolerance, double overlap_tolerance, const class ON_CurveTreeNode *cnodeA, const ON_PlaneEquation *plane_equation)
 
static bool IsValidCurveSurfaceOverlap (ON_Interval curveA_domain, int sample_count, double overlap_tolerance, const class ON_CurveTreeNode *cnodeA, const class ON_SurfaceTreeNode *snodeB, const ON_Interval *surfaceB_udomain=0, const ON_Interval *surfaceB_vdomain=0)
 
static bool IsValidList (int xevent_count, const ON_X_EVENT *xevent, ON_TextLog *text_log, double intersection_tolerance, double overlap_tolerance, const class ON_Curve *curveA, const class ON_Interval *curveA_domain, const class ON_Curve *curveB, const class ON_Interval *curveB_domain, const class ON_Surface *surfaceB, const class ON_Interval *surfaceB_domain0, const class ON_Interval *surfaceB_domain1)
 
static double OverlapTolerance (double intersection_tolerance, double overlap_tolerance)
 

Public Attributes

ON_3dPoint m_A [2]
 intersection points on first curve More...
 
double m_a [2]
 intersection parameters on first curve More...
 
ON_3dPoint m_B [2]
 intersection points on second curve or surface More...
 
double m_b [4]
 intersection parameters on second curve or surface More...
 
const class ON_CurveTreeNodem_cnodeA [2]
 tree nodes where the intersection events occurred. More...
 
const class ON_CurveTreeNodem_cnodeB [2]
 
DIRECTION m_dirA [2]
 
DIRECTION m_dirB [2]
 
double m_nodeA_t [2]
 nodeA bezier parameters corresponding to a[] values More...
 
double m_nodeB_t [4]
 nodeB bezier parameters corresponding to b[] values. More...
 
const class ON_SurfaceTreeNodem_snodeB [2]
 
TYPE m_type
 
ON_U m_user
 
unsigned int m_x_eventsn
 Each intersection event is assigned a runtime serial number. More...
 

Detailed Description

Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete openNURBS copyright information see http://www.opennurbs.org. The ON_X_EVENT class is used to report curve-curve and curve-surface intersection events.

Member Enumeration Documentation

◆ DIRECTION

Event directions for use in the m_dirA[] and m_dirB[] fields. The "x_from_*" values are used to report the behavior of the curve as it enters the intersection event. The "x_to_*" values are used to report the behavior of the curve as it leaves the intersection event.

Enumerator
no_x_dir 
at_end_dir 

event is at the start/end/side of object's parameter space

from_above_dir 

curve enters x-event from above surface/other curve

from_below_dir 

curve enters x-event from below surface/other curve

from_on_dir 

curve enters x-event tangent surface/other curve

to_above_dir 

curve leaves x-event above surface/other curve

to_below_dir 

curve leaves x-event below surface/other curve

to_on_dir 

curve leaves x-event tangent to surface/other curve

◆ TYPE

Enumerator
no_x_event 
ccx_point 

Two valid event types for curve-curve intersections.

curve-curve transverse intersection point

ccx_overlap 

curve-curve intersection overlap

csx_point 

Two valid event types for curve-surface intersections.

curve-surface transverse intersection point

csx_overlap 

curve-surface intersection overlap

Constructor & Destructor Documentation

◆ ON_X_EVENT()

ON_X_EVENT::ON_X_EVENT ( )

NO VIRTUAL FUNCTIONS IN THIS CLASS.

Default construction sets everything to zero.

Member Function Documentation

◆ CleanList()

static int ON_X_EVENT::CleanList ( double  event_tolerance,
double  overlap_tolerance,
int  xevent_count,
ON_X_EVENT xevent,
ON_Interval domain = nullptr 
)
static

Description: Expert user tool to cleanup a list of intersection events. Parameters: event_tolerance - [in] If the distance between events is <= event_tolerance, they will be considered to be the same event. Typically, event_tolerance is "small" and event_tolerance <= intersection_tolerance.

overlap_tolerance - [in] minimum length for an intersection overlap segment. Typically, overlap_tolerance is "large" and overlap_tolerance > intersection_tolerance

xevent_count - [in] xevent - [in/out] domain - [in] domain of the intersection problem. domain[0] is curve domain and either domain[1] is domain of second cuve or domain[1] x domain[2] is surface doamin domain = nullptr means no special handling of domain boundaries Returns: Length of cleaned list.

◆ Compare()

static int ON_X_EVENT::Compare ( const ON_X_EVENT a,
const ON_X_EVENT b 
)
static

This class must use default copy constructor, operator=, and destructor.

Description: Compares intersection events and sorts them in the canonical order. Returns: @untitled table -1 this < other 0 this == other +1 this > other Remarks: ON_CX_EVENT::Compare is used to sort intersection events into canonical order.

◆ CompareEquivalent()

static bool ON_X_EVENT::CompareEquivalent ( const ON_X_EVENT XA,
const ON_X_EVENT XB,
double  RelativePointTol,
ON_TextLog log 
)
static

Description: Compare intersection events Parameters: XA, XB are a pair of events to compare for equivalence RelativePointTol - 3d points are compared by || Pa - Pb || < ( 1 + ||Pa||) * RelativePointTol log [in] if not null and false is returned then a description of the error is appended to log. Returns: @untitled table true if the XA and XB represent the same intersections Remarks: use RelativePointTol=ON_UNSET_VALUE to use the default value of ON_SQRT_EPSILON

◆ CopyEventPart()

static void ON_X_EVENT::CopyEventPart ( const ON_X_EVENT src,
int  src_end,
ON_X_EVENT dst,
int  dst_end 
)
static

Description: Expert user tool to copy portions of the itersection event information from one event to another.
If src.m_type is ON_X_EVENT::csx_*, then the m_b[] and m_nodeB_t[] values are treated as surface parameters, otherwise the values are treated as curve parameters. The m_type field is not copied. Parameters: src - [in] src_end - [in] 0 or 1 (m_A[] source index) dst - [out] dst_end - [in] 0 or 1 (m_A[] destination index)

◆ Dump()

void ON_X_EVENT::Dump ( ON_TextLog text_log) const

◆ IntersectionTolerance()

static double ON_X_EVENT::IntersectionTolerance ( double  intersection_tolerance)
static

Description: Convert input intersection tolerance to value used in calculations. Parameters: intersection_tolerance - [in] Returns: Value use in intersection calculations.

◆ IsCCXEvent()

bool ON_X_EVENT::IsCCXEvent ( ) const

Returns: True if m_type is ccx_point or ccx_overlap

◆ IsCSXEvent()

bool ON_X_EVENT::IsCSXEvent ( ) const

Returns: True if m_type is csx_point or csx_overlap

◆ IsOverlapEvent()

bool ON_X_EVENT::IsOverlapEvent ( ) const

Returns: True if m_type is ccx_overlap or csx_overlap.

◆ IsPointEvent()

bool ON_X_EVENT::IsPointEvent ( ) const

Returns: True if m_type is ccx_point or csx_point.

◆ IsValid()

bool ON_X_EVENT::IsValid ( ON_TextLog text_log,
double  intersection_tolerance,
double  overlap_tolerance,
const class ON_Curve curveA,
const class ON_Interval curveA_domain,
const class ON_Curve curveB,
const class ON_Interval curveB_domain,
const class ON_Surface surfaceB,
const class ON_Interval surfaceB_domain0,
const class ON_Interval surfaceB_domain1 
) const

Description: Check intersection event values to make sure they are valid. Parameters: text_log - [in] If not null and an error is found, then a description of the error is printed to text_log. intersection_tolerance - [in] 0.0 or value used in intersection calculation. overlap_tolerance - [in] 0.0 or value used in intersection calculation. curveA - [in] nullptr or curveA passed to intersection calculation. curveA_domain - [in] nullptr or curveA domain used in intersection calculation. curveB - [in] nullptr or curveB passed to intersection calculation. curveB_domain - [in] nullptr or curveB domain used in intersection calculation. surfaceB - [in] nullptr or surfaceB passed to intersection calculation. surfaceB_domain0 - [in] nullptr or surfaceB "u" domain used in intersection calculation. surfaceB_domain1 - [in] nullptr or surfaceB "v" domain used in intersection calculation. Returns: True if event is valid.

◆ IsValidCurveCurveOverlap()

static bool ON_X_EVENT::IsValidCurveCurveOverlap ( ON_Interval  curveA_domain,
int  sample_count,
double  overlap_tolerance,
const class ON_CurveTreeNode cnodeA,
const class ON_CurveTreeNode cnodeB,
const ON_Interval curveB_domain = 0 
)
static

Description: Do a quick and simple test to see if this curve lies on some portion of curveB. Parameters: curveA_domain - [in] non empty interval sample_count - [in] minimum number of test points overlap_tolerance - [in] cnodeA - [in] cnodeB - [in] curveB_domain - [in] optional domain restriction Returns: True if sections overlap.

◆ IsValidCurvePlaneOverlap()

static bool ON_X_EVENT::IsValidCurvePlaneOverlap ( ON_Interval  curveA_domain,
int  sample_count,
double  endpoint_tolerance,
double  overlap_tolerance,
const class ON_CurveTreeNode cnodeA,
const ON_PlaneEquation plane_equation 
)
static

Description: Do a quick and simple test to see if this curve lies on the plane. Parameters: curveA_domain - [in] non empty interval sample_count - [in] minimum number of test points endpont_tolerance - [in] tolerance to use when checking ends overlap_tolerance - [in] tolerance to use when checking interior cnodeA - [in] plane_equation - [in] Returns: True if curve lies on the plane

◆ IsValidCurveSurfaceOverlap()

static bool ON_X_EVENT::IsValidCurveSurfaceOverlap ( ON_Interval  curveA_domain,
int  sample_count,
double  overlap_tolerance,
const class ON_CurveTreeNode cnodeA,
const class ON_SurfaceTreeNode snodeB,
const ON_Interval surfaceB_udomain = 0,
const ON_Interval surfaceB_vdomain = 0 
)
static

Description: Do a quick and simple test to see if this curve lies on the surface. Parameters: curveA_domain - [in] non empty interval sample_count - [in] minimum number of test points overlap_tolerance - [in] cnodeA - [in] snodeB - [in] surfaceB_udomain - [in] optional domain restriction surfaceB_vdomain - [in] optional domain restriction Returns: True if sections overlap.

◆ IsValidList()

static bool ON_X_EVENT::IsValidList ( int  xevent_count,
const ON_X_EVENT xevent,
ON_TextLog text_log,
double  intersection_tolerance,
double  overlap_tolerance,
const class ON_Curve curveA,
const class ON_Interval curveA_domain,
const class ON_Curve curveB,
const class ON_Interval curveB_domain,
const class ON_Surface surfaceB,
const class ON_Interval surfaceB_domain0,
const class ON_Interval surfaceB_domain1 
)
static

Description: Expert user tool to check a list of intersection events. Parameters: xevent_count - [in] xevent - [in] text_log - [in] nullptr or place to describe errors. intersection_tolerance - [in] overlap_tolerance - [in] curveA - [in] curveA_domain - [in] (can be nullptr) curveB - [in] (nullptr for curve-surface intersection events) curveB_domain - [in] (can be nullptr) surfaceB - [in] (nullptr for curve-curve intersection events) surfaceB_domain0 - [in] (can be nullptr) surfaceB_domain1 - [in] (can be nullptr) Returns: True if list is valid.

◆ Local_Min()

bool ON_X_EVENT::Local_Min ( int  ei) const

An overlap start or end can be a local minimum of the function dist( C(t), S(u,v) ) for a curve surface intersection Local_Min(i) is true if (m_a[i], m_b[2*i], m_b[2*i+1]) is a local minimum of the function dist( C(t), S(u,v) ).

◆ OverlapTolerance()

static double ON_X_EVENT::OverlapTolerance ( double  intersection_tolerance,
double  overlap_tolerance 
)
static

Description: Convert input intersection tolerance to value used in calculations. Parameters: intersection_tolerance - [in] Returns: Value use in intersection calculations.

◆ Set_Local_Min()

void ON_X_EVENT::Set_Local_Min ( int  ei,
bool  newvalue 
)

Member Data Documentation

◆ m_A

ON_3dPoint ON_X_EVENT::m_A[2]

intersection points on first curve

◆ m_a

double ON_X_EVENT::m_a[2]

intersection parameters on first curve

◆ m_B

ON_3dPoint ON_X_EVENT::m_B[2]

intersection points on second curve or surface

◆ m_b

double ON_X_EVENT::m_b[4]

intersection parameters on second curve or surface

◆ m_cnodeA

const class ON_CurveTreeNode* ON_X_EVENT::m_cnodeA[2]

tree nodes where the intersection events occurred.

◆ m_cnodeB

const class ON_CurveTreeNode* ON_X_EVENT::m_cnodeB[2]

◆ m_dirA

DIRECTION ON_X_EVENT::m_dirA[2]

There are cases when it is valuable to have direction flags on intersection events. The m_dirA[] and m_dirB[] fields provide a place to store these flags. Because this information is rarely used, it is not computed by the intersection routines. You can use ON_SetCurveCurveIntersectionDir or ON_SetCurveSurfaceIntersectionDir to fill in these fields.

◆ m_dirB

DIRECTION ON_X_EVENT::m_dirB[2]

◆ m_nodeA_t

double ON_X_EVENT::m_nodeA_t[2]

nodeA bezier parameters corresponding to a[] values

◆ m_nodeB_t

double ON_X_EVENT::m_nodeB_t[4]

nodeB bezier parameters corresponding to b[] values.

◆ m_snodeB

const class ON_SurfaceTreeNode* ON_X_EVENT::m_snodeB[2]

◆ m_type

TYPE ON_X_EVENT::m_type

The m_type field determines how the values in the other fields are interpreted. See the detailed comment below for complete information

◆ m_user

ON_U ON_X_EVENT::m_user

This field is a scratch field for users. The constructor sets it to zero and the intersectors never use it.

◆ m_x_eventsn

unsigned int ON_X_EVENT::m_x_eventsn

Each intersection event is assigned a runtime serial number.