Trying to find best way to calculate the normal direction of the vertex of a polyhedron. I know that when the polyhedron is a full sphere I can use the center and the vertex to get a good estimate. However I cannot figure it out once the polyhedron is for instance trimmed and stretched see image
I guess I am looking for the average of the 3 or 4 surfaces that connect to each vertex
I am trying to find the ânormalâ direction at the vertex, based on the surrounding faces, let me know if the below image helps ( the polyhedron is not spherical at this point )
Yes, itâs better than your first image. Even better would be to post the geometry. But there is no normal vector for vertices, only surfaces.
P.S. This might work; expression on âVâ input is â-xâ.
P.P.S. Hereâs a way to avoid the slider using shortest edge length. Expression on âRâ input is âx*0.8â (this is so much easier for everyone when you post code/geometry).
If youâre dealing with a mesh, instead of a polysurface, you can simply use the DeMesh (Deconstruct Mesh) component, which provides the normals through its N-output.
I was in the process of adding spheres to the vertices and then take the averages ⌠so this helps a lot Thanks !
Iâm here to learn and share, how about you?
I just discovered the polyhedron stuff under the âMeshâ tab, so built a test apparatus from it for the code I posted earlier:
I discovered that the method I used works only when the adjacent edges are evenly distributed, but there are solids where thatâs not the case and those ânormalâ vectors look off? Whatâs the correct way?
brep_vertex_normals_2022Oct16b.gh (32.2 KB)
UPDATE: I discovered that with some shapes it works better to insert a Boundary surface between Polyhedron and Join (Brep Join).
Standby⌠Rats! Unable to find the example where adding Boundary surface was necessary. Found a few cases though where GH/Rhino hangs!?
I vaguely recall installing something related to polyhedra and located this post from three years ago:
Referring to RhinoPolyhedra:
And this post in the same thread:
At the time, I had no luck trying to use it and believe it wasnât related to Grasshopper. Now Iâm wondering if anyone else can see the âMesh | Polyhedraâ tab and run the code in my previous post?
Is this a standard R7 GH feature? Or visible only to me?
I donât think so. I certainly donât see it in the latest service release. You can identify the .gha like so:
Thanks very much. I could swear it wasnât available in Grasshopper when I installed RhinoPolyhedra three years ago. Or maybe I never looked on the âMeshâ tab? Itâs a great feature, now that Iâve finally managed to use it in the post above:
@dale ?
Hi @Joseph_Oster,
Sorry, I havenât read the entire thread.
Is the question on how to calculate vertex normals? If so, Rhino does so by averaging face normals.
â Dale
Thanks, interesting. Averaging the faces adjacent to each vertex? @laurent_delrieu appears to be doing something similar in his post above, but it looks like addition instead of average of face normals?
My question was more about the RhinoPolyhedra plugin being available in Grasshopper. I donât recall that being the case 3+ years ago?
Iâve just created a GH model that displays ALL the polyhedra by branch in a grid. Very cool to see them. I think my favorite is the âRhombic Icosahedronâ which has 20 equal size diamond shaped faces. It is [index = 15] in category âOther Solidsâ [index = 17].
The red group is an on/off switch - it takes a couple minutes to run. By the way, as I mentioned yesterday, some shapes require a Boundary surface between Polyhedron and Join (Brep Join). Might indicate a subtle bug?
Hi @Joseph_Oster,
Yes, sorry for the confusion.
I donât recall exactly when GH support was added. But 3 years ago sounds about right.
You can see if you have the latest version using PlugInManager
.
Not all shapes generate solids. Perhaps this is what you are seeing?
Here is yet another sample:
test_polyhedron2.gh (7.3 KB)
â Dale
Not related to solids, no. In the GH file I posted above, in some cases Brep Join turns red with the following error if you skip Boundary and wire Polyhedron âCâ (Curves) directly. Adding Boundary prevents that.
What does âponderateâ mean? Based on Daleâs comment and your second solution, I modified my version â16bâ to use the unitized average of adjacent surface normals.
brep_vertex_normals_2022Oct17a.gh (26.7 KB)
Ponderate mean that instead of doing the sum of normals and then unitize this sum you multiply each face normal by face area then sum and then unitize.
It is a weighted mean.
This might be apropos of nothing, but still interesting?
The white vectors are as before (âthe unitized average of adjacent surface normalsâ), the black vectors (unitized) are obtained from the volume center point and each vertex. For 2 out of 22 vertices they are identical, where 5 faces meet on opposite sides of the polyhedron. For 20 out of 22 vertices they differ, though both look reasonable. All faces have the same area in this case.
brep_vertex_normals_2022Oct17b.gh (25.9 KB)