class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectRefCountedResource PolygonPathFinder
PackedVector2Array find_path<>( Vector2 from=, from:Vector2=, Vector2 to=, to:Vector2=, ):PackedVector2Array
Rect2 get_bounds<>():Rect2
Vector2 get_closest_point<>( Vector2 point=, point:Vector2=, ):Vector2
PackedVector2Array get_intersections<>( Vector2 from=, from:Vector2=, Vector2 to=, to:Vector2=, ):PackedVector2Array
float get_point_penalty<>( int idx=, idx:int=, ):float
bool is_point_inside<>( Vector2 point=, point:Vector2=, ):bool
Returns true if point falls inside the polygon area.

var polygon_path_finder = PolygonPathFinder.new() var points = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(0.0, 1.0)] var connections = [0, 1, 1, 2, 2, 0] polygon_path_finder.setup(points, connections) print(polygon_path_finder.is_point_inside(Vector2(0.2, 0.2))) # Prints true print(polygon_path_finder.is_point_inside(Vector2(1.0, 1.0))) # Prints false
var polygonPathFinder = new PolygonPathFinder(); Vector2[] points = [ new Vector2(0.0f, 0.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 1.0f) ]; int[] connections = [0, 1, 1, 2, 2, 0]; polygonPathFinder.Setup(points, connections); GD.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True GD.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False

void set_point_penalty<>( int idx=, idx:int=, float penalty=, penalty:float=, ):void
void setup<>( PackedVector2Array points=, points:PackedVector2Array=, PackedInt32Array connections=, connections:PackedInt32Array=, ):void
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.

The length of connections must be even, returns an error if odd.
var polygon_path_finder = PolygonPathFinder.new() var points = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(0.0, 1.0)] var connections = [0, 1, 1, 2, 2, 0] polygon_path_finder.setup(points, connections)
var polygonPathFinder = new PolygonPathFinder(); Vector2[] points = [ new Vector2(0.0f, 0.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 1.0f) ]; int[] connections = [0, 1, 1, 2, 2, 0]; polygonPathFinder.Setup(points, connections);




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...