2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.sixth.e3d.renderer.raster.slicer;
7 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
8 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
10 import java.util.Comparator;
12 public class BorderLine implements Comparator<BorderLine> {
14 public final int count;
15 final PolygonCoordinate c1;
16 final PolygonCoordinate c2;
18 public BorderLine(final PolygonCoordinate c1, final PolygonCoordinate c2,
26 public int compare(final BorderLine o1, final BorderLine o2) {
27 return Double.compare(o1.getLength(), o2.getLength());
30 public double getLength() {
31 return c1.space.getDistanceTo(c2.space);
34 public PolygonCoordinate getMiddlePoint() {
35 return new PolygonCoordinate(new Point3D().computeMiddlePoint(c1.space,
36 c2.space), new Point2D().setToMiddle(c1.texture,