Quantcast
Channel: Grasshopper Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 3662

C#_Multiple attractor points

$
0
0

@obhagwat29 wrote:

Hello,
I have a pattern which is responding to the point. I want to add more points so that pattern would respond to those multiple points. I could do that may be closest point component in grasshopper but how do I do that in c#?
find attached file pictures!

Any help would be great!

// finding distance between grid point to the attractor point
List<double> dist = new List<double>();

for(int i = 0; i < Grid.Count; i++)
{
  double d1 = x.DistanceTo(Grid[i]);
  dist.Add(d1);
}

// Remap Value formula = (value - from source)/(to source - from source)*(toTarget-fromTarget)+from target
List<double> tVal = new List<double>();
foreach(double d in dist)
{
  double dT = (d - dist.Min()) / (dist.Max() - dist.Min()) * (0.9 - 0) + 0;
  tVal.Add(dT);
}

pattern

06_Islamic Pattern.gh (10.4 KB)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 3662

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>