From d2d54167899adb48078f9f62b245e5a72c1c798a Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 17:42:11 -0400 Subject: [PATCH 01/10] fixed typo --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 5838b97f..4be6d33b 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2893,7 +2893,7 @@ public CSG syncProperties(CSG dying) { getStorage().syncProperties(dying.getStorage()); return this; } - public static List tesselate(CSG incoming,int xSteps, int ySteps, double xGrid, double yGrid, double oddRowYOffset){ + public static List tessellate(CSG incoming,int xSteps, int ySteps, double xGrid, double yGrid, double oddRowYOffset){ ArrayList back = new ArrayList(); for(int i=0;i tesselate(CSG incoming,int xSteps, int ySteps, double xG } return back; } - public static List tesselate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ - return tesselate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),oddRowYOffset); + public static List tessellate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ + return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),oddRowYOffset); } - public static List tesselate(CSG incoming,int xSteps, int ySteps){ - return tesselate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),0); + public static List tessellate(CSG incoming,int xSteps, int ySteps){ + return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),0); } - public static List tesselate(CSG incoming,int steps){ - return tesselate(incoming,steps,steps,incoming.getTotalX(),incoming.getTotalY(),0); + public static List tessellate(CSG incoming,int steps){ + return tessellate(incoming,steps,steps,incoming.getTotalX(),incoming.getTotalY(),0); } /** * @@ -2920,10 +2920,10 @@ public static List tesselate(CSG incoming,int steps){ * @param spacing the amount of space between each hexagon * @return a list of spaced hexagons */ - List tesselateHex(CSG incoming,int xSteps, int ySteps, double spacing){ + List tessellateHex(CSG incoming,int xSteps, int ySteps, double spacing){ double y= incoming.getTotalY()+spacing; double x =(((y/Math.sqrt(3))))*(3/2); - return tesselate(incoming,xSteps,ySteps,x,y,y/2); + return tessellate(incoming,xSteps,ySteps,x,y,y/2); } /** * @@ -2932,7 +2932,7 @@ List tesselateHex(CSG incoming,int xSteps, int ySteps, double spacing){ * @param ySteps number of steps in Y * @return a list of spaced hexagons */ - List tesselateHex(CSG incoming,int xSteps, int ySteps){ - return tesselateHex(incoming, xSteps, ySteps, 0); + List tessellateHex(CSG incoming,int xSteps, int ySteps){ + return tessellateHex(incoming, xSteps, ySteps, 0); } } From d510d7c2619d350cde2010f60d1d9399bd8e8d4d Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 20:07:34 -0400 Subject: [PATCH 02/10] modded tessellate to use offset matrix --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 54 ++++++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 4be6d33b..2f4961f5 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2893,15 +2893,51 @@ public CSG syncProperties(CSG dying) { getStorage().syncProperties(dying.getStorage()); return this; } - public static List tessellate(CSG incoming,int xSteps, int ySteps, double xGrid, double yGrid, double oddRowYOffset){ - ArrayList back = new ArrayList(); - for(int i=0;i tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double[][] offsets) { + double oddRowXOffset = offsets[0][0]; + double oddRowYOffset = offsets[0][1]; + double oddRowZOffset = offsets[0][2]; + + double oddColXOffset = offsets[1][0]; + double oddColYOffset = offsets[1][1]; + double oddColZOffset = offsets[1][2]; + + double oddLayXOffset = offsets[2][0]; + double oddLayYOffset = offsets[2][1]; + double oddLayZOffset = offsets[2][2]; + + ArrayList back = new ArrayList(); + for (int i = 0; i < xSteps; i++) { + for (int j = 0; j < ySteps; j++) { + for (int k = 0; k < zSteps; k++) { + + double xoff = 0; + double yoff = 0; + double zoff = 0; + + if (i % 2 != 0) { + xoff += oddRowXOffset; + yoff += oddRowYOffset; + zoff += oddRowZOffset; + } + + if (j % 2 != 0) { + xoff += oddColXOffset; + yoff += oddColYOffset; + zoff += oddColZOffset; + } + + if (k % 2 != 0) { + xoff += oddLayXOffset; + yoff += oddLayYOffset; + zoff += oddLayZOffset; + } + + back.add(incoming.move(xoff + (i * xGrid), yoff + (j * yGrid), zoff + (k * zGrid))); + } + } + } + return back; } public static List tessellate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),oddRowYOffset); From 53e94848ba8c4bc8bc5bdb1fa88fe028aad40732 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 20:11:14 -0400 Subject: [PATCH 03/10] added ability to specify offsets as args instead of a matrix --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 2f4961f5..a12f8870 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2939,6 +2939,14 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt } return back; } + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { + double[][] offsets = { + {oddRowXOffset, oddRowYOffset, oddRowZOffset}, + {oddColXOffset, oddColYOffset, oddColZOffset}, + {oddLayXOffset, oddLayYOffset, oddLayZOffset} + }; + return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, offsets); + } public static List tessellate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),oddRowYOffset); } From 59aa7e1113cdc9985834bc8e5fcd5f82bc41dba4 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 20:47:22 -0400 Subject: [PATCH 04/10] added a bunch of ease of usage methods --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 37 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index a12f8870..86506667 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2947,15 +2947,40 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt }; return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, offsets); } - public static List tessellate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ - return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),oddRowYOffset); + // Tessellate with default grid spacing and no offsets, specifying only xSteps, ySteps, and zSteps + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { + return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } - public static List tessellate(CSG incoming,int xSteps, int ySteps){ - return tessellate(incoming,xSteps,ySteps,incoming.getTotalX(),incoming.getTotalY(),0); + // Tessellate with offsets given as + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { + double[][] offsets = { + {oddRowXOffset, oddRowYOffset, oddRowZOffset}, + {oddColXOffset, oddColYOffset, oddColZOffset}, + {oddLayXOffset, oddLayYOffset, oddLayZOffset} + }; + return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), offsets); } - public static List tessellate(CSG incoming,int steps){ - return tessellate(incoming,steps,steps,incoming.getTotalX(),incoming.getTotalY(),0); + // Tessellate with specific steps, default offsets to zero + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { + return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } + // Tessellate with uniform grid spacing, specifying only steps and grid spacing + public static List tessellate(CSG incoming, int steps, double gridSpacing) { + return tessellate(incoming, steps, steps, steps, gridSpacing, gridSpacing, gridSpacing, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + // Tessellate with uniform grid spacing, creating a steps x steps x steps grid + public static List tessellate(CSG incoming, int steps) { + return tessellate(incoming, steps, steps, steps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + // Tessellate with specific grid spacing and no offsets, specifying xSteps and ySteps + public static List tessellateXY(CSG incoming, int xSteps, int ySteps) { + return tessellate(incoming, xSteps, ySteps, 1, incoming.getTotalX(), incoming.getTotalY(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + // Tessellate with specific grid spacing and no offsets, specifying xSteps and ySteps + public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid) { + return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + /** * * @param incoming Hexagon (with flats such that Y total is flat to flat distance) From 6781a33828477698a03ace96bbe795d124355ef2 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 21:15:34 -0400 Subject: [PATCH 05/10] switched default method to be more verbose version --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 36 ++++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 86506667..be23863d 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2893,19 +2893,7 @@ public CSG syncProperties(CSG dying) { getStorage().syncProperties(dying.getStorage()); return this; } - public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double[][] offsets) { - double oddRowXOffset = offsets[0][0]; - double oddRowYOffset = offsets[0][1]; - double oddRowZOffset = offsets[0][2]; - - double oddColXOffset = offsets[1][0]; - double oddColYOffset = offsets[1][1]; - double oddColZOffset = offsets[1][2]; - - double oddLayXOffset = offsets[2][0]; - double oddLayYOffset = offsets[2][1]; - double oddLayZOffset = offsets[2][2]; - + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { ArrayList back = new ArrayList(); for (int i = 0; i < xSteps; i++) { for (int j = 0; j < ySteps; j++) { @@ -2939,14 +2927,22 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt } return back; } - public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { - double[][] offsets = { - {oddRowXOffset, oddRowYOffset, oddRowZOffset}, - {oddColXOffset, oddColYOffset, oddColZOffset}, - {oddLayXOffset, oddLayYOffset, oddLayZOffset} - }; - return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, offsets); + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double[][] offsets) { + double oddRowXOffset = offsets[0][0]; + double oddRowYOffset = offsets[0][1]; + double oddRowZOffset = offsets[0][2]; + + double oddColXOffset = offsets[1][0]; + double oddColYOffset = offsets[1][1]; + double oddColZOffset = offsets[1][2]; + + double oddLayXOffset = offsets[2][0]; + double oddLayYOffset = offsets[2][1]; + double oddLayZOffset = offsets[2][2]; + + return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, oddRowXOffset, oddRowYOffset, oddRowZOffset, oddColXOffset, oddColYOffset, oddColZOffset, oddLayXOffset, oddLayYOffset, oddLayZOffset); } + // Tessellate with default grid spacing and no offsets, specifying only xSteps, ySteps, and zSteps public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); From 4382fa63e0ded9d228b5eb4d47992d4841eb4861 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Tue, 30 Jul 2024 21:37:32 -0400 Subject: [PATCH 06/10] remove ai slop documentation --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index be23863d..988b5322 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2893,6 +2893,7 @@ public CSG syncProperties(CSG dying) { getStorage().syncProperties(dying.getStorage()); return this; } + public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { ArrayList back = new ArrayList(); for (int i = 0; i < xSteps; i++) { @@ -2942,12 +2943,9 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, oddRowXOffset, oddRowYOffset, oddRowZOffset, oddColXOffset, oddColYOffset, oddColZOffset, oddLayXOffset, oddLayYOffset, oddLayZOffset); } - - // Tessellate with default grid spacing and no offsets, specifying only xSteps, ySteps, and zSteps public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } - // Tessellate with offsets given as public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { double[][] offsets = { {oddRowXOffset, oddRowYOffset, oddRowZOffset}, @@ -2956,27 +2954,27 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt }; return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), offsets); } - // Tessellate with specific steps, default offsets to zero public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } - // Tessellate with uniform grid spacing, specifying only steps and grid spacing public static List tessellate(CSG incoming, int steps, double gridSpacing) { return tessellate(incoming, steps, steps, steps, gridSpacing, gridSpacing, gridSpacing, 0, 0, 0, 0, 0, 0, 0, 0, 0); } - // Tessellate with uniform grid spacing, creating a steps x steps x steps grid public static List tessellate(CSG incoming, int steps) { return tessellate(incoming, steps, steps, steps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } - // Tessellate with specific grid spacing and no offsets, specifying xSteps and ySteps + + public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double oddRowXOffset, double oddRowYOffset, double oddColXOffset, double oddColYOffset) { + return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, oddRowXOffset, oddRowYOffset, 0, oddColXOffset, oddColYOffset, 0, 0, 0, 0); + } public static List tessellateXY(CSG incoming, int xSteps, int ySteps) { - return tessellate(incoming, xSteps, ySteps, 1, incoming.getTotalX(), incoming.getTotalY(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + return tessellateXY(incoming, xSteps, ySteps, incoming.getTotalX(), incoming.getTotalY(), 0, 0, 0, 0); } - // Tessellate with specific grid spacing and no offsets, specifying xSteps and ySteps public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid) { - return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + return tessellateXY(incoming, xSteps, ySteps, xGrid, yGrid, 0, 0, 0, 0); } + /** * * @param incoming Hexagon (with flats such that Y total is flat to flat distance) From 7daeb3853218cc6eff878e7266f37e80a902518a Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Wed, 31 Jul 2024 14:31:10 -0400 Subject: [PATCH 07/10] removed duplicate method --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 988b5322..819d24c4 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2954,9 +2954,6 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt }; return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), offsets); } - public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { - return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); - } public static List tessellate(CSG incoming, int steps, double gridSpacing) { return tessellate(incoming, steps, steps, steps, gridSpacing, gridSpacing, gridSpacing, 0, 0, 0, 0, 0, 0, 0, 0, 0); } From 5eb0c0b51348b0c0909f0f10246d07397efc8602 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Wed, 31 Jul 2024 14:35:31 -0400 Subject: [PATCH 08/10] fixed hex to use tessxy --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 819d24c4..ef62bee4 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2983,7 +2983,7 @@ public static List tessellateXY(CSG incoming, int xSteps, int ySteps, doubl List tessellateHex(CSG incoming,int xSteps, int ySteps, double spacing){ double y= incoming.getTotalY()+spacing; double x =(((y/Math.sqrt(3))))*(3/2); - return tessellate(incoming,xSteps,ySteps,x,y,y/2); + return tessellateXY(incoming,xSteps,ySteps,x,y,0,0,0,y/2); } /** * From 8f688c97a61c80707d13dad36fdb144e308fcea3 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Wed, 31 Jul 2024 15:31:48 -0400 Subject: [PATCH 09/10] added custom doxygen to override methods --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 118 ++++++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index ef62bee4..4e9f2ca1 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2894,6 +2894,27 @@ public CSG syncProperties(CSG dying) { return this; } + /** + * Tessellates a given CSG object into a 3D grid with specified steps and grid spacing, including offsets for odd rows, columns, and layers. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param zSteps Number of steps (iterations) in the z-direction. + * @param xGrid Distance between iterations in the x-direction. + * @param yGrid Distance between iterations in the y-direction. + * @param zGrid Distance between iterations in the z-direction. + * @param oddRowXOffset X offset for odd rows. + * @param oddRowYOffset Y offset for odd rows. + * @param oddRowZOffset Z offset for odd rows. + * @param oddColXOffset X offset for odd columns. + * @param oddColYOffset Y offset for odd columns. + * @param oddColZOffset Z offset for odd columns. + * @param oddLayXOffset X offset for odd layers. + * @param oddLayYOffset Y offset for odd layers. + * @param oddLayZOffset Z offset for odd layers. + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { ArrayList back = new ArrayList(); for (int i = 0; i < xSteps; i++) { @@ -2928,6 +2949,20 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt } return back; } + + /** + * Tessellates a given CSG object into a 3D grid with specified steps, grid spacing, and a 3D array of offsets for odd rows, columns, and layers. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param zSteps Number of steps (iterations) in the z-direction. + * @param xGrid Distance between iterations in the x-direction. + * @param yGrid Distance between iterations in the y-direction. + * @param zGrid Distance between iterations in the z-direction. + * @param offsets 3D array of offsets for odd rows, columns, and layers. + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double[][] offsets) { double oddRowXOffset = offsets[0][0]; double oddRowYOffset = offsets[0][1]; @@ -2943,9 +2978,38 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt return tessellate(incoming, xSteps, ySteps, zSteps, xGrid, yGrid, zGrid, oddRowXOffset, oddRowYOffset, oddRowZOffset, oddColXOffset, oddColYOffset, oddColZOffset, oddLayXOffset, oddLayYOffset, oddLayZOffset); } + + /** + * Tessellates a given CSG object into a 3D grid with specified steps. The grid spacing is determined by the dimensions of the incoming CSG object. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param zSteps Number of steps (iterations) in the z-direction. + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps) { return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } + + /** + * Tessellates a given CSG object into a 3D grid with specified steps and offsets for odd rows, columns, and layers. The grid spacing is determined by the dimensions of the incoming CSG object. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param zSteps Number of steps (iterations) in the z-direction. + * @param oddRowXOffset X offset for odd rows. + * @param oddRowYOffset Y offset for odd rows. + * @param oddRowZOffset Z offset for odd rows. + * @param oddColXOffset X offset for odd columns. + * @param oddColYOffset Y offset for odd columns. + * @param oddColZOffset Z offset for odd columns. + * @param oddLayXOffset X offset for odd layers. + * @param oddLayYOffset Y offset for odd layers. + * @param oddLayZOffset Z offset for odd layers. + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset) { double[][] offsets = { {oddRowXOffset, oddRowYOffset, oddRowZOffset}, @@ -2954,24 +3018,76 @@ public static List tessellate(CSG incoming, int xSteps, int ySteps, int zSt }; return tessellate(incoming, xSteps, ySteps, zSteps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), offsets); } + + /** + * Tessellates a given CSG object into a 3D grid with specified steps and uniform grid spacing. + * + * @param incoming The CSG object to be tessellated. + * @param steps Number of steps (iterations) in each direction (x, y, z). + * @param gridSpacing Distance between iterations in all directions (x, y, z). + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int steps, double gridSpacing) { return tessellate(incoming, steps, steps, steps, gridSpacing, gridSpacing, gridSpacing, 0, 0, 0, 0, 0, 0, 0, 0, 0); } + + /** + * Tessellates a given CSG object into a 3D grid with specified steps. The grid spacing is determined by the dimensions of the incoming CSG object. + * + * @param incoming The CSG object to be tessellated. + * @param steps Number of steps (iterations) in each direction (x, y, z). + * @return A list of tessellated CSG objects. + */ public static List tessellate(CSG incoming, int steps) { return tessellate(incoming, steps, steps, steps, incoming.getTotalX(), incoming.getTotalY(), incoming.getTotalZ(), 0, 0, 0, 0, 0, 0, 0, 0, 0); } - + + /** + * Tessellates a given CSG object into a 2D grid with specified steps and grid spacing, including offsets for odd rows and columns. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param xGrid Distance between iterations in the x-direction. + * @param yGrid Distance between iterations in the y-direction. + * @param oddRowXOffset X offset for odd rows. + * @param oddRowYOffset Y offset for odd rows. + * @param oddColXOffset X offset for odd columns. + * @param oddColYOffset Y offset for odd columns. + * @return A list of tessellated CSG objects. + */ public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double oddRowXOffset, double oddRowYOffset, double oddColXOffset, double oddColYOffset) { return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, oddRowXOffset, oddRowYOffset, 0, oddColXOffset, oddColYOffset, 0, 0, 0, 0); } + + /** + * Tessellates a given CSG object into a 2D grid with specified steps. The grid spacing is determined by the dimensions of the incoming CSG object. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @return A list of tessellated CSG objects. + */ public static List tessellateXY(CSG incoming, int xSteps, int ySteps) { return tessellateXY(incoming, xSteps, ySteps, incoming.getTotalX(), incoming.getTotalY(), 0, 0, 0, 0); } + + /** + * Tessellates a given CSG object into a 2D grid with specified steps and grid spacing. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param xGrid Distance between iterations in the x-direction. + * @param yGrid Distance between iterations in the y-direction. + * @return A list of tessellated CSG objects. + */ public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid) { return tessellateXY(incoming, xSteps, ySteps, xGrid, yGrid, 0, 0, 0, 0); } + /** * * @param incoming Hexagon (with flats such that Y total is flat to flat distance) From 45c91ee3c20822978eb3b81a690b3b1af3aa4144 Mon Sep 17 00:00:00 2001 From: Jansen M Smith Date: Wed, 31 Jul 2024 15:36:53 -0400 Subject: [PATCH 10/10] added 2d offset matrix helper method to tessxy --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index 4e9f2ca1..0504da04 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -3059,6 +3059,26 @@ public static List tessellate(CSG incoming, int steps) { public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double oddRowXOffset, double oddRowYOffset, double oddColXOffset, double oddColYOffset) { return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, oddRowXOffset, oddRowYOffset, 0, oddColXOffset, oddColYOffset, 0, 0, 0, 0); } + + /** + * Tessellates a given CSG object into a 2D grid with specified steps, grid spacing, and a 2D array of offsets for odd rows and columns. + * + * @param incoming The CSG object to be tessellated. + * @param xSteps Number of steps (iterations) in the x-direction. + * @param ySteps Number of steps (iterations) in the y-direction. + * @param xGrid Distance between iterations in the x-direction. + * @param yGrid Distance between iterations in the y-direction. + * @param offsets 2D array of offsets for odd rows and columns. + * @return A list of tessellated CSG objects. + */ + public static List tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double[][] offsets) { + double oddRowXOffset = offsets[0][0]; + double oddRowYOffset = offsets[0][1]; + double oddColXOffset = offsets[1][0]; + double oddColYOffset = offsets[1][1]; + + return tessellate(incoming, xSteps, ySteps, 1, xGrid, yGrid, 0, oddRowXOffset, oddRowYOffset, 0, oddColXOffset, oddColYOffset, 0, 0, 0, 0); + } /** * Tessellates a given CSG object into a 2D grid with specified steps. The grid spacing is determined by the dimensions of the incoming CSG object.