Search this API

y.geom
Class IntersectionAlgorithm

java.lang.Object
  extended by y.geom.IntersectionAlgorithm

public class IntersectionAlgorithm
extends java.lang.Object

This class calculates the intersection of rectangles in the plane with the help of a sweep-line algorithm.
The complexity is O(n log n + s) where n is the number of rectangles and s the number of intersections.

 

Nested Class Summary
static interface IntersectionAlgorithm.IntersectionHandler
          An instance of this interface handles intersections found by the IntersectionAlgorithm,
 
Constructor Summary
IntersectionAlgorithm()
           
 
Method Summary
protected static YList createXStruct(YList objects)
          Initializes the sweep line data structures from a set of objects.
static void intersect(YList objects, IntersectionAlgorithm.IntersectionHandler iHandler)
          Calculates the intersections of rectangles in the plane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntersectionAlgorithm

public IntersectionAlgorithm()
Method Detail

intersect

public static void intersect(YList objects,
                             IntersectionAlgorithm.IntersectionHandler iHandler)
Calculates the intersections of rectangles in the plane. Every found intersection is reported to an IntersectionHandler. Rectangles with negative size are completely ignored by this implementation (i.e. never generate intersections)

Parameters:
objects - a list of PlaneObject objects.
iHandler - intersections are reported to this class.

createXStruct

protected static YList createXStruct(YList objects)
Initializes the sweep line data structures from a set of objects.


© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.