Staggered Checkerboard
Pattern of Small and Large Squares
Last updated
Pattern of Small and Large Squares
Last updated
bdr = Rectangle.ByWidthLength(50,50).Translate(25,25,0);
s1 = 5;
s2 = 1;
n1 = 12;
n2 = 12;
//Boundary
bdr1 = bdr.Offset(s1/2.1).Length>bdr.Offset(-s1/2.1).Length?bdr.Offset(s1/2.1):bdr.Offset(-s1/2.1);
bdr11 = Polygon.ByPoints(bdr1.Explode().StartPoint);
//Large Squares
pnt11 = Point.ByCoordinates((0..#n1*2..s1),(s2..n1*2));
pnt12 = pnt11.Translate(s1/2,s1/2,0);
pnt13 = pnt12<1>.Translate(0..(-s2*n2),0..(s1-s2)*n2..s1,0);
pnt14 = pnt12<1>.Translate(s2..(s2*n2),-s1..(s1-s2)*-n2..-s1,0);
pnt15 = List.Flatten([pnt13,pnt14],-1);
msk15 = bdr11.ContainmentTest(pnt15);
pnt16 = List.FilterByBoolMask(pnt15,msk15)["in"];
pln16 = Plane.ByOriginNormal(pnt16,Vector.ZAxis());
rec16 = Rectangle.ByWidthLength(pln16,s1,s1);
srf16 = (rec16.Patch()).Intersect(bdr.Patch());
bdr16 = srf16.PerimeterCurves();
srf17 = GeometryColor.ByGeometryColor(srf16,Color.ByARGB(255,255,228,181));
//Small Squares
pnt21 = Point.ByCoordinates((0..#n1*2..s1),(0..n1*2-1));
pnt22 = pnt21.Translate(s2/2,s2/2,0);
pnt23 = pnt22<1>.Translate(0..(-s2*n2),0..(s1-s2)*n2..s1,0);
pnt24 = pnt22<1>.Translate(s2..(s2*n2),-s1..(s1-s2)*-n2..-s1,0);
pnt25 = List.Flatten([pnt23,pnt24],-1);
msk25 = bdr.ContainmentTest(pnt25);
pnt26 = List.FilterByBoolMask(pnt25,msk25)["in"];
pln26 = Plane.ByOriginNormal(pnt26,Vector.ZAxis());
rec26 = Rectangle.ByWidthLength(pln26,s2,s2);
srf26 = (rec26.Patch()).Intersect(bdr.Patch());
bdr26 = srf26.PerimeterCurves();
srf27 = GeometryColor.ByGeometryColor(srf26,Color.ByARGB(255,0,0,255));
srfs = [srf17,srf27];
bdrs = [bdr16,bdr26];
[srfs, bdrs];