transform.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.
  5. This is the same as multiplying the vector by a matrix. This treats the vector as a point.
  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 = 'Vec3',
  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. 'Vec4:transform',
  88. 'Vec3:rotate'
  89. }
  90. }