Wishlist Colour faces by aspect
-
Hi
I've been looking at the plugin colorBySlope by Chris Fulmer and wonder if it's possible to add the ability to color faces by aspect (compass direction of a given face) (discussed in passing by TIG in http://forums.sketchucation.com/viewtopic.php?p=173331#p173331). To simplify things the color map could be constrained to 10 colours; one for each of the main compass points (arbitrary but simpler) North, N East, East, South East etc, plus one for land that was flat or within say 2% of being flat.
This would then enable surface analysis, such as stormwater flow, plant growth potential on various soil types (the better soil ends up at the bottom of the slope), frost heave potential... Is this possible? Additionally is it possible both in TINs and regular triangular meshes?
cheers
Nigel -
See http://forums.sketchucation.com/viewtopic.php?f=180&t=31448&p=277511&hilit=face+north#p277511 which discusses finding/listing faces by their orientation.
It rather assumed they are vertical walls... BUT you can also 'flatten' the face normal for 'slopes' as explained -
vector=face.normal flat_vector=vector.clone flat_vector.z=0
then get the angle between that and Y_AXIS [or 'model-north' if they differ]
angle=flat_vector.angle_between(YAXIS).radians
in degrees - just easier to get you head around than radians! ...
You then need a test for the rotations to the E or W from the face vector's x-value [see link]...
Then use an 'if/elsif/elsif...' test to see if the angle is within a range say for N we have >=(360.0-22.5) and <=22.5 for the 1/8 of the circle in the Northern 'quadrant'
Then you can assign colors to the faces as desired [8 for N/NE/E/SE/S/SW/W/NW + Flat = 9 - perhaps S=red,E=green,W=orange,N=blue with between colors of say SE=magenta,SW=yellow,NW=purple,NE=cyan and Flat=grey].
To test a face for near flatness use something like
flat=true if Z_AXIS.angle_between(face.normal)<=2.degrees
or whatever limiting angle you want... -
Hi Tig
Thanks for reply. Yes that looks promising, however I'm not remotely a programmer, so do you think someone may consider this an interesting/useful plugin - I'm sure many of the landscape folk would find this useful in a number of ways.
Also would it be possible for such a plugin to make each face a component and then each face-component could hold attributes (I think this is what you were alluding to in your post on colour by slope in viewtopic.php?f=323&t=20635) such as solar gain incidence, surface erodibility, soil type etc.
Sorry if this is a bit vague, but people are doing interesting things with SU and I don't know what's possible.
cheers
Advertisement