Rhino C++ API  9.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
OverlapInternalResults Class Reference

#include <rhinoSdkOverlap.h>

Public Types

typedef uint64_t CombinedID
 
typedef int CurveID
 Now that we've gotten all of that silly c++ism out of the way, some actual code. More...
 
typedef int SegmentID
 

Public Member Functions

 OverlapInternalResults (const OverlapInternalResults &other)
 
 OverlapInternalResults (OverlapInternalResults &&other) noexcept
 
 OverlapInternalResults (size_t n)
 
 ~OverlapInternalResults ()
 
bool check_dead (CombinedID) const
 
bool check_dead (CurveID) const
 
bool check_dead (CurveID, SegmentID) const
 
bool check_required (CombinedID) const
 
bool check_required (CurveID) const
 
bool check_required (CurveID, SegmentID) const
 
void finalize (bool &entirely_dead, ON_SimpleArray< ON_COMPONENT_INDEX > &dead_segments, ON_COMPONENT_INDEX::TYPE subtype, int target, int nsegments, bool whole_curves)
 
void mark_dead (CombinedID)
 
void mark_dead (CurveID)
 
void mark_dead (CurveID, SegmentID)
 
void mark_required (CombinedID)
 
void mark_required (CurveID)
 
void mark_required (CurveID, SegmentID)
 
OverlapInternalResultsoperator= (OverlapInternalResults &&other) noexcept
 
OverlapInternalResultsoperator= (OverlapInternalResults other)
 
void prefinalize (int target, int nsegments, bool whole_curves)
 
void record_overlap (int, int, const double *, int, int, const double *)
 

Static Public Member Functions

static bool check_coverage (std::vector< std::pair< double, int >> &transitions, bool add_ends)
 
static uint64_t pack_segment_id (int curve, int segment)
 
static void unpack_segment_id (uint64_t id, int &curve, int &segment)
 

Detailed Description

Copyright (c) 1993-2026 Robert McNeel & Associates. All rights reserved. Rhinoceros is a registered trademark 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 Rhino SDK copyright information see http://www.rhino3d.com/developer. The OverlapInternalResults / OverlapProxyIndex / RTreeOverlap classes in this header are the core geometry engine behind the Overlap command. They are NOT part of the public Rhino C++ SDK - they are scaffolding extracted from commands/cmdMatthew.cpp so that the command logic and the geometry computation can evolve independently.

The public C++ SDK surface for overlap detection is the CRhinoOverlapFate class and the RhinoGetOverlaps free function, declared at the bottom of this header.

Member Typedef Documentation

◆ CombinedID

◆ CurveID

Now that we've gotten all of that silly c++ism out of the way, some actual code.

Segments and curves may be either dead or required, both of which are boolean properties that may be get and set, at both the curve level and the segment level (including using a 64-bit id). Locked curves are never dead, and always required, and may not be modified.

◆ SegmentID

Constructor & Destructor Documentation

◆ OverlapInternalResults() [1/3]

OverlapInternalResults::OverlapInternalResults ( size_t  n)
inline

◆ ~OverlapInternalResults()

OverlapInternalResults::~OverlapInternalResults ( )
inline

◆ OverlapInternalResults() [2/3]

OverlapInternalResults::OverlapInternalResults ( const OverlapInternalResults other)
inline

◆ OverlapInternalResults() [3/3]

OverlapInternalResults::OverlapInternalResults ( OverlapInternalResults &&  other)
inlinenoexcept

Member Function Documentation

◆ check_coverage()

static bool OverlapInternalResults::check_coverage ( std::vector< std::pair< double, int >> &  transitions,
bool  add_ends 
)
inlinestatic

◆ check_dead() [1/3]

bool OverlapInternalResults::check_dead ( CombinedID  ) const

◆ check_dead() [2/3]

bool OverlapInternalResults::check_dead ( CurveID  ) const

◆ check_dead() [3/3]

bool OverlapInternalResults::check_dead ( CurveID  ,
SegmentID   
) const

◆ check_required() [1/3]

bool OverlapInternalResults::check_required ( CombinedID  ) const

◆ check_required() [2/3]

