Testing Waters
Search
K
Comment on page

# Hexagonal Grid

//Hexagon Points Grid
s = 1;
a = s/(2*Math.Tan(30));
p1 = Point.ByCoordinates((0..#15..s*3)<1>,(0..#25..a*2)<2>);
p2 = List.Flatten(p1<1>.Translate([0,s*1.5]<2>,[0,a]<2>,0),1);
d1 = (15*s*3)/((Math.Pow(p3.DistanceTo(Point.ByCoordinates(15*s*3/2,25*a*2/2)),0.75))+0.2);
p4 = Polygon.ByPoints(p3.Translate(Vector.ZAxis(),-d1+35));
//Hexagon Points Grid
s = 10;
a = s/(2*Math.Tan(30));
p1 = Point.ByCoordinates((0..#15..s*3)<1>,(0..#25..a*2)<2>);
p2 = List.Flatten(p1<1>.Translate([0,s*1.5]<2>,[0,a]<2>,0),1);
p4 = p3.Points;
//Attractor 1
v1 = Vector.ByTwoPoints(p3,a1);
v2 = v1.Scale(2/Math.Pow(v1.Length,0.25));
p5 = p4.Translate(v2);
//Attractor 2
v3 = Vector.ByTwoPoints(p4,a2);
v4 = v3.Scale(2/Math.Pow(v3.Length,0.25));
p6 = p5.Translate(v4);

#### Hexagonal Grid on Surface

//Square Dimensions
wdt1 = 5000;
uDv1 = 15;
vDv1 = 20;
//Surface
srf1 = Surface.ByPatch(Rectangle.ByWidthLength(wdt1,wdt1));
rem1 = Math.DivRem(uDv1,3);
uDv2 = rem1==2?uDv1+1:uDv1+2;
uDv3 = rem1==3?uDv1:uDv2;
pt01 = srf1.PointAtParameter((0..1..#uDv3)<1>,(0..1..#vDv1)<2>);
pt02 = List.TakeEveryNthItem(List.TakeEveryNthItem(pt01<1>,4,-2),2,1);
pt03 = List.TakeEveryNthItem(List.TakeEveryNthItem(pt01<1>,4,-1),2,1);
pt04 = List.TakeEveryNthItem(List.TakeEveryNthItem(pt01<1>,4,-3),2,0);
pt05 = List.TakeEveryNthItem(List.TakeEveryNthItem(pt01<1>,4,0),2,0);
//Polygons
pt11 = [List.DropItems(pt02,-1),
List.DropItems(pt03,-1),pt05,
List.DropItems(pt03,1),
List.DropItems(pt02,1),pt04];
pt12 = List.Transpose(List.Transpose(pt11)<1>);
pt13 = [List.DropItems(List.DropItems(pt05<1>,-1),-1),
List.DropItems(List.DropItems(pt04<1>,1),-1),
List.DropItems(List.DropItems(List.DropItems(pt02<1>,1),1),-1),
List.DropItems(List.DropItems(pt04<1>,1),1),
List.DropItems(List.DropItems(pt05<1>,-1),1),
List.DropItems(List.DropItems(List.DropItems(pt03<1>,-1),1),-1)];
pt14 = List.Transpose(List.Transpose(pt13)<1>);
pg11 = Polygon.ByPoints([pt12,pt14]);];
//Surface
srf1 = Surface.ByRevolve(NurbsCurve.ByPoints(Point.ByCoordinates
([20,18,18,22,22],0,[0,2,5,10,15])),Point.Origin(),Vector.ZAxis(),0,-180);
uDv1 = 25;
vDv1 = 52;
hexagon_on_surface.dyn
29KB
Text