TFormNormal.htm 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>TFormNormal x#, y#, z#, source_entity, dest_entity</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. x#, y#, z# = components of a vector in 3d space <br />
  13. <br />
  14. source_entity = handle of source entity, or 0 for 3d world <br />
  15. dest_entity = handle of destination entity, or 0 for 3d world
  16. </td>
  17. </tr>
  18. </table>
  19. <h1>Description</h1>
  20. <table>
  21. <tr>
  22. <td>
  23. Transforms between coordinate systems. After using TFormNormal the new <br />
  24. components can be read with TFormedX(), TFormedY() and TFormedZ(). <br />
  25. <br />
  26. This is exactly the same as TFormVector but with one added feature. <br />
  27. After the transformation the new vector is 'normalized', meaning it <br />
  28. is scaled to have length 1. <br />
  29. <br />
  30. For example, suppose the result of TFormVector is (1,2,2). <br />
  31. This vector has length Sqr( 1*1 + 2*2 + 2*2 ) = Sqr( 9 ) = 3. <br />
  32. <br />
  33. This means TFormNormal would produce ( 1/3, 2/3, 2/3 ).
  34. </td>
  35. </tr>
  36. </table>
  37. <h1><a href=../3d_examples/TFormNormal.bb>Example</a></h1>
  38. <table>
  39. <tr>
  40. <td>
  41. ; TFormNormal example <br />
  42. <br />
  43. Graphics3D 640, 480 <br />
  44. <br />
  45. ; Just a quick demonstration of the 'normalization' feature. <br />
  46. <br />
  47. TFormNormal 1,2,2, 0,0 ; transform from world to world <br />
  48. <br />
  49. ; The transformation from world to world does nothing. <br />
  50. ; But afterward the vector (1,2,2) is divided by the length 3. <br />
  51. <br />
  52. message$ = "The normalized vector is ( " <br />
  53. message = message + TFormedX() + ", " + TFormedY() + ", " + TFormedZ() + " )" <br />
  54. <br />
  55. Text 70, 180, message <br />
  56. <br />
  57. Flip <br />
  58. <br />
  59. WaitKey() <br />
  60. End
  61. </td>
  62. </tr>
  63. </table>
  64. <br>
  65. <a target=_top href=../index.htm>Index</a><br>
  66. <br>
  67. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=TFormNormal&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  68. </html>