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.shapes.basic.line;
7 public class LineInterpolator {
9 private double x1, y1, d1, x2, y2, d2;
16 public boolean containsY(final int y) {
29 public double getD() {
33 public int getX(final int y) {
35 return (int) (x2 + x1) / 2;
37 final int distanceFromY1 = y - (int) y1;
39 d = d1 + ((dinc * distanceFromY1) / height);
41 return (int) x1 + ((width * distanceFromY1) / height);
44 public void setPoints(final double x1, final double y1, final double d1,
45 final double x2, final double y2, final double d2) {
55 height = (int) y2 - (int) y1;
56 width = (int) x2 - (int) x1;