Debian Codegraph @

doc/classes/PolygonPathFinder.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="PolygonPathFinder" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 </brief_description>
5 <description>
6 </description>
7 <tutorials>
8 </tutorials>
9 <methods>
10 <method name="find_path">
11 <return type="PackedVector2Array" />
12 <param index="0" name="from" type="Vector2" />
13 <param index="1" name="to" type="Vector2" />
14 <description>
15 </description>
16 </method>
17 <method name="get_bounds" qualifiers="const">
18 <return type="Rect2" />
19 <description>
20 </description>
21 </method>
22 <method name="get_closest_point" qualifiers="const">
23 <return type="Vector2" />
24 <param index="0" name="point" type="Vector2" />
25 <description>
26 </description>
27 </method>
28 <method name="get_intersections" qualifiers="const">
29 <return type="PackedVector2Array" />
30 <param index="0" name="from" type="Vector2" />
31 <param index="1" name="to" type="Vector2" />
32 <description>
33 </description>
34 </method>
35 <method name="get_point_penalty" qualifiers="const">
36 <return type="float" />
37 <param index="0" name="idx" type="int" />
38 <description>
39 </description>
40 </method>
41 <method name="is_point_inside" qualifiers="const">
42 <return type="bool" />
43 <param index="0" name="point" type="Vector2" />
44 <description>
45 Returns [code]true[/code] if [param point] falls inside the polygon area.
46 [codeblocks]
47 [gdscript]
48 var polygon_path_finder = PolygonPathFinder.new()
49 var points = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(0.0, 1.0)]
50 var connections = [0, 1, 1, 2, 2, 0]
51 polygon_path_finder.setup(points, connections)
52 print(polygon_path_finder.is_point_inside(Vector2(0.2, 0.2))) # Prints true
53 print(polygon_path_finder.is_point_inside(Vector2(1.0, 1.0))) # Prints false
54 [/gdscript]
55 [csharp]
56 var polygonPathFinder = new PolygonPathFinder();
57 Vector2[] points =
58 [
59 new Vector2(0.0f, 0.0f),
60 new Vector2(1.0f, 0.0f),
61 new Vector2(0.0f, 1.0f)
62 ];
63 int[] connections = [0, 1, 1, 2, 2, 0];
64 polygonPathFinder.Setup(points, connections);
65 GD.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True
66 GD.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False
67 [/csharp]
68 [/codeblocks]
69 </description>
70 </method>
71 <method name="set_point_penalty">
72 <return type="void" />
73 <param index="0" name="idx" type="int" />
74 <param index="1" name="penalty" type="float" />
75 <description>
76 </description>
77 </method>
78 <method name="setup">
79 <return type="void" />
80 <param index="0" name="points" type="PackedVector2Array" />
81 <param index="1" name="connections" type="PackedInt32Array" />
82 <description>
83 Sets up [PolygonPathFinder] with an array of points that define the vertices of the polygon, and an array of indices that determine the edges of the polygon.
84 The length of [param connections] must be even, returns an error if odd.
85 [codeblocks]
86 [gdscript]
87 var polygon_path_finder = PolygonPathFinder.new()
88 var points = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(0.0, 1.0)]
89 var connections = [0, 1, 1, 2, 2, 0]
90 polygon_path_finder.setup(points, connections)
91 [/gdscript]
92 [csharp]
93 var polygonPathFinder = new PolygonPathFinder();
94 Vector2[] points =
95 [
96 new Vector2(0.0f, 0.0f),
97 new Vector2(1.0f, 0.0f),
98 new Vector2(0.0f, 1.0f)
99 ];
100 int[] connections = [0, 1, 1, 2, 2, 0];
101 polygonPathFinder.Setup(points, connections);
102 [/csharp]
103 [/codeblocks]
104 </description>
105 </method>
106 </methods>
107 </class>