



'''simple docstring'''






from __future__ import annotations

import matplotlib.pyplot as plt  # type: ignore
import numpy

# initial triangle of Koch snowflake
lowerCAmelCase:      Union[str, Any]		 =		numpy.array([0, 0])
lowerCAmelCase:      Optional[int]		 =		numpy.array([0.5, 0.866_0254])
lowerCAmelCase:      Tuple		 =		numpy.array([1, 0])
lowerCAmelCase:      int		 =		[VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]
def    lowerCamelCase__ (		_A				,    _A       ):
		a		:      List[str]       =  initial_vectors
		for _ in range(__lowercase       ):
				a		:      Tuple       =  iteration_step(__lowercase       )
		return vectors
def    lowerCamelCase__ (		_A       ):
		a		:      List[str]       =  []
		for i, start_vector in enumerate(vectors[:-1]       ):
				a		:      Tuple       =  vectors[i + 1]
				new_vectors.append(__lowercase       )
				a		:      int       =  end_vector - start_vector
				new_vectors.append(start_vector + difference_vector / 3       )
				new_vectors.append(
				    start_vector + difference_vector / 3 + rotate(difference_vector / 3				,    60       )       )
				new_vectors.append(start_vector + difference_vector * 2 / 3       )
		new_vectors.append(vectors[-1]       )
		return new_vectors
def    lowerCamelCase__ (		_A				,    _A       ):
		a		:      int       =  numpy.radians(__lowercase       )
		a		:      List[Any]       =  numpy.cos(__lowercase       ), numpy.sin(__lowercase       )
		a		:      Tuple       =  numpy.array(((c, -s), (s, c))       )
		return numpy.dot(__lowercase				,    __lowercase       )
def    lowerCamelCase__ (		_A       ):
		a		:      List[Any]       =  plt.gca()
		axes.set_aspect('equal'       )

		# matplotlib.pyplot.plot takes a list of all x-coordinates and a list of all
		# y-coordinates as inputs, which are constructed from the vector-list using
		# zip()
		a		:      Union[str, Any]       =  zip(*__lowercase       )
		plt.plot(__lowercase				,    __lowercase       )
		plt.show()


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					lowerCAmelCase:      Tuple		 =		iterate(INITIAL_VECTORS, 5)
					plot(processed_vectors)




'''simple docstring'''






from ..utils import DummyObject, requires_backends

class 							a__(      metaclass=lowerCamelCase__			):
    lowercase__				=					["""torch""", """torchsde"""]







    def __init__(   self				:						Any		,    *__snake_case				:						List[str]		,    **__snake_case				:						Tuple			):
      requires_backends(self		,    ['torch', 'torchsde']			)







    @classmethod
    def     lowercase_ (   cls				:						List[Any]		,    *__snake_case				:						str		,    **__snake_case				:						List[Any]			):
      requires_backends(cls		,    ['torch', 'torchsde']			)







    @classmethod
    def     lowercase_ (   cls				:						Dict		,    *__snake_case				:						Optional[Any]		,    **__snake_case				:						str			):
      requires_backends(cls		,    ['torch', 'torchsde']			)