Parametric Shapes
Geometry defined by equations
Associative and Imperative Shape definition
1
u = 180/2..3*180/2..2;
2
v = 0..180*2..2;
3
x = ((3/2) + Math.Sin(u + (2 * v)<1>)) * (Math.Cos(v) + Math.Cos(2 * v)/10);
4
y = ((3/2) + Math.Sin(u + (2 * v)<1>)) * (Math.Sin(v) + Math.Sin(2 * v)/10);
5
z = Math.Sin(Math.RadiansToDegrees(Math.Sin(Math.RadiansToDegrees(Math.Cos(u + (2 * v)<1>)<1> + (Math.Cos(12 * u) / 12)))));
6
s = GeometryColor.ByGeometryColor(NurbsSurface.ByPoints(Point.ByCoordinates(x,y,z)),Color.ByARGB(150,255,150,100));
Copied!
1
geometry = [Imperative]
2
{
3
a = 0;
4
b = 0;
5
arrPoints = [];
6
for (v in 0..2*180..2)
7
{
8
for (u in (180/2)..(3*180/2)..2)
9
{
10
x = ((3/2) + Math.Sin(u+(2*v))) * (Math.Cos(v)+Math.Cos(2*v)/10);
11
y = ((3/2) + Math.Sin(u+(2*v))) * (Math.Sin(v)+Math.Sin(2*v)/10);
12
z = (Math.Sin(Math.RadiansToDegrees(Math.RadiansToDegrees(Math.Sin(Math.Cos(u+(2*v))+Math.Cos(12*u)/12)))));
13
arrPoints [a][b] = Point.ByCoordinates(x, y, z);
14
b = b + 1;
15
}
16
a = a + 1;
17
b = 0;
18
}
19
return List.Clean(NurbsCurve.ByPoints(arrPoints),false);
Copied!
https://pixabay.com/images/id-331944/
Hyperbolic Paraboloid
1
//Circular Grid of Points
2
p1 = Point.ByCoordinates(Math.Cos(0..360),Math.Sin(0..360));
3
p2 = p1.Translate((p1.AsVector())<1>,(-1..10)<2>);
4
5
//Equation
6
a = 5;
7
b = 8;
8
z1 = Math.Pow(p2.X,2)/Math.Pow(a,2)-Math.Pow(p2.Y,2)/Math.Pow(b,2);
9
10
//Surface
11
s1 = NurbsSurface.ByPoints(p2.Translate(Vector.ZAxis(),z1));
12
GeometryColor.ByGeometryColor(s1,Color.ByARGB(255,252,211,3));
Copied!
Mobius Strip
1
n = 10;
2
r = 20;
3
s = -n..n..#100;
4
t = 0..360..#100;
5
x = (r + (s<2> * Math.Cos(t/2)<1>)) * Math.Cos(t);
6
y = (r + (s<2> * Math.Cos(t/2)<1>)) * Math.Sin(t);
7
z = s<2> * Math.Sin(t/2)<1>;
8
points = Autodesk.Point.ByCoordinates(x,y,z);
9
Mobius = NurbsSurface.ByPoints(points)
Copied!
Hemisphere
1
//Parametric Hemisphere
2
r = 10;
3
b = 30;
4
c = 20;
5
u = 0..360..#b;
6
v = 0..r..#c;
7
x = Math.Sqrt(Math.Pow(r,2)<1>-Math.Pow(v<2>,2)<2>)*Math.Cos(u)<1>;
8
y = Math.Sqrt(Math.Pow(r,2)<1>-Math.Pow(v<2>,2)<2>)*Math.Sin(u)<1>;
9
z = v;
10
p = List.FirstItem(Autodesk.Point.ByCoordinates(x<1><2>,y<1><2>,z)<1>);
11
12
//Cross Bracing
13
dr = List.DiagonalRight(p,c);
14
pr = PolyCurve.ByPoints(List.FilterByBoolMask(dr,List.Count(dr<1>)>1)["in"],false);
15
dl = List.DiagonalLeft(p,c);
16
pl = PolyCurve.ByPoints(List.FilterByBoolMask(dl,List.Count(dl<1>)>1)["in"],false);
17
dh = List.UniqueItems(List.Transpose(p)<1>);
18
ph = PolyCurve.ByPoints(List.FilterByBoolMask(dh,List.Count(dh<1>)>1)["in"],false);
Copied!
Last modified 9mo ago
Copy link