algorithmic modeling for Rhino
I've been trying to develop a program that would compare each mesh face (using a quad mesh) with all of the faces adjacent to it and highlight or color code the mesh edge between them based on the angle between the faces' normals. I want to look at an entire mesh and see where the "discontinuity" of the mesh is greatest and least.
The purpose of this is to analyze a mesh which has been relaxed over various objects to help users determine the locations of seams and darts in order to minimize strain when flattening the mesh. I believe that adjacent mesh faces with higher angular differences, or sharp points in the mesh, will be the ideal locations for seams and darts.
The approach I've taken is to find the mesh faces adjacent to each face using wbAdjacentFaces. This creates a list/tree from which I can measure the difference between the face normals for each face and its neighboring faces. That's about as far as I got.
Any ideas?
Tags:
Vicente, EXCELLENT! It's similar to what I'm looking for. I'm actually looking to color map the edges of the faces, but something like this might work just as well. It's really just a tool to help the designer choose seam lines and dart locations so as to minimize strain when I flatten the mesh.
I'm also hoping to develop a mesh flattening algorithm, with the ability to break the mesh or add slits where I choose to minimize strain, but I'm wondering if this is something best left up to some of the software packages already available for Rhino.
I tried both of these this morning and get the error:
"Index was outside the bounds of the array. (Line 0)"
I updated to version .0072 but it still won't run correctly. Any ideas?
I think there's a problem when internalizing the mesh. Try creating yourself a mesh and referencing it.
It happens when a mesh doesn't have its face normals computed. You can either use the rhino command _rebuildmesh to fix the mesh or add the line:
m.FaceNormals.ComputeFaceNormals();
to the beginning of the script.
I can't seem to make it run correctly by using either of these methods. I've attached the file I'm working on. It's an open mesh, I don't know if that matters or not.
As I said on the first post, the script only worked if all edges share two faces. I was assuming you had a closed mesh. The following code will check if you have naked or non-manifold edges and assign them an angle of 0.
List<double> angles = new List<double>();
List<Line> edges = new List<Line>();m.FaceNormals.ComputeFaceNormals();
for (int i = 0;i < m.TopologyEdges.Count;i++) {
double angle = 0;
int[] faces = m.TopologyEdges.GetConnectedFaces(i);
if (faces.Length == 2)
angle = Math.Acos(m.FaceNormals[faces[0]].X * m.FaceNormals[faces[1]].X + m.FaceNormals[faces[0]].Y * m.FaceNormals[faces[1]].Y + m.FaceNormals[faces[0]].Z * m.FaceNormals[faces[1]].Z);angles.Add(angle);
edges.Add(m.TopologyEdges.EdgeLine(i));
}
A = angles;
B = edges;
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by