Geometry.xml 14 KB

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