From 70c3c23f339dd5fd81d3a08fba4252a393862f7d Mon Sep 17 00:00:00 2001 From: Kevin harrington Date: Tue, 30 Jul 2024 17:09:53 -0400 Subject: [PATCH] Adding tessalation for Adam --- src/main/java/eu/mihosoft/vrl/v3d/CSG.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java index a6c94bf4..5838b97f 100644 --- a/src/main/java/eu/mihosoft/vrl/v3d/CSG.java +++ b/src/main/java/eu/mihosoft/vrl/v3d/CSG.java @@ -2893,4 +2893,46 @@ 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){ + ArrayList back = new ArrayList(); + for(int i=0;i tesselate(CSG incoming,int xSteps, int ySteps, double oddRowYOffset){ + return tesselate(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 tesselate(CSG incoming,int steps){ + return tesselate(incoming,steps,steps,incoming.getTotalX(),incoming.getTotalY(),0); + } + /** + * + * @param incoming Hexagon (with flats such that Y total is flat to flat distance) + * @param xSteps number of steps in X + * @param ySteps number of steps in Y + * @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){ + double y= incoming.getTotalY()+spacing; + double x =(((y/Math.sqrt(3))))*(3/2); + return tesselate(incoming,xSteps,ySteps,x,y,y/2); + } + /** + * + * @param incoming Hexagon (with flats such that Y total is flat to flat distance) + * @param xSteps number of steps in X + * @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); + } }