


"""simple docstring"""


from __future__ import annotations

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

# initial triangle of Koch snowflake
A  :     Union[str, Any]    					=    numpy.array([0, 0])
A  :     Optional[Any]    					=    numpy.array([0.5, 0.8_660_254])
A  :     Optional[int]    					=    numpy.array([1, 0])
A  :     Optional[Any]    					=    [VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]


def _lowerCamelCase			(	_UpperCamelCase					,				_UpperCamelCase   ):

			'''simple docstring'''




			__lowerCAmelCase       					=    initial_vectors
			for _ in range(_UpperCamelCase   ):
						__lowerCAmelCase       					=    iteration_step(_UpperCamelCase   )
			return vectors


def _lowerCamelCase			(	_UpperCamelCase   ):

			'''simple docstring'''




			__lowerCAmelCase       					=    []
			for i, start_vector in enumerate(vectors[:-1]   ):
						__lowerCAmelCase       					=    vectors[i + 1]
						new_vectors.append(_UpperCamelCase   )
						__lowerCAmelCase       					=    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			(	_UpperCamelCase					,				_UpperCamelCase   ):

			'''simple docstring'''




			__lowerCAmelCase       					=    numpy.radians(_UpperCamelCase   )
			__lowerCAmelCase					,			__lowerCAmelCase       					=    numpy.cos(_UpperCamelCase   ), numpy.sin(_UpperCamelCase   )
			__lowerCAmelCase       					=    numpy.array(((c, -s), (s, c))   )
			return numpy.dot(_UpperCamelCase					,				_UpperCamelCase   )


def _lowerCamelCase			(	_UpperCamelCase   ):

			'''simple docstring'''




			__lowerCAmelCase       					=    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()
			__lowerCAmelCase					,			__lowerCAmelCase       					=    zip(*_UpperCamelCase   )
			plt.plot(_UpperCamelCase					,				_UpperCamelCase   )
			plt.show()


if __name__ == "__main__":
	import doctest

	doctest.testmod()

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








"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A  :     Union[str, Any]    					=    {
    "configuration_x_clip": [
        "XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "XCLIPConfig",
        "XCLIPTextConfig",
        "XCLIPVisionConfig",
    ],
    "processing_x_clip": ["XCLIPProcessor"],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A  :     Optional[int]    					=    [
	    "XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "XCLIPModel",
	    "XCLIPPreTrainedModel",
	    "XCLIPTextModel",
	    "XCLIPVisionModel",
	]

if TYPE_CHECKING:
	from .configuration_x_clip import (
	    XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    XCLIPConfig,
	    XCLIPTextConfig,
	    XCLIPVisionConfig,
	)
	from .processing_x_clip import XCLIPProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_x_clip import (
		    XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
		    XCLIPModel,
		    XCLIPPreTrainedModel,
		    XCLIPTextModel,
		    XCLIPVisionModel,
		)

else:
	import sys

	A  :     Union[str, Any]    					=    _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




