How can I calculate the farthest point from the edge of a sphere to the edge of a intersecting brep? Anyone have any idea of how to go about this?
consider the center of the sphere as point C
find the distance between that point and the axis-line of the pipe, D
the max distance between the farthest point on the sphere and the pipe is:
D + SphereRadius - PipeRadius
Are the Sphere seams (“edge”) always perpendicular to the cylinder center?
If not, then one have to find all seams and measure “Closest Point” from the Sphere seam’s midpoint.
If you can use Grasshopper, here’s a solution which measures both
- Sphere-Seam-MidPt-to-Cylinder-Seam, and
- Sphere-Seam-MidPt to Cylinder-Surface:
Distance Sphere Edge to Cylinder Edge.gh (513.3 KB)
… before putting time into this, you need more than sphere+pipe?
If it’s just sphere+pipe do like inno said: draw a vector from the center of the sphere to the axis of the pipe, flip the vector, set its amplitude to be the same of the sphere radius, and use the resulting vector to move the center of the sphere.
For a generic brep cutting a sphere, the farthest point from the edge on the sphere needs a more complex method.
You are looking for linear distance or geodesic distance?
@maje90 I think I am looking for linear distance. I am not sure yet but I am trying to develop a script that will adjust the center point of each sphere such that it will not intersect with the cylinder or an other Brep I assign. I was thinking about finding the linear distance from cylinder surface to the top of any protruding dome. Then using that curve (in blue) as a vector to move it back into the cylinder. Do you guys think thats a good way to think about the problem ? I am not too good at distance logic stuff, this was the only way that made sense in my head. @RIL Thanks for this I will check it out now !
“it” , you mean the center or the sphere?
Also, if you are not sure, we can’t be anything more!
For how it is generic for now, there are many ways to solve this…
Maybe it’s better if you describe the background problem/situation.
Yeah sorry about that, Im still learning grasshopper, been using rhino for a while but never this side of things. What I would like to do is create a proximity system where no brep can come within a certain distance from another brep. In this case I created a cylinder and intentionally set up a couple spheres that would intersect with the cylinder. Then I wanted to create a new set of points taking into account the proper distances and direction. Hope that gives you some background ! Thanks for reading !
Ok Ill check it out ! Thanks !
The OP doesn’t seem to ask about how to move anything, but instead asking for the farthest point.
- farthest point
- from the edge of a sphere
- to the edge of a intersecting brep
To achieve this one needs to know if the Sphere seams are “perpendicular” to the cylinder axis (or the “rotation” of the sphere), and if they are not, one can’t use only the sphere center + cylinder center to figure this (point) out.
See my example (which has rotated spheres with the seam directed in arbitrary directions (not aligned with the cylinder axis).
Im checking it out now thanks !
This actually worked pretty well ! I was able to move the spheres into the cylinder based on the curves developed by brep closest point and the projected point. Only problem now is the sphere can only move the length of the radius of the cylinder.
I don’t understand the problem and what you want exactly.
A video or a file will be better
So the goal was to
- move the spheres. That was not specified in the OP.
- Movement not related to the edges of the sphere - which was specified.
- Movement not related to the edges of the cylinder - which was specified.
Two out of three goals was wrong. And the third goal wasn’t in the post. 3 out of 3 was misleading.
Not so cool.
@RIL Sorry about that, Ill try to clarify better next time. Again I am still a beginner and the concepts and terminology are still very new to me. I didnt mean to frustrate anyone I was just looking for some guidance.
Hope you guys have a good day, thanks for the input.