Grasshopper

algorithmic modeling for Rhino

Hello guys, I am going mad here so i would be happy with any advice.

I have a big and uncontrollable mesh (39000 faces) which represents the topography of my city. I have tried to convert it in a surface or brep... but i didn´t get it.

What i want is to cull the faces which are not from the topography... that triangles which go down...  What should i do? How can i select, for examples, the faces which have a determined slope? Or select the points which have more than a determined Z coordenate and remake the mesh/surface?

Regards

Daniel Domenech

Views: 993

Attachments:

Reply to This

Replies to This Discussion

Well ...

... for a mesh massacre based on slope (mesh face normals) see attached. I'll add later various other ways (points et all) to kill properly a mesh.

NOTE: Daniel's MeshMachine is used in order to control the demo mesh "density" (but you can provide any mesh in fact).

BTW: do you want a small C# that reduces a mesh?

Attachments:

Guaaau, that's great. The killing was in order. Now its populations of faces is 30000, 9000 less. 

Ok, i have installed Plankton, it seems and interesting add-on

How it is that C# maybe it is interesting?

P.S: Massacre at Mesh Fall, is not the titel of the new Fargo Season?

Attachments:

Hmm ... appears that you have a "solid" as a mesh not just a "surface" (the "vertical" parts) - that said I confess that I never exploited your file (30K faces makes me nervous, he he).

Anyway get the massacre MK2 (reduce mesh)  C# that maybe has more sense in your case.

The very same test surface is used (Load R file first): notice the PlanA (reduce) and PlanB (MeshMachine).

Moral: massacre (kill first then ask questions)

Attachments:

Added another massacre option (maybe not suitable for this case ... but since I hate meshes killing some is always a pleasure, he he).

Note: same test brep is used as in the first massacre def

Attachments:

I'm agree, it is a pleasure to kill mesh

Very useful tools, thank you for your time Lord Fotiadis

NOTE: the attached sample definition can take a few seconds to compute with the provided mesh.

Here are some steps that use native GH components.  The description is a bit lengthy...sorry.  I got carried away on lunch break...

1 - Clean up the mesh a bit:  Lots of ways to do this, but as a rule of thumb, it's probably best to clean the mesh as best you can before bringing into GH.  But, for the sake of example...a basic method is comparing the normal of a face to a Z Vector, and if the comparison results in a match, within some tolerance...then you can get rid of it.  When dealing with topography and slope, the common unit of measure is generally percent, but to start with, we can use degrees.

2 - Evaluate MeshFaceNormals: similar to step 1, you are simply getting the normal vector of a face, and comparing it to a Z vector.  The important thing to note is that the Vector Compare component outputs radians.  At this point, you need to either convert to degrees again, OR, do some math and convert to percent.  

3 - Set Slope Zones and Ranges : There are a few ways to do this, but I think this is one of the most straight forward methods.  Set your "slope zones", create some consecutive domains from those numbers, then just find the values that fit into those domains, (you have the values from step 2, so you can pump those into the N input of the Find Domain component.)

4 - Color Mesh by Slope Value : the gradient component is setting colors based on your slope range domains.  Because you have input a list of domains, (0 to 10, 10 to 20 , 20 to 25, 25 to 40, and 40 to 60), the Find Domain component is actually just putting the slope values into the corresponding range, and then outputting the index number of the slope domain, (0,1,2,3,4).  The gradient component then maps those 5 numbers, (0-4.....which is actually 5 numbers because list counts start, and include, 0), to 5 colors.

4a - NOTE: The gradient component needs a Lower limit, and Upper Limit.  In this case we start the lower limit at 0, (index of first slope range...0 to 10).  The upper limit is the index of the LAST item in the Slope Zone/Range list, which is 4.  I used a list length component to get the length of the below list, (which correctly returns 5 items....but I need the index of the last one, so the expression subtracts 1 from the length total).


0. 0.0 To 10.0
1. 10.0 To 20.0
2. 20.0 To 25.0
3. 25.0 To 40.0
4. 40.0 To 60.0

Then construct the mesh again using the cleaned vertices and faces from step 2, only adding in the new colors.

The last bit of the definition is just visualizing the slope value on the face...it's kind of overkill, but shown as an example.

Attachments:

Thank you   This is really nice and work perfectly! Thank for your time, Chris

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service