function documentation¶
-
class
main.
Figures
(im, mode=None)[source]¶ A lot of function to create some well-know shapes
-
static
_int
(value)[source]¶ Make a tuple of float coordinate into tuple of int coordinate
Parameters: value (tuple) – Tuple to convert Returns: new tuple with int values Return type: tuple(int, int)
-
blanc_manger
(origin, finish, iterations, color=None, width=0)[source]¶ Trace blanc manger curve
Parameters: - origin (tuple) – coordinate of the starting point
- finish (tuple) – coordinate of the ending point
- iterations (int) – iterations for the drawings
- color (tuple) – color to use for the lines
- width (int) – the line width, in pixels
-
static
complex_to_point
(point)[source]¶ Transform tuple to complex
Parameters: point (complex) – Point to convert Returns: tuple representation of point Return type: tuple
-
homothety
(point, center=0j, size=0)[source]¶ Homothety of point in complex plane
Parameters: - point (tuple or complex) – point (or list of point) to make homothety
- center (tuple or complex) – center of homothety
- size (float) – size of homothety
Returns: Homothety of point (or list of homothety of points)
Return type: tuple or list of tuples
-
static
point_to_complex
(point)[source]¶ Transform tuple to complex
Parameters: point (tuple) – Point to convert Returns: Complex representation of point Return type: complex
-
rotation
(point, center=0j, angle=0)[source]¶ Rotate point in complex plane
Parameters: - point (tuple or complex) – point (or list of point) to rotate
- center (tuple or complex) – center of rotation
- angle (float) – angle of rotation
Returns: Rotated point (or list of rotated points)
Return type: tuple or list of tuples
-
translation
(point, vect)[source]¶ Translate point in complex plane
Parameters: - point (tuple or complex) – point (or list of point) to translate
- vect (tuple or complex) – vector of translation
Returns: Translated point (or list of translated points)
Return type: tuple or list of tuples
-
von_koch_curve
(origin, finish, iterations=1, color=None, width=0)[source]¶ Draw thee von koch flake on image.
Parameters: - origin (tuple) – coordinate of the starting point
- finish (tuple) – coordinate of the ending point
- iterations (int) – iterations for the drawings
- color (tuple) – color to use for the lines
- width (int) – the line width, in pixels
-
von_koch_curve_flake
(origin, radius, iterations, angle=0, color=None, width=0)[source]¶ Draw thee von koch flake on image.
Parameters: - origin (tuple) – coordinate of the center of circumscribed circle of main triangle
- radius (float) – radius of circumscribed circle of main triangle
- iterations (int) – iterations for the drawings
- angle (float) – rotation of main triangle
- color (tuple) – color to use for the lines
- width (int) – the line width, in pixels
-
static
-
class
main.
Lsystem
(*args, **kwargs)[source]¶ Draw a L system
-
_backward
(distance)[source]¶ Backward pen of distance
Parameters: distance (float) – Distance to backward
-
_forward
(distance)[source]¶ Forward pen of distance
Parameters: distance (float) – Distance to forward
-
backward
(distance)[source]¶ Return a lambda function which make pen backward of distance
Parameters: distance (float) – Distance to build function Returns: lambda function to make pen backward Return type: lambda
-
draw_l
(start, replacement, constants, nb_recursive, color=(255, 255, 255), width=0)[source]¶ Draw a L system
Parameters: - start (str) – Axiome
- replacement (dict) – Dictionary which contain replacement values (F->F+F-F-F+F)
- constants (dict) – Dictionary which contain all elements with there function
- nb_recursive (int) – Number of recursion
- color (tuple) – Color to use for the drawing
- width (int) – The line width, in pixels
-
forward
(distance)[source]¶ Return a lambda function which make pen forward of distance
Parameters: distance (float) – Distance to build function Returns: lambda function to make pen forward Return type: lambda
-
left
(angle)[source]¶ Return a lambda function which make pen turning of angle radians to left
Parameters: angle (float) – Angle to build function Returns: lambda function to make pen turning left Return type: lambda
-
restore
()[source]¶ Return a lambda function which restore state of pen
Returns: lambda function to restore pen state Return type: lambda
-