2 * Sixth 3D engine. Copyright ©2012-2019, 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.composite.wireframe;
12 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
13 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
14 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
16 public class Grid3D extends AbstractCompositeShape {
18 public Grid3D(final Point3D p1t, final Point3D p2t, final double step,
19 final LineAppearance appearance) {
23 final Point3D p1 = new Point3D(p1t);
24 final Point3D p2 = new Point3D(p2t);
27 final double tmp = p1.x;
33 final double tmp = p1.y;
39 final double tmp = p1.z;
44 for (double x = p1.x; x <= p2.x; x += step)
45 for (double y = p1.y; y <= p2.y; y += step)
46 for (double z = p1.z; z <= p2.z; z += step) {
48 final Point3D p3 = new Point3D(x, y, z);
50 if ((x + step) <= p2.x) {
51 final Point3D point3d2 = new Point3D(x + step, y, z);
52 addShape(appearance.getLine(p3, point3d2));
55 if ((y + step) <= p2.y) {
56 final Point3D point3d3 = new Point3D(x, y + step, z);
57 addShape(appearance.getLine(p3, point3d3));
60 if ((z + step) <= p2.z) {
61 final Point3D point3d4 = new Point3D(x, y, z + step);
62 addShape(appearance.getLine(p3, point3d4));