Thanks TIG, thanks Julia,
I think TIG’s “vector1.angle_between(vector2)” is in the direction that I was asking about. I’ve used “angle_between”, but I hadn’t really grasped “cross” as being perpendicular to the plane defined by the two you’re crossing and had not thought of using that as a rotation axis. Instead I was trying to do something that just stayed in the defined plane. I think I will have a need for “cross” in just a couple of further steps in this project.
At this point I think Julia’s “Geom.linear_combination(0.5, first_vector, 0.5, second_vector)” is the elegant solution that I didn’t even know to ask about. It appears to get me there in a single step. It also appears to be a generic solution to a wide variety of problems.
None of this showed up in my poring over the doc because I kept looking for operations to apply to lines and not vectors. Of course vectors is the way to go, because this is all internal calculations, not drawing elements. That’s what happens when I think in Ruby too much like I would draw it out in SU. I was already on http://ruby.sketchup.com/ and as soon as I clicked on Vector3D, there was
.linear_combination(weight1, vector1, weight2, vector2) ⇒ Object
at the top of the list, followed closely by #cross and #angle_between.
And as for Gerrit’s other question, no, the curve cannot be counted on to be of equal length segments. It’s generated by a parametric formula where the primary parameter is an angle value that I increment in degrees (or eventually fractions of a degree) and get XYZ coordinates for the next point on the curve. I have not looked into calculating how much the segment lengths vary, but that might be interesting to look at.
Here’s a drawing I did to help me keep the points and vectors straight. I’m sticking each point, vector, and angle into an array to help keep track of them and be able easily find what is the current, previous, and next one in the sequence. Because the curve loops back to become coninuous, point[N] is the point right before point[0].
The hexagons are to help see the 3D orientation of the lines (at one point I was thinking of getting the lines that I asked about here as diameters of the hexagons, but that idea proved difficult – primarily, I think, because the construction concept had nothing to do with the actual problem and was a kludge based on my lack of knowing the right operations).
Thanks for all the help. I think I’m moving forward on this again.
August