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.composite.wireframe;
7 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
8 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
9 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
11 public class Grid3D extends AbstractCompositeShape {
13 public Grid3D(final Point3D p1t, final Point3D p2t, final double step,
14 final LineAppearance appearance) {
18 final Point3D p1 = new Point3D(p1t);
19 final Point3D p2 = new Point3D(p2t);
22 final double tmp = p1.x;
28 final double tmp = p1.y;
34 final double tmp = p1.z;
39 for (double x = p1.x; x <= p2.x; x += step)
40 for (double y = p1.y; y <= p2.y; y += step)
41 for (double z = p1.z; z <= p2.z; z += step) {
43 final Point3D p3 = new Point3D(x, y, z);
45 if ((x + step) <= p2.x) {
46 final Point3D point3d2 = new Point3D(x + step, y, z);
47 addShape(appearance.getLine(p3, point3d2));
50 if ((y + step) <= p2.y) {
51 final Point3D point3d3 = new Point3D(x, y + step, z);
52 addShape(appearance.getLine(p3, point3d3));
55 if ((z + step) <= p2.z) {
56 final Point3D point3d4 = new Point3D(x, y, z + step);
57 addShape(appearance.getLine(p3, point3d4));