2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
8 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
10 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
11 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
12 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
14 public class Grid3D extends AbstractCompositeShape {
16 public Grid3D(final Point3D p1t, final Point3D p2t, final double step,
17 final LineAppearance appearance) {
21 final Point3D p1 = new Point3D(p1t);
22 final Point3D p2 = new Point3D(p2t);
25 final double tmp = p1.x;
31 final double tmp = p1.y;
37 final double tmp = p1.z;
42 for (double x = p1.x; x <= p2.x; x += step)
43 for (double y = p1.y; y <= p2.y; y += step)
44 for (double z = p1.z; z <= p2.z; z += step) {
46 final Point3D p3 = new Point3D(x, y, z);
48 if ((x + step) <= p2.x) {
49 final Point3D point3d2 = new Point3D(x + step, y, z);
50 addShape(appearance.getLine(p3, point3d2));
53 if ((y + step) <= p2.y) {
54 final Point3D point3d3 = new Point3D(x, y + step, z);
55 addShape(appearance.getLine(p3, point3d3));
58 if ((z + step) <= p2.z) {
59 final Point3D point3d4 = new Point3D(x, y, z + step);
60 addShape(appearance.getLine(p3, point3d4));