{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Manim Community v0.18.0\n",
"\n",
"
\n"
],
"text/plain": [
"Manim Community \u001b[32mv0.\u001b[0m\u001b[32m18.0\u001b[0m\n",
"\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from manim import *\n",
"from manim_geometry import *\n",
"\n",
"config.media_embed = True\n",
"config.media_width = \"100%\"\n",
"_RV = \"-v WARNING -qm --progress_bar None --disable_caching\"\n",
"_RI = \"-v WARNING -s --progress_bar None --disable_caching\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Geos basics\n",
"\n",
"To start using ManimGeometry you have to instantiate the Geos class, and it receives the scene as a mandatory parameter.\n",
"\n",
"```py\n",
"class Example(Scene):\n",
" def construct(self):\n",
" geos = Geos(self)\n",
"```\n",
"\n",
"In addition to the scene you can receive these dictionaries:\n",
"\n",
"```py\n",
"DEFAULT_GEOS_STROKE_WIDTH = 3\n",
"DEFAULT_Z_INDEX_DOTS = 5\n",
"\n",
"class Geos:\n",
" DEFAULT_LINES_STYLE = {\n",
" \"stroke_width\": DEFAULT_GEOS_STROKE_WIDTH,\n",
" }\n",
" DEFAULT_CIRCLES_STYLE = {\n",
" \"stroke_width\": DEFAULT_GEOS_STROKE_WIDTH\n",
" }\n",
" DEFAULT_ARCS_STYLE = {\n",
" \"stroke_width\": DEFAULT_GEOS_STROKE_WIDTH\n",
" }\n",
" DEFAULT_DOTS_STYLE = {\n",
" \"stroke_width\": 0,\n",
" \"z_index\": DEFAULT_Z_INDEX_DOTS,\n",
" }\n",
" def __init__(self,\n",
" scene:Scene,\n",
" lines_style={},\n",
" dots_style={},\n",
" arcs_style={},\n",
" circles_style={},\n",
" ):\n",
" #........\n",
"```\n",
"\n",
"Dictionaries `lines_style`, `dots_style`, `arcs_style` and `circles_style` override the class variables you can see there.\n",
"\n",
".. note::\n",
" Example: `lines_style` override `DEFAULT_LINES_STYLE`.\n",
"\n",
"\n",
"Styles `DEFAULT_LINES_STYLE`, `DEFAULT_CIRCLES_STYLE`, `DEFAULT_ARCS_STYLE` and `DEFAULT_DOTS_STYLE` will apply to all objects created with this library, but can be changed individually.\n",
"\n",
"After defining geos you must use the `create_geos` method, here the construction process will be indicated, and it must have the following format:\n",
"\n",
"```py\n",
"geos = Geos(self)\n",
"geos.create_geos({\n",
" \"TN\": geos.some_method(),\n",
" #.....\n",
"})\n",
"```\n",
"\n",
"Where `T` is the type of object, it is important to respect the type since the library will use that information for some methods.\n",
"The `N` indicates a name, we give it that name, and it can have several letters, I recommend that they not be very long names, at most 3-4 letters.\n",
"\n",
"Example:\n",
"\n",
"```py\n",
"geos = Geos(self)\n",
"geos.create_geos({\n",
" \"dA\": geos.dot(...), # Dot with name A\n",
" \"dB\": geos.dot(...), # Dot with name B\n",
" \"lAB\": geos.line(\"dA\", \"dB\"), # Line from A to B\n",
"})\n",
"```\n",
"\n",
"In this example `dA` means that you are saving a Mobject of type `Dot`, and its name is `A`, the same for `dB`.\n",
"In the case of the line, it is not necessary to name it `AB`, it can be called anything, but it is important that it has the `l` or `b`at the beginning, that will be explained later.\n",
"\n",
"Once these elements are created, we can access them as an attribute:"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQAAAALQCAYAAADPfd1WAAAXvklEQVR4nO3dy4+edR2H4W87U9CCykJqWyBYAgERpNWEgxEpJsbYuFFWHv4CwV1DdGVcGQ26UHDlzhA3sjS4AklJSjCh5SBiQJAoLRRiUKEC7QwuqIZEhY46nfbmutbPL/ms3knueQ7rZub1AQAAAACS1q/1AAAAAABg9QiAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgA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ECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIQJgAAAAAAQJgACAAAAQJgACAAAAABhAiAAAAAAhAmAAAAAABAmAAIAAABAmAAIAAAAAGECIAAAAACECYAAAAAAECYAAgAAAECYAAgAAAAAYQIgAAAAAIT9HaJ62IuowZpPAAAAAElFTkSuQmCC",
"text/plain": [
"