Grasshopper

algorithmic modeling for Rhino

Hello, I cant seem to get the same values of distance from a point that the Surface Closest Point component gets when using either :

double dist = 0;
for(int i = 0; i < surface.Count; i++){

Brep b = surface[i].ToBrep();
dist = point.DistanceTo(b.ClosestPoint(point));

}

A = dist;

////or 

double dist = 0;
for(int i = 0; i < surface.Count; i++){


double u;
double v;
surface[i].ClosestPoint(point, out u, out v);
dist = point.DistanceTo(surface[i].PointAt(u, v));

}

A = dist;

Views: 4121

Replies to This Discussion

Hi Brendon,

if you convert a brep or brepface to surface, you lose trimming information. Could that be what's happening here? (I'm in the middle of a meeting now so can't test in depth)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

thanks so much for replying promptly david,

I tried an untrimmed Surface, the first component uses the second bit of code, it doesn't convert to Brep..  It takes an untrimmed Surface:

double dist = 0;
for(int i = 0; i < surface.Count; i++){


double u;
double v;
surface[i].ClosestPoint(point, out u, out v);
dist = point.DistanceTo(surface[i].PointAt(u, v));

}

A = dist;

..  I am getting distances that are all over the place when compared with the standard component.

thanks again

Please post a file I can use to repeat this, I want to see the data in real time.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David,  

It is working on Orthogonal Surfaces but not irregular ones, so I suppose its not a bug.. I just seem to remember that in earlier versions this code worked fine.  I am getting numbers all over the place when I use Point3d.DistanceTo(Surface.PointAt(u,v));   Where as with your component it doesn't matter if the surf is orthogonal and aligned with the world

Attachments:

Well, the problem is that you're importing surfaces into the C# component. So your actual planar brep becomes untrimmed. Converting your surface back to a brep isn't going to retrim it.

I changed your input to a list of breps and rewrote the script a wee bit.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Hey david, its not working... 

i did the same, I am getting some weird stuff even then, i attached an image in which the top tag value is from the gH component, the bottom value is from Brep Closest point and distance..  I will send you the files   thanks

I suppose then this is merely a question of how I deal with irregular referenced surfaces ( it was shrunk)..  I tried to reparameterize it in the code.. didn't work .

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service