This is related to my other question about the fastest method of rotating vertices. I've gone ahead with the TFormPoint and a pivot method ( shown below ) and it seems marginally faster than Sin() and Cos() which is nice.
However, I was hoping that I could rotate vertex normals with the same method, and that bit isn't working.
To rotate vertices I'm doing this: ( I've spread it over a few more lines to make it more readable )
xpos,ypos & zpos are the offsets to the centre of rotation.
Anyway, that works fine, and seems to be pretty quick.
But the following code, supposed to rotate the vertex normals, doesn't.
I've left out the loop and pivot creation because it just goes in the loop after the vertex rotation part.
Have I made an error or is it not possible to do it this way?
However, I was hoping that I could rotate vertex normals with the same method, and that bit isn't working.
To rotate vertices I'm doing this: ( I've spread it over a few more lines to make it more readable )
axis=CreatePivot() RotateEntity axis,pitchchange#,yawchange#,rollchange# For vcount=1 to numverts vx#=VertexX#(surf,vcount)-xpos# vy#=VertexY#(surf,vcount)-ypos# vz#=VertexZ#(surf,vcount)-zpos# TFormPoint vx#,vy#,vz#,axis,0 vx# = TFormedX#()+xpos# vy# = TFormedY#()+ypos# vz# = TFormedZ#()+zpos# VertexCoords(surf,vcount,vx#,vy#,vz#) Next
xpos,ypos & zpos are the offsets to the centre of rotation.
Anyway, that works fine, and seems to be pretty quick.
But the following code, supposed to rotate the vertex normals, doesn't.
vnx#=VertexNX#(surf,vcount)
vny#=VertexNY#(surf,vcount)
vnz#=VertexNZ#(surf,vcount)
TFormNormal vnx#,vny#,vnz#,axis,0
vnx# = TFormedX#()
vny# = TFormedY#()
vnz# = TFormedZ#()
VertexNormal(surf,vcount,vnx#,vny#,vnz#)
I've left out the loop and pivot creation because it just goes in the loop after the vertex rotation part.
Have I made an error or is it not possible to do it this way?