-
0
1
1
- 634174918719370000
-
0
7
45
- true
- true
- 76a618a0-1c2b-4fc7-a854-e71cb50edee0
-
100;150;0;0
-
100;0;120;0
- Shaded
- wetgrid_togo.ghx
- 634174897304280000
- 0
-
197
176
- 1
- 0
- 5
- d5967b9f-e8ee-436b-a8ad-29fdcecf32d5
- Curve
- Curve
- always reparam
- Represents a collection of 3D Curves
- 0889baa3-e059-44f0-81c8-0dcc74196dbe
- false
- true
- true
- 0
- 2
- true
-
100
80
96
20
-
100
80
96
20
-
148.4719
90.87751
- false
- 35b5cbd3-389e-47fc-b364-e3acfc5568c9
- -1
- 48951280-c723-4088-af43-5369f8c0d4ce
- -1
- f5e3456b-dcfc-4faa-ac4e-7804cb75ee6d
- C# Script
-
// © Dimitrie Stefanescu, 2010
// Free for non-commercial use.
// http://improved.ro/blog/
int i,j,k,l;
pointarr = new List<List<Point3d>>();
List<List<Point3d>> pointarrF = new List<List<Point3d>>();
List<NurbsCurve> c = new List<NurbsCurve>();
//create the lists of lists
for(i = 0;i < crv.Count;i++)
{
List<Point3d> pts = new List<Point3d>();
double crvlen = crv[i].GetLength();
double stepper = 1 / System.Math.Floor(crvlen * det);
double jj;
for(jj = 0;jj <= 1;jj += stepper)
{
Point3d temp;
temp = crv[i].PointAt(jj);
pts.Add(temp);
}
pointarr.Add(pts);
}
//cycle through all lists
for(i = 0;i < pointarr.Count;i++)
{
//find closest point for each points exepting start [0] and end [count-1]
//add them to the new, improved list
List<Point3d> crvpts = pointarr[i];
List<Point3d> sublist = new List<Point3d>();
sublist.Add(crvpts[0]);
for(j = 1;j < crvpts.Count - 1;j++)
{
//search in all other lists except current list at [i]
//move both points and flag them as moved so as to optimize a little
//always exclude start points - those ar fixed!
double min = 9999999;
int ad1, ad2;
ad1 = ad2 = -55;
for(k = 0;k < pointarr.Count;k++)
if(k != i)
{
List<Point3d> templist = pointarr[k];
for(l = 1;l < templist.Count - 1;l++)
if(crvpts[j].DistanceTo(templist[l]) < min)
{
min = crvpts[j].DistanceTo(templist[l]);
ad1 = k;
ad2 = l;
}
}
//we should now have the address of the closest point to the one we are searching
//proceed to interpolate between
//first point address is [i,j], second point address is [ad1, ad2]
//based on distance (min) and a factor we will supply via a slidah'
Point3d p01, p02;
p01 = p02 = new Point3d(0, 0, 0);
double interpfactor = System.Math.Min(inp / (min * min), 0.5);
p01.Interpolate(getPointAt(i, j), getPointAt(ad1, ad2), interpfactor);
sublist.Add(p01);
}
sublist.Add(crvpts[crvpts.Count - 1]);
pointarrF.Add(sublist);
}
for(i = 0;i < pointarrF.Count;i++)
{
List<Point3d> crvpts = pointarrF[i];
Rhino.Collections.Point3dList pointss = new Rhino.Collections.Point3dList(crvpts.Count);
for(j = 0;j < crvpts.Count;j++)
{
pointss.Add(crvpts[j]);
}
Rhino.Geometry.NurbsCurve nc = Rhino.Geometry.NurbsCurve.Create(false, 3, pointss);
c.Add(nc);
}
crvs = c;
- public List<List<Point3d>> pointarr;
public Point3d getPointAt(int ad1, int ad2)
{
List<Point3d> t = pointarr[ad1]; return t[ad2];
}
- 0
- C# Script
- wetgrid^2
- A C#.NET scriptable component
- ac89f563-8dea-4325-9abf-9a903758a769
- false
- true
- true
- longest_list
-
238
74
83
79
-
265
76
24
75
-
277
114
- false
- 3
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable crv
- Script Variable crv
- 1
- true
- true
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable det
- Script Variable det
- true
- true
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable inp
- Script Variable inp
- true
- true
- 3
- 3ede854e-c753-40eb-84cb-b48008f14fd4
- Output
- Print, Reflect and Error streams
- true
- false
- 8ec86459-bf01-4409-baee-174d0d2b13d0
- Result pts
- Output parameter pts
- true
- false
- 8ec86459-bf01-4409-baee-174d0d2b13d0
- Result crvs
- Output parameter crvs
- true
- false
- Variable crv
- crv
- Script Variable crv
- 2859ad33-9dd6-4f0d-aca4-70fb9ed8049d
- false
- true
- true
- 1
- 1
- 0889baa3-e059-44f0-81c8-0dcc74196dbe
- 9ba89ec2-5315-435f-a621-b66c5fa2f301
- true
- true
-
240
76
25
25
-
240
76
25
25
-
252.5
88.5
- false
- Variable det
- det
- Script Variable det
- 0ee4b491-2a0f-4d66-9748-dea81ac4b05a
- false
- true
- true
- 1
- 650083d4-059b-47b2-be68-f96d571d218f
- 19ff81a2-dc4f-4035-8de9-26224c561321
- true
- true
-
240
101
25
25
-
240
101
25
25
-
252.5
113.5
- false
- Variable inp
- inp
- Script Variable inp
- 01f10f47-9afc-440a-ab96-6fb6606eee62
- false
- true
- true
- 1
- 657a1363-044d-4276-8f63-a11e8d8f887f
- 19ff81a2-dc4f-4035-8de9-26224c561321
- true
- true
-
240
126
25
25
-
240
126
25
25
-
252.5
138.5
- false
- Output
- out
- Print, Reflect and Error streams
- fbdb1b31-0741-42c0-8f21-78062fe90101
- false
- true
- true
- 0
-
289
76
30
25
-
289
76
30
25
-
304
88.5
- false
- Result pts
- pts
- Output parameter pts
- 9ee19c3a-4e93-46ac-8447-90b6b825303d
- true
- true
- true
- 0
-
289
101
30
25
-
289
101
30
25
-
304
113.5
- false
- Result crvs
- crvs
- Output parameter crvs
- a0cf7504-5613-4761-8a39-de67be8dbaab
- true
- true
- true
- 0
-
289
126
30
25
-
289
126
30
25
-
304
138.5
- false
- 57da07bd-ecab-415d-9d86-af36d7073abc
- Number Slider
- Number Slider
- Slider
- Numeric slider for single values
- 650083d4-059b-47b2-be68-f96d571d218f
- false
- true
- true
- 0
-
54
105
142
20
-
54
105
42
20
-
54.02701
105.6116
- false
- 1.8824996948242188
- 0
- 2.5
- 3
- 0
- 57da07bd-ecab-415d-9d86-af36d7073abc
- Number Slider
- Number Slider
- Slider
- Numeric slider for single values
- 657a1363-044d-4276-8f63-a11e8d8f887f
- false
- true
- true
- 0
-
55
127
142
20
-
55
127
42
20
-
55.40599
127.067
- false
- 26.849994659423825
- 0
- 100
- 5
- 0
- d5967b9f-e8ee-436b-a8ad-29fdcecf32d5
- Curve
- Curve
- Crv
- Represents a collection of 3D Curves
- baa817e6-2bdf-4e90-a156-170ae30897ae
- true
- true
- true
- 1
- a0cf7504-5613-4761-8a39-de67be8dbaab
- true
-
350
127
60
20
-
350
127
60
20
-
380.0584
137.8338
- false