Update nodes.py

This commit is contained in:
Kijai 2023-12-19 16:47:22 +02:00
parent c233afc27f
commit a77d73ca8a

View File

@ -2750,26 +2750,12 @@ def camera_embeddings(elevation, azimuth):
return embeddings return embeddings
def interpolate_angle(start, end, fraction): def interpolate_angle(start, end, fraction):
# Normalize start angle to range [0, 360) # Calculate the difference in angles and adjust for wraparound if necessary
start = start % 360 diff = (end - start + 540) % 360 - 180
# Apply fraction to the difference
# If end angle is negative, convert it to the equivalent positive angle interpolated = start + fraction * diff
if end < 0: # Normalize the result to be within the range of -180 to 180
end = 360 + end return (interpolated + 180) % 360 - 180
# Ensure the end angle is greater than the start angle for clockwise interpolation
if end <= start:
end += 360
# Calculate the clockwise distance from start to end
distance = end - start
# Interpolate the angle using the fraction and wrap it to range [-180, 180)
interpolated = (start + distance * fraction) % 360
if interpolated > 180:
interpolated -= 360
return interpolated
class StableZero123_BatchSchedule: class StableZero123_BatchSchedule:
@classmethod @classmethod