bool OverlapInternalResults::check_required ( CurveID  ) const

◆ check_required() [3/3]

bool OverlapInternalResults::check_required ( CurveID  ,
SegmentID   
) const

◆ finalize()

void OverlapInternalResults::finalize ( bool &  entirely_dead,
ON_SimpleArray< ON_COMPONENT_INDEX > &  dead_segments,
ON_COMPONENT_INDEX::TYPE  subtype,
int  target,
int  nsegments,
bool  whole_curves 
)
inline

Look for some definitive cases - all dead, all required, no intersections, etc...

We, unfortunately, need to think more about the set of intervals we've accumulated.

We now need to sort this curve's intervals by segment

Then walk through each segment and see if we can cover each of them.

If we don't have any intervals, we can't cover this segment with them...

Now we actually have to consider intervals. Doing this properly is actually an NP-complete problem, so we can't do it properly - it's the "set cover problem". First, figure out which set of intervals cover this segment.

We now have a non-empty list of active segments that might cover this segment - they're at the very least long enough! First, try to cover it with only already-required or soon-to-be-required intervals.

Figure out if this interval is required, either in the result set or the set we're newly adding

We've managed to cover this segment without adding anything new! If we're in segment mode, commit the result. Otherwise, don't do anything - but don't fail either.

We now know that, if we use everything at our disposal, we can cover this segment.

We can't cover this segment, regardless of what we've done.

Mark everything we used for this covering as required, at the curve level

Mark this curve as dead...

Either way, we can free up all of this curve's segment-by-segment data - it's all in the required/dead curve bitvectors.

Otherwise, we're using partial segment data!

Mark everything we used for this covering as required, at the segment level.

Mark this curve as dead...

Transfer all of the coverage data to the output vector - we need to keep the results around.

◆ mark_dead() [1/3]

void OverlapInternalResults::mark_dead ( CombinedID  )

◆ mark_dead() [2/3]

void OverlapInternalResults::mark_dead ( CurveID  )

◆ mark_dead() [3/3]

void OverlapInternalResults::mark_dead ( CurveID  ,
SegmentID   
)

◆ mark_required() [1/3]

void OverlapInternalResults::mark_required ( CombinedID  )

◆ mark_required() [2/3]

void OverlapInternalResults::mark_required ( CurveID  )

◆ mark_required() [3/3]

void OverlapInternalResults::mark_required ( CurveID  ,
SegmentID   
)

◆ operator=() [1/2]

OverlapInternalResults& OverlapInternalResults::operator= ( OverlapInternalResults &&  other)
inlinenoexcept

◆ operator=() [2/2]

OverlapInternalResults& OverlapInternalResults::operator= ( OverlapInternalResults  other)
inline

◆ pack_segment_id()

static uint64_t OverlapInternalResults::pack_segment_id ( int  curve,
int  segment 
)
inlinestatic

◆ prefinalize()

void OverlapInternalResults::prefinalize ( int  target,
int  nsegments,
bool  whole_curves 
)
inline

TODO: remove duplication from finalize - big difference is that this doesn't check for required segments.

Walk through each segment and try to cover it Then walk through each segment and see if we can cover each of them.

If we don't have any intervals, we can't cover this segment with them...

Now we actually have to consider intervals. Doing this properly is actually an NP-complete problem, so we can't do it properly - it's the "set cover problem". First, figure out which set of intervals cover this segment.

We now have a non-empty list of active segments that might cover this segment - they're at the very least long enough! First, try to cover it with only already-required or soon-to-be-required intervals.

Figure out if this interval is required, either in the result set or the set we're newly adding

We've managed to cover this segment without adding anything new! If we're in segment mode, commit the result. Otherwise, don't do anything - but don't fail either.

We now know that, if we use everything at our disposal, we can cover this segment.

We can't cover this segment, regardless of what we've done.

◆ record_overlap()

void OverlapInternalResults::record_overlap ( int  ,
int  ,
const double *  ,
int  ,
int  ,
const double *   
)

◆ unpack_segment_id()

static void OverlapInternalResults::unpack_segment_id ( uint64_t  id,
int &  curve,
int &  segment 
)
inlinestatic