restoreSingletonInPlaceOfMultipleShards MethodStatic

Specialized logic for replacing clip fragments by an equivalent singleton.

  • If there are baseCount + 1 or fewer fragments, do nothing.
  • If there are more than baseCount+1 fragments:
    • drop them all to the cache
    • push a copy of the singleton.
  • The use case for this is that a multi-step clipper (e.g. UnionOfConvexClipPlaneSets) may produce many fragments, and then be able to determine that they really are the original pre-clip polygon unchanged.
  • The baseCount+1 case is the case where the entire original singleton is still a singleton and can be left alone.
  • Calling this replacer shuffles the original back into the fragment array, and drops the fragments.
  • This determination is solely within the logic of the caller.

restoreSingletonInPlaceOfMultipleShards(fragments: GrowableXYZArray[], baseCount: number, singleton: IndexedXYZCollection, arrayCache: ): void

Parameter Type Description
fragments GrowableXYZArray[]  
baseCount number original count
singleton IndexedXYZCollection single array which may be a replacement for multiple fragments
arrayCache  

Returns - void

Defined in

Last Updated: 14 November, 2024