2 * Sixth 3D engine. Copyright ©2012-2020, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.sixth.e3d.renderer.raster.slicer;
12 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
13 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
15 import java.util.Comparator;
17 public class BorderLine implements Comparator<BorderLine> {
19 public final int count;
20 final PolygonCoordinate c1;
21 final PolygonCoordinate c2;
23 public BorderLine(final PolygonCoordinate c1, final PolygonCoordinate c2,
31 public int compare(final BorderLine o1, final BorderLine o2) {
32 return Double.compare(o1.getLength(), o2.getLength());
35 public double getLength() {
36 return c1.space.getDistanceTo(c2.space);
39 public PolygonCoordinate getMiddlePoint() {
40 return new PolygonCoordinate(new Point3D().computeMiddlePoint(c1.space,
41 c2.space), new Point2D().getMiddle(c1.texture,