[OpenSCAD] vector question
Doug Mcnutt
dmcnutt at macnauchtan.com
Sat Jun 30 23:34:59 CEST 2012
At 13:06 +0100 6/27/12, nop head wrote:
>There is a difference in the language used to describe the way that
>vector +- work compared to */, which lead me to believe that adding
>a number to a vector, or adding a vector to vector created a longer
>vector, while multiplying two vectors was (to use Giles word)
>componentwise. If they are the same, why not describe them all
>together?
I haven't done vectors with openscad - yet. But that kind of speech worries me a whole lot. Perl 6 has introduced component by component multiplication like
z1 = x1*y1 , z2 = x2*y2 , z3 = x3*y3
and the like. Such ideas are a disaster for folks who think of vectors as a way to represent a point in 3D space or who like to do Hamiltonian mechanics on satellites or to build 3 phase electric power systems.
The initial problem, adding a constant to a vector can be thought of as adding a special vector you create with all three of its components the same and equal to the value you want to add.
Now just add the temporary vector to the old one.
There are two ways to multiply vectors. The dot product multiplies the components in a component by component fashion and then adds the three products together to get a number, not a vector. The numeric value is the product of the two vector lengths and the cosine of the angle between them. It's also the length of the projection of one of the vectors on the other.
The cross product does something similar (look up the phunny formulas) to obtain a vector that is perpendicular to both input vectors with length equal to the sine of the product of the two lengths. If Z = X cross Y and you hold your right hand fingers so they show the rotation of X into Y, Z points in the direction of your thumb.
One can also multiply a vector by a scalar. That makes each element of the vector get longer or shorter by a ratio given by the scalar. That's used in the famous F = mA formula where the scalar is the mass and the force and acceleration are vectors. It's what makes the earth go around.
Now I need to get into openscad and do some testing. I'm going to be very upset if they got it wrong the way perl 6 does. That would be as bad as Excel returning +4 for the formula = -2^2.
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
More information about the OpenSCAD
mailing list