Algorithm
Development Kit 1.0

algs.model.problems.segmentIntersection
Class BruteForceAlgorithm

java.lang.Object
  extended by algs.model.problems.segmentIntersection.IntersectionDetection
      extended by algs.model.problems.segmentIntersection.BruteForceAlgorithm

public class BruteForceAlgorithm
extends IntersectionDetection

Brute-force implementation of Line Segment intersection.

Can be used as a benchmark for improvements when using LineSweep; alternatively, can show the degenerate cases where a brute force approach is faster.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Field Summary
 
Fields inherited from class algs.model.problems.segmentIntersection.IntersectionDetection
report
 
Constructor Summary
BruteForceAlgorithm()
          Default constructor.
 
Method Summary
 java.util.Hashtable<IPoint,ILineSegment[]> intersections(ILineSegment[] segments)
          Check each possible pair of line segments and record its intersection.
 
Methods inherited from class algs.model.problems.segmentIntersection.IntersectionDetection
computeTime, initialize, intersections, intersections, output, record, record, sameWithinEpsilon, startTime, time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BruteForceAlgorithm

public BruteForceAlgorithm()
Default constructor.

Method Detail

intersections

public java.util.Hashtable<IPoint,ILineSegment[]> intersections(ILineSegment[] segments)
Check each possible pair of line segments and record its intersection.

Specified by:
intersections in class IntersectionDetection
Parameters:
segments - segments to be evaluated.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.