(Un)intentions
I have been working on and off for a week now to modify the Rhinoscript (from last week) that arranges an object on a surface, but aligns a vector determined by the user to the surface normal at the insertion point. This is proving to be more difficult that I thought, although admittedly, I spent a couple hours relearning Linear Algebra from my undergraduate text book (see course materials). One of my personal struggles throughout this process has been that when programming, I am probably too concerned with the efficiency of my code, rather than just getting the task done. If it can be solved in a 5 line recursive algorithm or 20 lines of sloppiness, I always opt for the later even when its more confusing. Probably to my detriment….I’m remembering a quote I saw online said by one geek who said “My code is so clean, I don’t shower”. Even if this was true I would still have to shower, so there are no proclamations here, just an appreciation.
Here is where I am. The algorithm computes (and can draw) the normal vector from a surface point. That part was easy. Now I am trying to find the best way to align the objects “normal” vector with the surface vector. I origionally thought this could be done with the TransformObject function using a transformation matrix which would be nice (and clean, hence the linear algebra). This is rather redundant however, because to compute the transformation matrix for rotation about an arbitrary matrix, I would need to compute the angle using the mysterious “Angle2″ function for the desired rotation, and the rotation axis (simply the crossproduct of the two vectors)…and if I do all of that I might as well just use the RotateObject function and specify the crossproduct for a rotation axis instead of computing a complicated transformation matrix. This works….but not with the intended results, and actually uncovered an issue I had not considered: Depending on the severity of the curve, does the normal vector computation flip? ie. Would the object appear on the other side of the curve?
To be continued….