




'''simple docstring'''



from __future__ import annotations

from numpy import array, cos, cross, floataa, radians, sin
from numpy.typing import NDArray







def       _UpperCamelCase			(_lowerCamelCase				:  float ,						_lowerCamelCase				:  float ,						_lowerCamelCase				:  bool = False						)-> list[float]:




     '''simple docstring'''





     if radian_mode:
          return [magnitude * cos(_lowerCamelCase						), magnitude * sin(_lowerCamelCase						)]
     return [magnitude * cos(radians(_lowerCamelCase						)						), magnitude * sin(radians(_lowerCamelCase						)						)]







def       _UpperCamelCase			(_lowerCamelCase				:  NDArray[floataa] ,						_lowerCamelCase				:  NDArray[floataa] ,						_lowerCamelCase				:  float = 10**-1						)-> bool:




     '''simple docstring'''





     __snake_case            =	cross(_lowerCamelCase ,						_lowerCamelCase						)
     __snake_case            =	sum(_lowerCamelCase						)
     return abs(_lowerCamelCase						) < eps


if __name__ == "__main__":
     # Test to check if it works
     UpperCAmelCase_							:	List[str]	     =		array(
         [
             polar_force(718.4, 1_8_0 - 3_0),
             polar_force(879.54, 4_5),
             polar_force(1_0_0, -9_0),
         ]
     )

     UpperCAmelCase_							:	NDArray[floataa]	     =		array([[0, 0], [0, 0], [0, 0]])

     assert in_static_equilibrium(forces, location)

     # Problem 1 in image_data/2D_problems.jpg
     UpperCAmelCase_							:	str	     =		array(
         [
             polar_force(3_0 * 9.81, 1_5),
             polar_force(2_1_5, 1_8_0 - 4_5),
             polar_force(2_6_4, 9_0 - 3_0),
         ]
     )

     UpperCAmelCase_							:	Optional[Any]	     =		array([[0, 0], [0, 0], [0, 0]])

     assert in_static_equilibrium(forces, location)

     # Problem in image_data/2D_problems_1.jpg
     UpperCAmelCase_							:	List[Any]	     =		array([[0, -2_0_0_0], [0, -1_2_0_0], [0, 1_5_6_0_0], [0, -1_2_4_0_0]])

     UpperCAmelCase_							:	int	     =		array([[0, 0], [6, 0], [1_0, 0], [1_2, 0]])

     assert in_static_equilibrium(forces, location)

     import doctest

     doctest.testmod()







"""simple docstring"""



from typing import List

from .keymap import KEYMAP, get_character

def  _A(		lowerCAmelCase							):

							def decorator(lowerCAmelCase							):
														A__       :     Any								=			getattr(lowerCAmelCase			,  """handle_key"""			,  []							)
														handle += [key]
														setattr(lowerCAmelCase			,  """handle_key"""			,  lowerCAmelCase							)
														return func

							return decorator

def  _A(		*lowerCAmelCase							):

							def decorator(lowerCAmelCase							):
														A__       :     Optional[Any]								=			getattr(lowerCAmelCase			,  """handle_key"""			,  []							)
														handle += keys
														setattr(lowerCAmelCase			,  """handle_key"""			,  lowerCAmelCase							)
														return func

							return decorator
class 						__UpperCAmelCase    (__A     ):







			'''simple docstring'''





			def __new__(			cls   ,      snake_case_   ,      snake_case_   ,      snake_case_							):







										'''simple docstring'''


										A__       :     Union[str, Any]								=			super().__new__(cls   ,      snake_case_   ,      snake_case_   ,      snake_case_							)
										if not hasattr(snake_case_   ,      """key_handler"""							):
																	setattr(snake_case_   ,      """key_handler"""   ,      {}							)
										setattr(snake_case_   ,      """handle_input"""   ,      KeyHandler.handle_input							)

										for value in attrs.values():
																	A__       :     Dict								=			getattr(snake_case_   ,      """handle_key"""   ,      []							)
																	for key in handled_keys:
																								A__       :     Optional[Any]								=			value
										return new_cls





			@staticmethod
			def 		lowerCamelCase					(			cls							):







										'''simple docstring'''


										A__       :     int								=			get_character()
										if char != KEYMAP["undefined"]:
																	A__       :     Union[str, Any]								=			ord(snake_case_							)
										A__       :     int								=			cls.key_handler.get(snake_case_							)
										if handler:
																	A__       :     int								=			char
																	return handler(cls							)
										else:
																	return None





def  _A(		cls							):
							return KeyHandler(cls.__name__			,  cls.__bases__			,  cls.__dict__.copy()							)





