feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -9,6 +9,20 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="bresenham_line">
|
||||
<return type="Vector2i[]" />
|
||||
<param index="0" name="from" type="Vector2i" />
|
||||
<param index="1" name="to" type="Vector2i" />
|
||||
<description>
|
||||
Returns the [url=https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm]Bresenham line[/url] between the [param from] and [param to] points. A Bresenham line is a series of pixels that draws a line and is always 1-pixel thick on every row and column of the drawing (never more, never less).
|
||||
Example code to draw a line between two [Marker2D] nodes using a series of [method CanvasItem.draw_rect] calls:
|
||||
[codeblock]
|
||||
func _draw():
|
||||
for pixel in Geometry2D.bresenham_line($MarkerA.position, $MarkerB.position):
|
||||
draw_rect(Rect2(pixel, Vector2.ONE), Color.WHITE)
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="clip_polygons">
|
||||
<return type="PackedVector2Array[]" />
|
||||
<param index="0" name="polygon_a" type="PackedVector2Array" />
|
||||
|
|
@ -126,8 +140,34 @@
|
|||
<param index="2" name="from_b" type="Vector2" />
|
||||
<param index="3" name="dir_b" type="Vector2" />
|
||||
<description>
|
||||
Checks if the two lines ([param from_a], [param dir_a]) and ([param from_b], [param dir_b]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns [code]null[/code].
|
||||
[b]Note:[/b] The lines are specified using direction vectors, not end points.
|
||||
Returns the point of intersection between the two lines ([param from_a], [param dir_a]) and ([param from_b], [param dir_b]). Returns a [Vector2], or [code]null[/code] if the lines are parallel.
|
||||
[code]from[/code] and [code]dir[/code] are [i]not[/i] endpoints of a line segment or ray but the slope ([code]dir[/code]) and a known point ([code]from[/code]) on that line.
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
var from_a = Vector2.ZERO
|
||||
var dir_a = Vector2.RIGHT
|
||||
var from_b = Vector2.DOWN
|
||||
|
||||
# Returns Vector2(1, 0)
|
||||
Geometry2D.line_intersects_line(from_a, dir_a, from_b, Vector2(1, -1))
|
||||
# Returns Vector2(-1, 0)
|
||||
Geometry2D.line_intersects_line(from_a, dir_a, from_b, Vector2(-1, -1))
|
||||
# Returns null
|
||||
Geometry2D.line_intersects_line(from_a, dir_a, from_b, Vector2.RIGHT)
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var fromA = Vector2.Zero;
|
||||
var dirA = Vector2.Right;
|
||||
var fromB = Vector2.Down;
|
||||
|
||||
// Returns new Vector2(1, 0)
|
||||
Geometry2D.LineIntersectsLine(fromA, dirA, fromB, new Vector2(1, -1));
|
||||
// Returns new Vector2(-1, 0)
|
||||
Geometry2D.LineIntersectsLine(fromA, dirA, fromB, new Vector2(-1, -1));
|
||||
// Returns null
|
||||
Geometry2D.LineIntersectsLine(fromA, dirA, fromB, Vector2.Right);
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
</method>
|
||||
<method name="make_atlas">
|
||||
|
|
@ -161,13 +201,13 @@
|
|||
var polygon = PackedVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)])
|
||||
var offset = Vector2(50, 50)
|
||||
polygon = Transform2D(0, offset) * polygon
|
||||
print(polygon) # prints [(50, 50), (150, 50), (150, 150), (50, 150)]
|
||||
print(polygon) # Prints [(50.0, 50.0), (150.0, 50.0), (150.0, 150.0), (50.0, 150.0)]
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) };
|
||||
Vector2[] polygon = [new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100)];
|
||||
var offset = new Vector2(50, 50);
|
||||
polygon = new Transform2D(0, offset) * polygon;
|
||||
GD.Print((Variant)polygon); // prints [(50, 50), (150, 50), (150, 150), (50, 150)]
|
||||
GD.Print((Variant)polygon); // Prints [(50, 50), (150, 50), (150, 150), (50, 150)]
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue