algorithmic modeling for Rhino
Hello,
I am trying to do the following but I am having some trouble:
I want to rotate a vector using a brep normal as the axis within a vb component, but I dont know how to do it using a closest point to that brep (Meaning I dont know the u,v coordinates).
I may have the approach completely wrong but this is how I was thinking of going about it.
How do I get the brepNormal at the tempPt?
tempPt = s1.ClosestPoint(P1)
myvec.Transform(transform.Rotation(angle, brepnormal, tempPt)
Thank you very much,
M
Tags:
Thanks Rajaa
That works perfectly. But I dont understand it. Do you mind if I ask you a few questions?
When you call the brep.closest point the values are:
1. the point to analyze
2. closest_pt (I am not sure what it does)
3. What is a component index and what is it doing?
4. s and t are doubles. but What are they doing?
6. The normal. First you dim the normal as a vector (does the .unset clear the default value?) Are you setting a new value to normal by placing it within the .closestpoint?
Sorry. But still learning.
Thanks,
M
Hi M,
Asking is the right thing to do to learn, please do not apologize for it :)
A Brep is basically a combination of trimmed surfaces stitched together. A closest point can be at any of the faces of that brep. So:
2- closest_pt is the point that is on the brep and happens to be closest to your test point (pt).
3- Component index is the index of the face or edge of that brep that the test point happens to be closest to.
4- s and t are the u and v coordinate of the surface that the test point is on.
6- A normal to a surface is a vector. I always initialize my values before passing them to a function.
This function takes few parameters. It uses some of them as input and assign new values to output parameters.
The input is the test point (pt), and the rest are outputs. That means if you check closest_pt, ci, s, t and normal after the function is executed, you'll see all of them have new values calculated inside the "brep.ClosestPoint(...)" including the "normal" which is what you need in this case.
Hope this is helpful.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by