List of usage examples for org.apache.commons.math3.geometry.euclidean.twod.hull MonotoneChain MonotoneChain
public MonotoneChain(final boolean includeCollinearPoints)
From source file:org.micromanager.plugins.magellan.surfacesandregions.SurfaceInterpolator.java
public SurfaceInterpolator(String xyDevice, String zDevice) { manager_ = SurfaceManager.getInstance(); name_ = manager_.getNewName();// w w w. j av a2s .co m xyDeviceName_ = xyDevice; zDeviceName_ = zDevice; //store points sorted by z coordinate to easily find the top, for generating slice index 0 position points_ = new TreeSet<Point3d>(new Comparator<Point3d>() { @Override public int compare(Point3d p1, Point3d p2) { if (p1.z > p2.z) { return 1; } else if (p1.z < p2.z) { return -1; } else { if (p1.x > p2.x) { return 1; } else if (p1.x < p2.x) { return -1; } else { if (p1.y > p2.y) { return 1; } else if (p1.y < p2.y) { return -1; } else { return 0; } } } } }); mChain_ = new MonotoneChain(true); executor_ = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, "Interpolation calculation thread "); } }); try { int dir = Magellan.getCore().getFocusDirection(zDevice); if (dir > 0) { towardsSampleIsPositive_ = true; } else if (dir < 0) { towardsSampleIsPositive_ = false; } else { throw new Exception(); } } catch (Exception e) { Log.log("Couldn't get focus direction of Z drive. Configre using Tools--Hardware Configuration Wizard"); throw new RuntimeException(); } }