algorithmic modeling for Rhino
I am preparing for a Introduction to Rhino Grasshopper exam that will take place next month. To prepare for this I am going through some tutorials and old exams. However, I got stuck on an old exam piece regarding a roof construction (sloped). This piece is about populating a surface with pyramid-shaped piped with height differences. The highest point is 5m and the lowest point is 1m. The top of this construction should be perpendicular to the surface.
I managed to populate surfaces with same repeated patterns (like flat triangles) but for this one I desperately need help. I tried to make the shape of the pipes with Brepcomponets and List items but somehow couldn' t get it populated on the surface.
The uploaded file is the start point of the assignment. Any feedback is much apreciated.
Ok, I could post and endpoint.gh, but since you're trying to prepare for an exam, I'll just explain my way.
You have a distance measure and the domain (min and max) of the possible values. Since those are your input values for the height, you need to remap them from the source domain to a target domain from 1 to 5. As you want the maximum height mapped to the minimum distance, you actually need to remap to "5 to 1".
Now you need to move the center points perpendicular to the surface. The normal vector of a surface is always perpendicular at the point. You can evaluate the surface to get those vectors. Problem is, evaluate needs a UV coordinate as input and you only have the 3D coordinates of the center points. Finding the closest point to a surface will return the CP in 3D space but fortunately also the UV coordinates along the surface.
All you need to do is connect the moved center points to the lines.
On a side note: All the surface components produce a lot of overhead. If the surface is flat or you can live with an approximation, you can get the normals from the corner points of the subsurface. Create two vectors across the diagonals and calculate the cross product. The resulting vector will be perpendicular to both input vectors... and take a lot less time and ressources to calculate ;)
Thanks for the walkthrough! Solved the whole assignment immediately lol. Haven't encountered the remapping function yet so your introduction to it was really helpfull!
Okay, so if you would want to impress your professor, here's the clever endpoint... well there are some that might not take lightly to showing them a more clever solution, so impress at your own risk ;)
The two vectors with the cross product is indeed way advanced for my course. However it is way faster as well. But since your method used and didn't change the given starting point, I believe i'm aloud to use it :)
Then try this method, it's fast and simpler. It won't calculate the normal at the exact exact centroid of each cell if the surface has really weird UVs but it should be good enough for 99.9% of cases.
It also gives you the center point directly so no need to use the computationally expensive area component.
Thanks for your time and feedback as well. I believe the people that grade me expect me to use the Area component (when given). It' s a nice method indeed that will come handy during my journey.
You can still use it to get the vector perpendicular to the cells.
True true :)
Actually, for any 4 point surface, the midpoint of a diagonal is an approximation of the center point. For flat surfaces, it will be exact.
But since the area center returns the center of gravity, this point will most likely be above or below the surface for any curved surace anyway.
If you are aiming for speed, avoid the function evaluator. For most cases, parsing the expression takes longer to solve than five or six individual math components. This is especially true for functions that are already implemented in a separate component, such as average. Even with this, Vicente's approach takes about twice as long as in the exam part than mine. ;) As always it's speed vs. accuracy.
No, mine is bigger! er... I mean... faster!
If you take into account the time it takes to think about shaving off a few unnoticeable ms by not using the expression component mine is faster :D
He was complaining about complexity, not speed.
The method I posted was simpler than the one you suggested and still fast (no noticeable difference). With the added benefit that you can ignore the area component if you want making it even simpler (and also faster).