Re: A89: Basic -- 3Dstudio


[Prev][Next][Index][Thread]

Re: A89: Basic -- 3Dstudio




>> Moving a point <x,y,z> in the direction of the vector <a,b,c>
>>
>>  | 1 0 0 a |
>>  | 0 1 0 b | * <x, y, z, 1> = <x+a, y+b, z+c>
>>  | 0 0 1 c |
>
>how does this move a point in the direction of a,b,c?  help?

Look at this:

>>  | a b c |    | x |     | ax + by + cz |
>>  | d e f | * | y | =  | dx + ey + fz |
>>  | g h i |     | z |     | gx + hy + iz |

So the problem is

| 1 0 0 a |     | x |       | x*1 + y*0 + z*0 + 1*a |      | x + a |
| 0 1 0 b | *  | y |  =  | x*0 + y*1 + z*0 + 1*b |  =   | y + b |
| 0 0 1 c |     | z |       | x+0 + y*0 + z*1 + 1*c |       | z + c |
	   | 1 |

So in BASIC, if you want to move a list of n points 5 units in the x direction:

for a,1,n,1
[[1,0,0,5][0,1,0,0][0,0,1,0]]*[[x[a]][y[a]][z[a]]] -> mPro
mPro[1,1] -> x[a]
mPro[1,2] -> y[a]
mPro[1,3] -> z[a]
endfor

You can see how this would be easy to make into a funtion for motion,
rotation, etc.  I _really_ wish that you could do m1*m2 -> [[x][y][z]].
That whole function would be one line.

	--Nate


Follow-Ups: References: