Gyroid
Last updated
Last updated
l = 10;
o = 3;
n = 3;
p = Point.ByCoordinates([0,l/2,l,l,l,l-o,l,l/2,0,0,0,o,0,l/2,l/2,l/2,l-o,o,l-o,o],[l,l,l,l-o,l,l/2,0,0,0,o,0,l/2,l,l/2,l-o,o,l-o,o,l/2,l/2],[0,o,0,l/2,l,l,l,l-o,l,l/2,0,0,0,l/2,o,l-o,l/2,l/2,l-o,o]);
a = Arc.ByThreePoints(p[[0..10..2]],p[[1..11..2]],p[[2..12..2]]).SplitByParameter(0.5)[0];
b = Arc.ByThreePoints(p[[1,13,3,13,5,13]],p[14..19],p[[13,7,13,9,13,11]]);
m1 = PolySurface.ByJoinedSurfaces(PolyCurve.ByJoinedCurves([[a[5][1],a[0][0],b[0],b[5]],[a[0][1],a[1][0],b[2],b[0]],[a[1][1],a[2][0],b[4],b[2]],[a[2][1],a[3][0],b[4],b[1]],[a[3][1],a[4][0],b[3],b[1]],[a[4][1],a[5][0],b[5],b[3]]]).Patch());
m2 = PolySurface.ByJoinedSurfaces(List.Flatten([m1,m1.Rotate(Point.Origin(),Vector.ZAxis(),-180).Translate(l,2*l,0)],-1));
m3 = PolySurface.ByJoinedSurfaces(List.Flatten([m2,m2.Mirror(Plane.XY()).Mirror(Plane.YZ()).Translate(0,0,l)],-1));
m4 = PolySurface.ByJoinedSurfaces(List.Flatten([m3,m3.Mirror(Plane.XY()).Rotate(Point.Origin(),Vector.ZAxis(),180).Translate(0,2*l,2*l)],-1));
m5 = PolySurface.ByJoinedSurfaces(List.Flatten(m4.Translate((0..#n..2*l)<1>,(0..#n..2*l)<2>,(0..#n..2*l)<3>),-1));
[Imperative]
{
n = 360;
i = 0.02;
px = [];
py = [];
pz = [];
x = 0;
c = 0;
while (x<n)
{
y = 0;
while(y<n)
{
z = 0;
while(z<n)
{
b = (Math.Sin(x)*Math.Cos(y))
+ (Math.Sin(y)*Math.Cos(z))
+ (Math.Sin(z)*Math.Cos(x));
if (Math.Round(b,3) == 0)
{
px[c] = x;
py[c] = y;
pz[c] = z;
c = c + 1;
}
z = z + i;
}
y = y + i;
}
x = x + i;
}
return = Point.ByCoordinates(px,py,pz);
};