Geometry.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Geometry" inherits="Object" category="Core" version="3.1.2">
  3. <brief_description>
  4. </brief_description>
  5. <description>
  6. </description>
  7. <tutorials>
  8. </tutorials>
  9. <methods>
  10. <method name="build_box_planes">
  11. <return type="Array">
  12. </return>
  13. <argument index="0" name="extents" type="Vector3">
  14. </argument>
  15. <description>
  16. Returns an array with 6 [Plane]s that describe the sides of a box centered at the origin. The box size is defined by [code]extents[/code], which represents one (positive) corner of the box (i.e. half its actual size).
  17. </description>
  18. </method>
  19. <method name="build_capsule_planes">
  20. <return type="Array">
  21. </return>
  22. <argument index="0" name="radius" type="float">
  23. </argument>
  24. <argument index="1" name="height" type="float">
  25. </argument>
  26. <argument index="2" name="sides" type="int">
  27. </argument>
  28. <argument index="3" name="lats" type="int">
  29. </argument>
  30. <argument index="4" name="axis" type="int" enum="Vector3.Axis" default="2">
  31. </argument>
  32. <description>
  33. Returns an array of [Plane]s closely bounding a faceted capsule centered at the origin with radius [code]radius[/code] and height [code]height[/code]. The parameter [code]sides[/code] defines how many planes will be generated for the side part of the capsule, whereas [code]lats[/code] gives the number of latitudinal steps at the bottom and top of the capsule. The parameter [code]axis[/code] describes the axis along which the capsule is oriented (0 for X, 1 for Y, 2 for Z).
  34. </description>
  35. </method>
  36. <method name="build_cylinder_planes">
  37. <return type="Array">
  38. </return>
  39. <argument index="0" name="radius" type="float">
  40. </argument>
  41. <argument index="1" name="height" type="float">
  42. </argument>
  43. <argument index="2" name="sides" type="int">
  44. </argument>
  45. <argument index="3" name="axis" type="int" enum="Vector3.Axis" default="2">
  46. </argument>
  47. <description>
  48. Returns an array of [Plane]s closely bounding a faceted cylinder centered at the origin with radius [code]radius[/code] and height [code]height[/code]. The parameter [code]sides[/code] defines how many planes will be generated for the round part of the cylinder. The parameter [code]axis[/code] describes the axis along which the cylinder is oriented (0 for X, 1 for Y, 2 for Z).
  49. </description>
  50. </method>
  51. <method name="clip_polygon">
  52. <return type="PoolVector3Array">
  53. </return>
  54. <argument index="0" name="points" type="PoolVector3Array">
  55. </argument>
  56. <argument index="1" name="plane" type="Plane">
  57. </argument>
  58. <description>
  59. Clips the polygon defined by the points in [code]points[/code] against the [code]plane[/code] and returns the points of the clipped polygon.
  60. </description>
  61. </method>
  62. <method name="convex_hull_2d">
  63. <return type="PoolVector2Array">
  64. </return>
  65. <argument index="0" name="points" type="PoolVector2Array">
  66. </argument>
  67. <description>
  68. Given an array of [Vector2]s, returns the convex hull as a list of points in counter-clockwise order. The last point is the same as the first one.
  69. </description>
  70. </method>
  71. <method name="get_closest_point_to_segment">
  72. <return type="Vector3">
  73. </return>
  74. <argument index="0" name="point" type="Vector3">
  75. </argument>
  76. <argument index="1" name="s1" type="Vector3">
  77. </argument>
  78. <argument index="2" name="s2" type="Vector3">
  79. </argument>
  80. <description>
  81. Returns the 3d point on the 3d segment ([code]s1[/code], [code]s2[/code]) that is closest to [code]point[/code]. The returned point will always be inside the specified segment.
  82. </description>
  83. </method>
  84. <method name="get_closest_point_to_segment_2d">
  85. <return type="Vector2">
  86. </return>
  87. <argument index="0" name="point" type="Vector2">
  88. </argument>
  89. <argument index="1" name="s1" type="Vector2">
  90. </argument>
  91. <argument index="2" name="s2" type="Vector2">
  92. </argument>
  93. <description>
  94. Returns the 2d point on the 2d segment ([code]s1[/code], [code]s2[/code]) that is closest to [code]point[/code]. The returned point will always be inside the specified segment.
  95. </description>
  96. </method>
  97. <method name="get_closest_point_to_segment_uncapped">
  98. <return type="Vector3">
  99. </return>
  100. <argument index="0" name="point" type="Vector3">
  101. </argument>
  102. <argument index="1" name="s1" type="Vector3">
  103. </argument>
  104. <argument index="2" name="s2" type="Vector3">
  105. </argument>
  106. <description>
  107. Returns the 3d point on the 3d line defined by ([code]s1[/code], [code]s2[/code]) that is closest to [code]point[/code]. The returned point can be inside the segment ([code]s1[/code], [code]s2[/code]) or outside of it, i.e. somewhere on the line extending from the segment.
  108. </description>
  109. </method>
  110. <method name="get_closest_point_to_segment_uncapped_2d">
  111. <return type="Vector2">
  112. </return>
  113. <argument index="0" name="point" type="Vector2">
  114. </argument>
  115. <argument index="1" name="s1" type="Vector2">
  116. </argument>
  117. <argument index="2" name="s2" type="Vector2">
  118. </argument>
  119. <description>
  120. Returns the 2d point on the 2d line defined by ([code]s1[/code], [code]s2[/code]) that is closest to [code]point[/code]. The returned point can be inside the segment ([code]s1[/code], [code]s2[/code]) or outside of it, i.e. somewhere on the line extending from the segment.
  121. </description>
  122. </method>
  123. <method name="get_closest_points_between_segments">
  124. <return type="PoolVector3Array">
  125. </return>
  126. <argument index="0" name="p1" type="Vector3">
  127. </argument>
  128. <argument index="1" name="p2" type="Vector3">
  129. </argument>
  130. <argument index="2" name="q1" type="Vector3">
  131. </argument>
  132. <argument index="3" name="q2" type="Vector3">
  133. </argument>
  134. <description>
  135. Given the two 3d segments ([code]p1[/code], [code]p2[/code]) and ([code]q1[/code], [code]q2[/code]), finds those two points on the two segments that are closest to each other. Returns a [PoolVector3Array] that contains this point on ([code]p1[/code], [code]p2[/code]) as well the accompanying point on ([code]q1[/code], [code]q2[/code]).
  136. </description>
  137. </method>
  138. <method name="get_closest_points_between_segments_2d">
  139. <return type="PoolVector2Array">
  140. </return>
  141. <argument index="0" name="p1" type="Vector2">
  142. </argument>
  143. <argument index="1" name="q1" type="Vector2">
  144. </argument>
  145. <argument index="2" name="p2" type="Vector2">
  146. </argument>
  147. <argument index="3" name="q2" type="Vector2">
  148. </argument>
  149. <description>
  150. Given the two 2d segments ([code]p1[/code], [code]p2[/code]) and ([code]q1[/code], [code]q2[/code]), finds those two points on the two segments that are closest to each other. Returns a [PoolVector2Array] that contains this point on ([code]p1[/code], [code]p2[/code]) as well the accompanying point on ([code]q1[/code], [code]q2[/code]).
  151. </description>
  152. </method>
  153. <method name="get_uv84_normal_bit">
  154. <return type="int">
  155. </return>
  156. <argument index="0" name="normal" type="Vector3">
  157. </argument>
  158. <description>
  159. </description>
  160. </method>
  161. <method name="line_intersects_line_2d">
  162. <return type="Variant">
  163. </return>
  164. <argument index="0" name="from_a" type="Vector2">
  165. </argument>
  166. <argument index="1" name="dir_a" type="Vector2">
  167. </argument>
  168. <argument index="2" name="from_b" type="Vector2">
  169. </argument>
  170. <argument index="3" name="dir_b" type="Vector2">
  171. </argument>
  172. <description>
  173. Checks if the two lines ([code]from_a[/code], [code]dir_a[/code]) and ([code]from_b[/code], [code]dir_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant]. Note that the lines are specified using direction vectors, not end points.
  174. </description>
  175. </method>
  176. <method name="make_atlas">
  177. <return type="Dictionary">
  178. </return>
  179. <argument index="0" name="sizes" type="PoolVector2Array">
  180. </argument>
  181. <description>
  182. Given an array of [Vector2]s representing tiles, builds an atlas. The returned dictionary has two keys: [code]points[/code] is a vector of [Vector2] that specifies the positions of each tile, [code]size[/code] contains the overall size of the whole atlas as [Vector2].
  183. </description>
  184. </method>
  185. <method name="point_is_inside_triangle" qualifiers="const">
  186. <return type="bool">
  187. </return>
  188. <argument index="0" name="point" type="Vector2">
  189. </argument>
  190. <argument index="1" name="a" type="Vector2">
  191. </argument>
  192. <argument index="2" name="b" type="Vector2">
  193. </argument>
  194. <argument index="3" name="c" type="Vector2">
  195. </argument>
  196. <description>
  197. Returns if [code]point[/code] is inside the triangle specified by [code]a[/code], [code]b[/code] and [code]c[/code].
  198. </description>
  199. </method>
  200. <method name="ray_intersects_triangle">
  201. <return type="Variant">
  202. </return>
  203. <argument index="0" name="from" type="Vector3">
  204. </argument>
  205. <argument index="1" name="dir" type="Vector3">
  206. </argument>
  207. <argument index="2" name="a" type="Vector3">
  208. </argument>
  209. <argument index="3" name="b" type="Vector3">
  210. </argument>
  211. <argument index="4" name="c" type="Vector3">
  212. </argument>
  213. <description>
  214. Tests if the 3d ray starting at [code]from[/code] with the direction of [code]dir[/code] intersects the triangle specified by [code]a[/code], [code]b[/code] and [code]c[/code]. If yes, returns the point of intersection as [Vector3]. If no intersection takes place, an empty [Variant] is returned.
  215. </description>
  216. </method>
  217. <method name="segment_intersects_circle">
  218. <return type="float">
  219. </return>
  220. <argument index="0" name="segment_from" type="Vector2">
  221. </argument>
  222. <argument index="1" name="segment_to" type="Vector2">
  223. </argument>
  224. <argument index="2" name="circle_position" type="Vector2">
  225. </argument>
  226. <argument index="3" name="circle_radius" type="float">
  227. </argument>
  228. <description>
  229. Given the 2d segment ([code]segment_from[/code], [code]segment_to[/code]), returns the position on the segment (as a number between 0 and 1) at which the segment hits the circle that is located at position [code]circle_position[/code] and has radius [code]circle_radius[/code]. If the segment does not intersect the circle, -1 is returned (this is also the case if the line extending the segment would intersect the circle, but the segment does not).
  230. </description>
  231. </method>
  232. <method name="segment_intersects_convex">
  233. <return type="PoolVector3Array">
  234. </return>
  235. <argument index="0" name="from" type="Vector3">
  236. </argument>
  237. <argument index="1" name="to" type="Vector3">
  238. </argument>
  239. <argument index="2" name="planes" type="Array">
  240. </argument>
  241. <description>
  242. Given a convex hull defined though the [Plane]s in the array [code]planes[/code], tests if the segment ([code]from[/code], [code]to[/code]) intersects with that hull. If an intersection is found, returns a [PoolVector3Array] containing the point the intersection and the hull's normal. If no intersecion is found, an the returned array is empty.
  243. </description>
  244. </method>
  245. <method name="segment_intersects_cylinder">
  246. <return type="PoolVector3Array">
  247. </return>
  248. <argument index="0" name="from" type="Vector3">
  249. </argument>
  250. <argument index="1" name="to" type="Vector3">
  251. </argument>
  252. <argument index="2" name="height" type="float">
  253. </argument>
  254. <argument index="3" name="radius" type="float">
  255. </argument>
  256. <description>
  257. Checks if the segment ([code]from[/code], [code]to[/code]) intersects the cylinder with height [code]height[/code] that is centered at the origin and has radius [code]radius[/code]. If no, returns an empty [PoolVector3Array]. If an intersection takes place, the returned array contains the point of intersection and the cylinder's normal at the point of intersection.
  258. </description>
  259. </method>
  260. <method name="segment_intersects_segment_2d">
  261. <return type="Variant">
  262. </return>
  263. <argument index="0" name="from_a" type="Vector2">
  264. </argument>
  265. <argument index="1" name="to_a" type="Vector2">
  266. </argument>
  267. <argument index="2" name="from_b" type="Vector2">
  268. </argument>
  269. <argument index="3" name="to_b" type="Vector2">
  270. </argument>
  271. <description>
  272. Checks if the two segments ([code]from_a[/code], [code]to_a[/code]) and ([code]from_b[/code], [code]to_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant].
  273. </description>
  274. </method>
  275. <method name="segment_intersects_sphere">
  276. <return type="PoolVector3Array">
  277. </return>
  278. <argument index="0" name="from" type="Vector3">
  279. </argument>
  280. <argument index="1" name="to" type="Vector3">
  281. </argument>
  282. <argument index="2" name="sphere_position" type="Vector3">
  283. </argument>
  284. <argument index="3" name="sphere_radius" type="float">
  285. </argument>
  286. <description>
  287. Checks if the segment ([code]from[/code], [code]to[/code]) intersects the sphere that is located at [code]sphere_position[/code] and has radius [code]sphere_radius[/code]. If no, returns an empty [PoolVector3Array]. If yes, returns a [PoolVector3Array] containing the point of intersection and the sphere's normal at the point of intersection.
  288. </description>
  289. </method>
  290. <method name="segment_intersects_triangle">
  291. <return type="Variant">
  292. </return>
  293. <argument index="0" name="from" type="Vector3">
  294. </argument>
  295. <argument index="1" name="to" type="Vector3">
  296. </argument>
  297. <argument index="2" name="a" type="Vector3">
  298. </argument>
  299. <argument index="3" name="b" type="Vector3">
  300. </argument>
  301. <argument index="4" name="c" type="Vector3">
  302. </argument>
  303. <description>
  304. Tests if the segment ([code]from[/code], [code]to[/code]) intersects the triangle [code]a[/code], [code]b[/code], [code]c[/code]. If yes, returns the point of intersection as [Vector3]. If no intersection takes place, an empty [Variant] is returned.
  305. </description>
  306. </method>
  307. <method name="triangulate_polygon">
  308. <return type="PoolIntArray">
  309. </return>
  310. <argument index="0" name="polygon" type="PoolVector2Array">
  311. </argument>
  312. <description>
  313. Triangulates the polygon specified by the points in [code]polygon[/code]. Returns a [PoolIntArray] where each triangle consists of three consecutive point indices into [code]polygon[/code] (i.e. the returned array will have [code]n * 3[/code] elements, with [code]n[/code] being the number of found triangles). If the triangulation did not succeed, an empty [PoolIntArray] is returned.
  314. </description>
  315. </method>
  316. </methods>
  317. <constants>
  318. </constants>
  319. </class>