Geometry.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Geometry" inherits="Object" category="Core" version="3.1">
  3. <brief_description>
  4. </brief_description>
  5. <description>
  6. </description>
  7. <tutorials>
  8. </tutorials>
  9. <demos>
  10. </demos>
  11. <methods>
  12. <method name="build_box_planes">
  13. <return type="Array">
  14. </return>
  15. <argument index="0" name="extents" type="Vector3">
  16. </argument>
  17. <description>
  18. 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).
  19. </description>
  20. </method>
  21. <method name="build_capsule_planes">
  22. <return type="Array">
  23. </return>
  24. <argument index="0" name="radius" type="float">
  25. </argument>
  26. <argument index="1" name="height" type="float">
  27. </argument>
  28. <argument index="2" name="sides" type="int">
  29. </argument>
  30. <argument index="3" name="lats" type="int">
  31. </argument>
  32. <argument index="4" name="axis" type="int" enum="Vector3.Axis" default="2">
  33. </argument>
  34. <description>
  35. 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).
  36. </description>
  37. </method>
  38. <method name="build_cylinder_planes">
  39. <return type="Array">
  40. </return>
  41. <argument index="0" name="radius" type="float">
  42. </argument>
  43. <argument index="1" name="height" type="float">
  44. </argument>
  45. <argument index="2" name="sides" type="int">
  46. </argument>
  47. <argument index="3" name="axis" type="int" enum="Vector3.Axis" default="2">
  48. </argument>
  49. <description>
  50. 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).
  51. </description>
  52. </method>
  53. <method name="clip_polygon">
  54. <return type="PoolVector3Array">
  55. </return>
  56. <argument index="0" name="points" type="PoolVector3Array">
  57. </argument>
  58. <argument index="1" name="plane" type="Plane">
  59. </argument>
  60. <description>
  61. Clips the polygon defined by the points in [code]points[/code] against the [code]plane[/code] and returns the points of the clipped polygon.
  62. </description>
  63. </method>
  64. <method name="convex_hull_2d">
  65. <return type="PoolVector2Array">
  66. </return>
  67. <argument index="0" name="points" type="PoolVector2Array">
  68. </argument>
  69. <description>
  70. 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.
  71. </description>
  72. </method>
  73. <method name="get_closest_point_to_segment">
  74. <return type="Vector3">
  75. </return>
  76. <argument index="0" name="point" type="Vector3">
  77. </argument>
  78. <argument index="1" name="s1" type="Vector3">
  79. </argument>
  80. <argument index="2" name="s2" type="Vector3">
  81. </argument>
  82. <description>
  83. 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.
  84. </description>
  85. </method>
  86. <method name="get_closest_point_to_segment_2d">
  87. <return type="Vector2">
  88. </return>
  89. <argument index="0" name="point" type="Vector2">
  90. </argument>
  91. <argument index="1" name="s1" type="Vector2">
  92. </argument>
  93. <argument index="2" name="s2" type="Vector2">
  94. </argument>
  95. <description>
  96. 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.
  97. </description>
  98. </method>
  99. <method name="get_closest_point_to_segment_uncapped">
  100. <return type="Vector3">
  101. </return>
  102. <argument index="0" name="point" type="Vector3">
  103. </argument>
  104. <argument index="1" name="s1" type="Vector3">
  105. </argument>
  106. <argument index="2" name="s2" type="Vector3">
  107. </argument>
  108. <description>
  109. 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.
  110. </description>
  111. </method>
  112. <method name="get_closest_point_to_segment_uncapped_2d">
  113. <return type="Vector2">
  114. </return>
  115. <argument index="0" name="point" type="Vector2">
  116. </argument>
  117. <argument index="1" name="s1" type="Vector2">
  118. </argument>
  119. <argument index="2" name="s2" type="Vector2">
  120. </argument>
  121. <description>
  122. 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.
  123. </description>
  124. </method>
  125. <method name="get_closest_points_between_segments">
  126. <return type="PoolVector3Array">
  127. </return>
  128. <argument index="0" name="p1" type="Vector3">
  129. </argument>
  130. <argument index="1" name="p2" type="Vector3">
  131. </argument>
  132. <argument index="2" name="q1" type="Vector3">
  133. </argument>
  134. <argument index="3" name="q2" type="Vector3">
  135. </argument>
  136. <description>
  137. 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]).
  138. </description>
  139. </method>
  140. <method name="get_closest_points_between_segments_2d">
  141. <return type="PoolVector2Array">
  142. </return>
  143. <argument index="0" name="p1" type="Vector2">
  144. </argument>
  145. <argument index="1" name="q1" type="Vector2">
  146. </argument>
  147. <argument index="2" name="p2" type="Vector2">
  148. </argument>
  149. <argument index="3" name="q2" type="Vector2">
  150. </argument>
  151. <description>
  152. 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]).
  153. </description>
  154. </method>
  155. <method name="get_uv84_normal_bit">
  156. <return type="int">
  157. </return>
  158. <argument index="0" name="normal" type="Vector3">
  159. </argument>
  160. <description>
  161. </description>
  162. </method>
  163. <method name="line_intersects_line_2d">
  164. <return type="Variant">
  165. </return>
  166. <argument index="0" name="from_a" type="Vector2">
  167. </argument>
  168. <argument index="1" name="dir_a" type="Vector2">
  169. </argument>
  170. <argument index="2" name="from_b" type="Vector2">
  171. </argument>
  172. <argument index="3" name="dir_b" type="Vector2">
  173. </argument>
  174. <description>
  175. 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.
  176. </description>
  177. </method>
  178. <method name="make_atlas">
  179. <return type="Dictionary">
  180. </return>
  181. <argument index="0" name="sizes" type="PoolVector2Array">
  182. </argument>
  183. <description>
  184. 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].
  185. </description>
  186. </method>
  187. <method name="point_is_inside_triangle" qualifiers="const">
  188. <return type="bool">
  189. </return>
  190. <argument index="0" name="point" type="Vector2">
  191. </argument>
  192. <argument index="1" name="a" type="Vector2">
  193. </argument>
  194. <argument index="2" name="b" type="Vector2">
  195. </argument>
  196. <argument index="3" name="c" type="Vector2">
  197. </argument>
  198. <description>
  199. Returns if [code]point[/code] is inside the triangle specified by [code]a[/code], [code]b[/code] and [code]c[/code].
  200. </description>
  201. </method>
  202. <method name="ray_intersects_triangle">
  203. <return type="Variant">
  204. </return>
  205. <argument index="0" name="from" type="Vector3">
  206. </argument>
  207. <argument index="1" name="dir" type="Vector3">
  208. </argument>
  209. <argument index="2" name="a" type="Vector3">
  210. </argument>
  211. <argument index="3" name="b" type="Vector3">
  212. </argument>
  213. <argument index="4" name="c" type="Vector3">
  214. </argument>
  215. <description>
  216. 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.
  217. </description>
  218. </method>
  219. <method name="segment_intersects_circle">
  220. <return type="float">
  221. </return>
  222. <argument index="0" name="segment_from" type="Vector2">
  223. </argument>
  224. <argument index="1" name="segment_to" type="Vector2">
  225. </argument>
  226. <argument index="2" name="circle_position" type="Vector2">
  227. </argument>
  228. <argument index="3" name="circle_radius" type="float">
  229. </argument>
  230. <description>
  231. 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).
  232. </description>
  233. </method>
  234. <method name="segment_intersects_convex">
  235. <return type="PoolVector3Array">
  236. </return>
  237. <argument index="0" name="from" type="Vector3">
  238. </argument>
  239. <argument index="1" name="to" type="Vector3">
  240. </argument>
  241. <argument index="2" name="planes" type="Array">
  242. </argument>
  243. <description>
  244. 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.
  245. </description>
  246. </method>
  247. <method name="segment_intersects_cylinder">
  248. <return type="PoolVector3Array">
  249. </return>
  250. <argument index="0" name="from" type="Vector3">
  251. </argument>
  252. <argument index="1" name="to" type="Vector3">
  253. </argument>
  254. <argument index="2" name="height" type="float">
  255. </argument>
  256. <argument index="3" name="radius" type="float">
  257. </argument>
  258. <description>
  259. 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.
  260. </description>
  261. </method>
  262. <method name="segment_intersects_segment_2d">
  263. <return type="Variant">
  264. </return>
  265. <argument index="0" name="from_a" type="Vector2">
  266. </argument>
  267. <argument index="1" name="to_a" type="Vector2">
  268. </argument>
  269. <argument index="2" name="from_b" type="Vector2">
  270. </argument>
  271. <argument index="3" name="to_b" type="Vector2">
  272. </argument>
  273. <description>
  274. 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].
  275. </description>
  276. </method>
  277. <method name="segment_intersects_sphere">
  278. <return type="PoolVector3Array">
  279. </return>
  280. <argument index="0" name="from" type="Vector3">
  281. </argument>
  282. <argument index="1" name="to" type="Vector3">
  283. </argument>
  284. <argument index="2" name="sphere_position" type="Vector3">
  285. </argument>
  286. <argument index="3" name="sphere_radius" type="float">
  287. </argument>
  288. <description>
  289. 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.
  290. </description>
  291. </method>
  292. <method name="segment_intersects_triangle">
  293. <return type="Variant">
  294. </return>
  295. <argument index="0" name="from" type="Vector3">
  296. </argument>
  297. <argument index="1" name="to" type="Vector3">
  298. </argument>
  299. <argument index="2" name="a" type="Vector3">
  300. </argument>
  301. <argument index="3" name="b" type="Vector3">
  302. </argument>
  303. <argument index="4" name="c" type="Vector3">
  304. </argument>
  305. <description>
  306. 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.
  307. </description>
  308. </method>
  309. <method name="triangulate_polygon">
  310. <return type="PoolIntArray">
  311. </return>
  312. <argument index="0" name="polygon" type="PoolVector2Array">
  313. </argument>
  314. <description>
  315. 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.
  316. </description>
  317. </method>
  318. </methods>
  319. <constants>
  320. </constants>
  321. </class>