Weave
Image based weave pattern
weave1.zip
3KB
Binary
ver 2.7
1
2
//Sample Surface
3
sr = Surface.ByLoft([NurbsCurve.ByPoints(Point.ByCoordinates
4
(-50,[0,12,1,3],[0,25,50,75])),NurbsCurve.ByPoints
5
(Point.ByCoordinates(50,[0,-8,1,4],[0,30,62,75]))]);
6
7
//Image repetition
8
n = 7;
9
10
//Replicating brightness data
11
b1 = Math.Floor(Color.Brightness(Image.Pixels(img,8,8)));
12
b2 = List.Flatten(List.OfRepeatedItem(List.Flatten
13
(List.OfRepeatedItem(b1<1>,n)<1>,-1),n),1);
14
15
// Parameters on surface
16
c = 0..1..# (8*n);
17
18
//Shifting points by brightness normal to surface
19
p1 = Surface.PointAtParameter(sr,c<1>,c<2>);
20
v1 = Surface.NormalAtPoint(sr,p1);
21
v2 = v1.Scale(b2==0?-1:b2);
22
v3 = List.Transpose(v1).Scale(b2==0?1:-1);
23
p2 = p1.Add(v2);
24
p3 = List.Transpose(p1).Add(v3);
25
26
//Loft based on curve connecting points
27
n1 = List.Flatten(NurbsCurve.ByPoints([p2,p3]),-1);
28
n2 = Circle.ByPlaneRadius(n1<1>.PlaneAtParameter(0..1..#60)<2>,0.25);
29
n3 = Solid.ByLoft(n2,n1);
Copied!
weave2.zip
4KB
Binary
ver 2.7
weave.zip
10KB
Binary
ver 2.7
Last modified 1yr ago
Copy link