- * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
+ * Sixth 3D engine. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
public class Grid2D extends AbstractCompositeShape {
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
public class Grid2D extends AbstractCompositeShape {
+ /**
+ * @param transform Grid location
+ * @param rectangle Grid dimensions
+ * @param xDivisionCount Division count along X axis
+ * @param yDivisionCount Division count along Y axis
+ * @param appearance Grid lines appearance
+ */
- final double stepY = rectangle.getHeight() / divisionsY;
- final double stepX = rectangle.getWidth() / divisionsX;
+ final double stepY = rectangle.getHeight() / yDivisionCount;
+ final double stepX = rectangle.getWidth() / xDivisionCount;
- for (int yslice = 0; yslice <= divisionsY; yslice++) {
- final double y = (yslice * stepY) + rectangle.getLowerY();
+ for (int ySlice = 0; ySlice <= yDivisionCount; ySlice++) {
+ final double y = (ySlice * stepY) + rectangle.getLowerY();
- for (int xslice = 0; xslice <= divisionsX; xslice++) {
- final double x = (xslice * stepX) + rectangle.getLowerX();
+ for (int xSlice = 0; xSlice <= xDivisionCount; xSlice++) {
+ final double x = (xSlice * stepX) + rectangle.getLowerX();
final Point3D p1 = new Point3D(x, y, 0);
final Point3D p2 = new Point3D(x + stepX, y, 0);
final Point3D p3 = new Point3D(x, y + stepY, 0);
final Point3D p1 = new Point3D(x, y, 0);
final Point3D p2 = new Point3D(x + stepX, y, 0);
final Point3D p3 = new Point3D(x, y + stepY, 0);