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;
9 import eu.svjatoslav.sixth.e3d.math.Vertex;
11 import java.util.Comparator;
13 public class BorderLine implements Comparator<BorderLine> {
15 public final int count;
19 public BorderLine(final Vertex c1, final Vertex c2,
27 public int compare(final BorderLine o1, final BorderLine o2) {
28 return Double.compare(o1.getLength(), o2.getLength());
31 public double getLength() {
32 return c1.coordinate.getDistanceTo(c2.coordinate);
35 public Vertex getMiddlePoint() {
37 new Point3D().computeMiddlePoint(c1.coordinate, c2.coordinate),
38 new Point2D().setToMiddle(c1.textureCoordinate, c2.textureCoordinate));