Transforming one vector into another vec's space?

Blitz3D Forums/Blitz3D Programming/Transforming one vector into another vec's space?

AntonyWells(Posted 2004) [#1]
To put it simply(otherwise i'll confuse myself...)

Say I have vector A, that is 0.1,1,0.

And I have vector B, that is 1,0,0

Now what I need to do is 'transform' it into the space of b.

I.e with the above two vectors A+B, it would output 1,0.1,0

I tried pointing a entity along vector b's 'heading', and then using tformpoint and tformvector(Passed with vector A)
but this produces wierd results, and doesn't seem to be doing what I need..


Bot Builder(Posted 2004) [#2]
The problem in this situation is that you cannot define a 'space' or reference with only one vector. Basically, you are leaving out the roll component. You need two vectors to define an orientation, and three to define a refrence (axis, basically). You can assume that roll is 0 in which case your solution should work. To set roll to somthin else you can use the third param of pointentity.


AntonyWells(Posted 2004) [#3]
well roll isn't important, at all, I just need the vector to 'transform' into the space of vector B.


eBusiness(Posted 2004) [#4]
Ehhh, why don't I understand anything of this?


Tom(Posted 2004) [#5]
Do you have a frame reference the vectors are relative to?

When you do it in Blitz, you have to give it 2 reference coordinate sets (the entitys or world space) that the vector is relative to. I don't think what you want to do can be done without these.


AntonyWells(Posted 2004) [#6]
I'm not entirely sure.

To simplify it further,

Vector A is a 'position' on a triangle. A vector pointing off it's surface.(This can either be triangle normal, calculated for that individual pixel(I.e spherical from 0,0,0))

Vector B is got from a 'heightmap', generated from this height's r,g,b(Proper, normalized etc, withyin -1,1)

Now I want to 'transform' this height map into the space of vector A. So if vector A is pointing up, the height map will point up(On the surface I'm mapping the resultant output to)


JoshK(Posted 2004) [#7]
TFormVector2(Ax#,Ay#,Az#,Bx#,By#,Bz#)
temp=createpivot()
aligntovector temp,bx,0,0,1
aligntovector temp,0,by,0,2
aligntovector temp,0,0,bz,3
TformVEctor ax,ay,az,0,temp
freeentity temp



AbbaRue(Posted 2004) [#8]
I don't know if I understand what you are trying to do.
But is looks like you want to add vector B's location to that of vector A.
If that is what you want to do then you need to use this comand:
VertexCoords surface,index,x#,y#,z#
Add each of B's x,y,z to A's x,y,z then use VertexCoords to set the new vector.


AntonyWells(Posted 2004) [#9]
Abba, nope, not even close ;)

Halo, thanks but doesn't work either. Not even remotely..;)

I tried all the tform combinations ages ago anyway...nothing seems to work.


skidracer(Posted 2004) [#10]
You should sign up for some uni maths, you can't define a space with a vector. The bump map has to be aligned in all three axis, the polygons' normal does not have enough information.

To transform the bump map into triangle space you need a plane equation not a normal.


AntonyWells(Posted 2004) [#11]
Yes I know, Skid. Along the T,U vectors of the tri's uv. I.e tangant space. It's just not something I want to do in blitz3D (Which this is for..vivid is another matter)

This method I'm trying here just seemed like a logical step as it works beautiful for per-pixel lighting normal map generation....
I mean this 'bumpmap' is being projected onto each tri by my code...it just seems plausible that it can be encoded already 'tanganted'...if that makes sense...no need to process...
(Bar a simple angle to light, per-tri)

And more to the point, I did actually get it working once...Although this was before the mapper projected the normal map along the uv coords of the mesh for obvious reasons...Then I tried experiementing with this...that..and before you knew it nothing's working.. I don't recall how I did it, but it worked just fine. Though...

Tbc.

-Edit- As for maths uni, right after you guys take 'release dates for products called bmax' uni...;) (j/k)