Sindbad~EG File Manager
�
%ٜg�� � � � d dl mZ d dlZ d dlmZmZmZ dZd� Z d� Z
d� Zd� Zd � Z
d
� Zd� Zd� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"d� Z#d � Z$d!� Z%dLd"�Z&dLd#�Z'dLd$�Z(dLd%�Z)dLd&�Z*dLd'�Z+d(� Z,d)� Z-d*� Z.d+� Z/d,� Z0d-� Z1d.� Z2d/� Z3d0� Z4d1� Z5d2� Z6d3� Z7d4� Z8d5� Z9d6� Z:d7� Z;d8� Z<d9� Z= dMd:�Z>dMd;�Z? dMd<�Z@dMd=�ZA dNd>�ZBdNd?�ZCdOd@�ZDdOdA�ZEdOdB�ZFdOdC�ZGdOdD�ZHdOdE�ZIdF� ZJdG� ZKdH� ZLdI� ZMdJ� ZNdK� ZOy# e$ r Y ��w xY w)P� )�divisionN)�List�Tuple�Unionz1.2.0c � � t | � t |� t |� t |� f\ } }}}g }t ||z
� t || z
� kD }|r|| }} ||}}d}| |kD r
|| }} ||}}d}|| z
}t ||z
� }t |dz � } |}
d}||k rd}nd}t | |dz � D ]@ }|r|j |
|f� n|j ||
f� | |z } | dk s�7|
|z
}
| |z
} �B |r|j � |S )a0 Returns a list of (x, y) tuples of every point on a line between
(x1, y1) and (x2, y2). The x and y values inside the tuple are integers.
Line generated with the Bresenham algorithm.
Args:
x1 (int, float): The x coordinate of the line's start point.
y1 (int, float): The y coordinate of the line's start point.
x2 (int, float): The x coordinate of the line's end point.
y2 (int, float): The y coordiante of the line's end point.
Returns:
[(x1, y1), (x2, y2), (x3, y3), ...]
Example:
>>> getLine(0, 0, 6, 6)
[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]
>>> getLine(0, 0, 3, 6)
[(0, 0), (0, 1), (1, 2), (1, 3), (2, 4), (2, 5), (3, 6)]
>>> getLine(3, 3, -3, -3)
[(3, 3), (2, 2), (1, 1), (0, 0), (-1, -1), (-2, -2), (-3, -3)]
FT� N� ���r )�int�abs�range�append�reverse)
�x1�y1�x2�y2�points�issteep�rev�deltax�deltay�error�y�ystep�xs
�>/usr/local/lib/python3.12/site-packages/pytweening/__init__.py�getLiner s- � �. ��W�c�"�g�s�2�w��B��7�N�B��B��
�F��"�r�'�l�S��b��\�)�G���R�B���R�B��
�C� �B�w��R�B���R�B����
�"�W�F�
��b��\�F����
�O�E�
�A��E� �B�w�����
�2�r�A�v�
����M�M�1�a�&�!��M�M�1�a�&�!�
�����1�9�
��J�A��V�O�E� � ������M� c �. � || z
|z | z ||z
|z |z fS )a# Returns the (x, y) tuple of the point that has progressed a proportion
n along the line defined by the two x, y coordinates.
Args:
startX (int, float): The x coordinate of the line's start point.
startY (int, float): The y coordinate of the line's start point.
endX (int, float): The x coordinate of the line's end point.
endY (int, float): The y coordinate of the line's end point.
n (int, float): Progress along the line. 0.0 is the start point, 1.0 is the end point. 0.5 is the midpoint. This value can be less than 0.0 or greater than 1.0.
Returns:
Tuple of floats for the x, y coordinate of the point.
Example:
>>> getPointOnLine(0, 0, 6, 6, 0)
(0, 0)
>>> getPointOnLine(0, 0, 6, 6, 1)
(6, 6)
>>> getPointOnLine(0, 0, 6, 6, 0.5)
(3.0, 3.0)
>>> getPointOnLine(0, 0, 6, 6, 0.75)
(4.5, 4.5)
>>> getPointOnLine(3, 3, -3, -3, 0.5)
(0.0, 0.0)
>>> getPointOnLine(3, 3, -3, -3, 0.25)
(1.5, 1.5)
>>> getPointOnLine(3, 3, -3, -3, 0.75)
(-1.5, -1.5)
� )�startX�startY�endX�endY�ns r �getPointOnLiner'