torus.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. return {
  2. tag = 'drawing',
  3. summary = 'Draw a donut.',
  4. description = 'Draws a torus.',
  5. arguments = {
  6. x = {
  7. type = 'number',
  8. default = '0',
  9. description = 'The x coordinate of the center of the torus.'
  10. },
  11. y = {
  12. type = 'number',
  13. default = '0',
  14. description = 'The y coordinate of the center of the torus.'
  15. },
  16. z = {
  17. type = 'number',
  18. default = '0',
  19. description = 'The z coordinate of the center of the torus.'
  20. },
  21. radius = {
  22. type = 'number',
  23. default = '1',
  24. description = 'The radius of the torus.'
  25. },
  26. thickness = {
  27. type = 'number',
  28. default = '1',
  29. description = 'The thickness of the torus.'
  30. },
  31. angle = {
  32. type = 'number',
  33. default = '0',
  34. description = 'The rotation of the torus around its rotation axis, in radians.'
  35. },
  36. ax = {
  37. type = 'number',
  38. default = '0',
  39. description = 'The x component of the axis of rotation.'
  40. },
  41. ay = {
  42. type = 'number',
  43. default = '1',
  44. description = 'The y component of the axis of rotation.'
  45. },
  46. az = {
  47. type = 'number',
  48. default = '0',
  49. description = 'The z component of the axis of rotation.'
  50. },
  51. position = {
  52. type = 'Vec3',
  53. description = 'The position of the center of the torus.'
  54. },
  55. scale = {
  56. type = 'Vec3',
  57. description = 'The size of the torus (x and y scale the radius, z is the thickness).'
  58. },
  59. orientation = {
  60. type = 'Quat',
  61. description = 'The orientation of the torus.'
  62. },
  63. transform = {
  64. type = 'Mat4',
  65. description = 'The transform of the torus.'
  66. },
  67. tsegments = {
  68. type = 'number',
  69. default = '64',
  70. description = 'The number of toroidal (circular) segments to render.'
  71. },
  72. psegments = {
  73. type = 'number',
  74. default = '32',
  75. description = 'The number of poloidal (tubular) segments to render.'
  76. }
  77. },
  78. returns = {},
  79. variants = {
  80. {
  81. arguments = { 'x', 'y', 'z', 'radius', 'thickness', 'angle', 'ax', 'ay', 'az', 'tsegments', 'psegments' },
  82. returns = {}
  83. },
  84. {
  85. arguments = { 'position', 'scale', 'orientation', 'tsegments', 'psegments' },
  86. returns = {}
  87. },
  88. {
  89. arguments = { 'transform', 'tsegments', 'psegments' },
  90. returns = {}
  91. }
  92. },
  93. notes = [[
  94. The local origin is in the center of the torus, and the torus forms a circle around the local Z
  95. axis.
  96. ]]
  97. }