В процессе

This commit is contained in:
sasha80
2023-08-08 08:52:53 +03:00
parent 04e9a3ad05
commit 29101b0a6e
13 changed files with 140 additions and 163 deletions

View File

@@ -2,6 +2,8 @@ extends Node
func radians(val: float): return (val * PI) / 180.0
func ibytes_to_word(buf: PackedByteArray, i: int) -> int: return buf[i] + (buf[i + 1] * 256)
func hypot(x: float, y: float) -> float: return sqrt(x * x + y * y)
func get_members_names(obj: Object) -> Array:
@@ -24,13 +26,7 @@ func map_dec_to_rad(pos0: Vector2, pos: Vector2) -> Vector2:
var x1: float = pos.x - pos0.x
var y1: float = pos.y - pos0.y
var ang: float = (atan2(y1, x1) * 180.0) / PI
ang += 360.0 * float(ang < 0.0)
var radius: float = hypot(x1, y1)
return Vector2(ang, radius)
func hypot(x: float, y: float) -> float:
return sqrt(x * x + y * y)
return Vector2(ang + 360.0 * float(ang < 0.0), hypot(x1, y1))
func is_overlap(x1, x2, y1, y2):
@@ -38,10 +34,6 @@ func is_overlap(x1, x2, y1, y2):
return max(x1, y1) <= min(x2, y2)
func ibytes_to_word(buf: PackedByteArray, i: int) -> int:
return buf[i] + (buf[i + 1] * 256)
func map_range(val: float, a0: float, a1: float, b0: float, b1: float) -> float:
""" Переводит значение val из диапазона a0...a1 в диапазон b0...b1 """
return (((val - a0) * (b1 - b0)) / (a1 - a0)) + b0
@@ -52,10 +44,6 @@ func type_is_num(val) -> bool:
return (typeof(val) == TYPE_INT) or (typeof(val) == typeof(0.0))
func sort_ascending_0(a, b) -> bool:
return a[0] < b[0]
func is_point_in_polygon(pos: Vector2, p: PackedVector2Array) -> bool:
var j: int = len(p) - 1
var odd_nodes: int = 0