// Test of closest pair algorithms
// David Eppstein, UC Irvine, 19 Apr 1997
//
// "Tron"-like motorcycle-crashing ray-intersection diagram
//
// We find a set of n rays (represented by initial coordinates and vector
// motion), and repeatedly find the next time at which two rays intersect;
// once this happens we replace the intersecting ray by a line segment.
// This was used by Jeff Erickson as an abstraction of straight skeletons.

#ifndef TRON_H
#define TRON_H

#include "PointSet.h"
#include "Algorithms.h"

class Tron : public PointSet {
	typedef struct { double x, y, dx, dy, t; } ray;
	ray * points;
 	void cross(point, point, double &, double &);	// find crossing times
 	void TerminateRays(point, point, ClosestPairs &);

	friend extern CPApplication RayDiagram;

 public: 
 	Tron(unsigned long npoints);
 	~Tron() { delete points; }
 	double operator() (point i, point j);
};

extern CPApplication RayDiagram;

#endif
