2 * Sixth 3D engine. Copyright ©2012-2018, 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.shapes.basic.line;
12 public class LineInterpolator {
14 private double x1, y1, d1, x2, y2, d2;
21 public boolean containsY(final int y) {
34 public double getD() {
38 public int getX(final int y) {
40 return (int) (x2 + x1) / 2;
42 final int distanceFromY1 = y - (int) y1;
44 d = d1 + ((dinc * distanceFromY1) / height);
46 return (int) x1 + ((width * distanceFromY1) / height);
49 public void setPoints(final double x1, final double y1, final double d1,
50 final double x2, final double y2, final double d2) {
60 height = (int) y2 - (int) y1;
61 width = (int) x2 - (int) x1;