2
0

transform.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. return {
  2. summary = 'Apply a transform to the vector.',
  3. description = [[
  4. Applies a transform (translation, rotation, scale) to the vector using a `Mat4` or numbers. This
  5. is the same as multiplying the vector by a matrix.
  6. ]],
  7. arguments = {
  8. m = {
  9. type = 'Mat4',
  10. description = 'The matrix to apply.'
  11. },
  12. x = {
  13. type = 'number',
  14. default = '0',
  15. description = 'The x component of the translation.'
  16. },
  17. y = {
  18. type = 'number',
  19. default = '0',
  20. description = 'The y component of the translation.'
  21. },
  22. z = {
  23. type = 'number',
  24. default = '0',
  25. description = 'The z component of the translation.'
  26. },
  27. scale = {
  28. type = 'number',
  29. default = '1',
  30. description = 'The scale factor.'
  31. },
  32. angle = {
  33. type = 'number',
  34. default = '0',
  35. description = 'The number of radians to rotate around the rotation axis.'
  36. },
  37. ax = {
  38. type = 'number',
  39. default = '0',
  40. description = 'The x component of the axis of rotation.'
  41. },
  42. ay = {
  43. type = 'number',
  44. default = '1',
  45. description = 'The y component of the axis of rotation.'
  46. },
  47. az = {
  48. type = 'number',
  49. default = '0',
  50. description = 'The z component of the axis of rotation.'
  51. },
  52. translation = {
  53. type = 'Vec3',
  54. description = 'The translation to apply.'
  55. },
  56. position = {
  57. type = 'Vec3',
  58. description = 'The scale to apply.'
  59. },
  60. rotation = {
  61. type = 'Quat',
  62. description = 'The rotation to apply.'
  63. },
  64. },
  65. returns = {
  66. self = {
  67. type = 'Vec4',
  68. description = 'The original vector, with transformed components.'
  69. }
  70. },
  71. variants = {
  72. {
  73. arguments = { 'm' },
  74. returns = { 'self' }
  75. },
  76. {
  77. arguments = { 'x', 'y', 'z', 'scale', 'angle', 'ax', 'ay', 'az' },
  78. returns = { 'self' }
  79. },
  80. {
  81. arguments = { 'translation', 'scale', 'rotation' },
  82. returns = { 'self' }
  83. }
  84. },
  85. related = {
  86. 'Mat4:mul',
  87. 'Vec3:transform'
  88. }
  89. }