|
Rhino C++ API
9.0
|
#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 |
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) |
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.
| typedef uint64_t OverlapInternalResults::CombinedID |
| typedef int OverlapInternalResults::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.
| typedef int OverlapInternalResults::SegmentID |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinestatic |
| bool OverlapInternalResults::check_dead | ( | CombinedID | ) | const |
| bool OverlapInternalResults::check_dead | ( | CurveID | ) | const |
| bool OverlapInternalResults::check_required | ( | CombinedID | ) | const |
| bool OverlapInternalResults::check_required | ( | CurveID | ) | const |
|
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.
| void OverlapInternalResults::mark_dead | ( | CombinedID | ) |
| void OverlapInternalResults::mark_dead | ( | CurveID | ) |
| void OverlapInternalResults::mark_required | ( | CombinedID | ) |
| void OverlapInternalResults::mark_required | ( | CurveID | ) |
|
inlinenoexcept |
|
inline |
|
inlinestatic |
|
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.
| void OverlapInternalResults::record_overlap | ( | int | , |
| int | , | ||
| const double * | , | ||
| int | , | ||
| int | , | ||
| const double * | |||
| ) |
|
inlinestatic |
1.8.17