### Complete Example - Nine Point Circle Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates constructing and verifying the nine-point circle theorem using ManimGeo's automatic dependency management. ```APIDOC ## Complete Example - Nine Point Circle ### Description Demonstrates constructing and verifying the nine-point circle theorem using ManimGeo's automatic dependency management. ### Method Not applicable (Script) ### Endpoint Not applicable (Script) ### Parameters None ### Request Example ```python import numpy as np from manimgeo.components import Point, LineSegment, InfinityLine, Circle from manimgeo.utils import GeoUtils # Construct triangle ABC A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([5, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") # Construct edges AB = LineSegment.PP(A, B, "AB") BC = LineSegment.PP(B, C, "BC") AC = LineSegment.PP(A, C, "AC") # Three midpoints of sides AB_mid = Point.MidPP(A, B, "AB_mid") BC_mid = Point.MidPP(B, C, "BC_mid") AC_mid = Point.MidPP(A, C, "AC_mid") # Three altitude feet AB_foot = Point.VerticalPL(C, AB, "AB_foot") BC_foot = Point.VerticalPL(A, BC, "BC_foot") AC_foot = Point.VerticalPL(B, AC, "AC_foot") # Orthocenter and three Euler points (midpoints from vertices to orthocenter) orthocenter = Point.IntersectionLL( InfinityLine.PP(AB_foot, C), InfinityLine.PP(BC_foot, A), True, # Treat as infinite lines "Orthocenter" ) euler_A = Point.MidPP(A, orthocenter, "Euler_A") euler_B = Point.MidPP(B, orthocenter, "Euler_B") euler_C = Point.MidPP(C, orthocenter, "Euler_C") # Construct nine-point circle through the three midpoints nine_point_circle = Circle.PPP(AB_mid, BC_mid, AC_mid, "NinePointCircle") print(f"Nine-point circle: center={nine_point_circle.center}, radius={nine_point_circle.radius:.4f}") # Verify all nine points lie on the circle all_nine_points = [ AB_mid, BC_mid, AC_mid, # Midpoints AB_foot, BC_foot, AC_foot, # Altitude feet euler_A, euler_B, euler_C # Euler points ] for point in all_nine_points: distance = np.linalg.norm(point.coord - nine_point_circle.center) assert np.isclose(distance, nine_point_circle.radius), f"{point.name} not on circle" print(f"{point.name}: distance to center = {distance:.4f} (radius = {nine_point_circle.radius:.4f})") print("\nAll nine points verified on the nine-point circle!") # Show dependency graph print("\nDependency tree from vertex A:") GeoUtils.print_dependencies(A, max_depth=3) ``` ### Response Not applicable (Script) ### Response Example Not applicable (Script) ``` -------------------------------- ### LineAdapter Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.line.md Provides an adapter interface for line objects, offering access to properties like start, end, length, and unit direction. ```APIDOC ## Class: LineAdapter ### Description An adapter class for line objects in ManimGeo, providing convenient access to line properties. ### Attributes - **start** (Point) - The starting point of the line. - **end** (Point) - The ending point of the line. - **length** (float) - The total length of the line. - **unit_direction** (Vector) - The normalized direction vector of the line. - **model_config** (dict) - Configuration for the Pydantic model. ### Request Example ```python # Assuming 'line_obj' is an instance of a class that can be adapted by LineAdapter adapter = LineAdapter(line_obj) print(adapter.start) print(adapter.length) ``` ### Response #### Success Response (200) - **start** (Point) - The starting point of the line. - **end** (Point) - The ending point of the line. - **length** (float) - The total length of the line. - **unit_direction** (Vector) - The normalized direction vector of the line. - **model_config** (dict) - Configuration for the Pydantic model. #### Response Example ```json { "start": {"x": 0, "y": 0, "z": 0}, "end": {"x": 1, "y": 1, "z": 0}, "length": 1.414, "unit_direction": {"x": 0.707, "y": 0.707, "z": 0} } ``` ``` -------------------------------- ### Define Point by Extension Through Two Points Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.point.args.md Models the arguments for a point constructed by extending from a start point through another point, with a specified factor. It requires 'start', 'through' (both Point), and 'factor' (Number). ```python class ExtensionPPArgs(ArgsModelBase): construct_type: Literal['ExtensionPP'] start: Point through: Point factor: Number model_config = {'arbitrary_types_allowed': True, 'frozen': False} ``` -------------------------------- ### Define Angle Argument Models Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.angle.args.md Examples of defining angle argument models using Pydantic. These classes inherit from ArgsModelBase and define the required parameters for different geometric angle constructions. ```python from pydantic import BaseModel, ConfigDict from typing import Literal class PPPArgs(BaseModel): construct_type: Literal['PPP'] = 'PPP' start: 'Point' center: 'Point' end: 'Point' model_config = ConfigDict(arbitrary_types_allowed=True) class LLArgs(BaseModel): construct_type: Literal['LL'] = 'LL' line1: 'Line' line2: 'Line' model_config = ConfigDict(arbitrary_types_allowed=True) class NArgs(BaseModel): construct_type: Literal['N'] = 'N' angle: float turn: Literal['Clockwise', 'Counterclockwise'] model_config = ConfigDict(arbitrary_types_allowed=True) ``` -------------------------------- ### Constructing Free Points in ManimGeo Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates how to initialize independent points in 2D/3D space. These points act as leaf nodes in the dependency graph, where updates to coordinates propagate to downstream objects. ```python import numpy as np from manimgeo.components import Point # Create free points with 2D or 3D coordinates A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([5, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") # Access point properties print(f"Point {A.name} at {A.coord}") # Move a free point - all dependents automatically update A.set_coord(np.array([1, 1, 0])) print(f"Point {A.name} moved to {A.coord}") ``` -------------------------------- ### Line Class Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.line.md The core `Line` class in ManimGeo, representing a geometric line segment with properties like start, end, length, and direction. ```APIDOC ## Class: Line ### Description The primary class for representing a line segment in ManimGeo. It provides methods and attributes to define, manipulate, and query line properties. ### Attributes - **attrs** (dict) - Internal attributes of the line. - **start** (Point) - The starting point of the line segment. - **end** (Point) - The ending point of the line segment. - **length** (float) - The calculated length of the line segment. - **unit_direction** (Vector) - The normalized direction vector of the line segment. ### Request Example ```python from manimgeo.components.line.line import Line # Example using point-point construction line1 = Line(point1=[0, 0, 0], point2=[1, 1, 0]) print(f"Line 1 Start: {line1.start}") print(f"Line 1 Length: {line1.length}") # Example using point-vector construction line2 = Line(start=[0, 0, 0], vector=[2, 0, 0]) print(f"Line 2 End: {line2.end}") print(f"Line 2 Unit Direction: {line2.unit_direction}") ``` ### Response #### Success Response (200) - **attrs** (dict) - Internal attributes. - **start** (Point) - Starting coordinates. - **end** (Point) - Ending coordinates. - **length** (float) - Length of the line. - **unit_direction** (Vector) - Normalized direction vector. #### Response Example ```json { "attrs": {}, "start": {"x": 0, "y": 0, "z": 0}, "end": {"x": 1, "y": 1, "z": 0}, "length": 1.4142135623730951, "unit_direction": {"x": 0.7071067811865475, "y": 0.7071067811865475, "z": 0.0} } ``` ``` -------------------------------- ### Line Object Construction (Segments, Rays, Infinite Lines) Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates the creation of various line objects including finite segments, rays, and infinite lines using different construction methods like point pairs or point-vector. ```python import numpy as np from manimgeo.components import Point, Vector, LineSegment, Ray, InfinityLine A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([4, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") # Line segment from two points AB = LineSegment.PP(A, B, "AB") print(f"Segment {AB.name}: start={AB.start}, end={AB.end}, length={AB.length}") # Ray from two points (extends infinitely from start through end) ray = Ray.PP(A, C, "ray_AC") print(f"Ray {ray.name}: unit_direction={ray.unit_direction}") # Infinite line through two points line = InfinityLine.PP(B, C, "line_BC") print(f"Line {line.name}: direction={line.unit_direction}") # Line from point and direction vector v = Vector.N(np.array([1, 1, 0]), "v") line_pv = InfinityLine.PV(A, v, "line_from_vector") print(f"Line from vector: direction={line_pv.unit_direction}") # Perpendicular line through a point perp = InfinityLine.VerticalPL(C, AB, "perpendicular") print(f"Perpendicular line unit direction: {perp.unit_direction}") # Parallel line through a point parallel = InfinityLine.ParallelPL(C, AB, distance=1, name="parallel") print(f"Parallel line: start={parallel.start}") ``` -------------------------------- ### Point Inversion on Circle Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates how to perform point inversion with respect to a circle using ManimGeo. It takes a point and a circle as input and returns the inverted point. ```python from manimgeo.components import Circle, Point circle = Circle.PR(A, 4.0, name="circle") B_inverted = Point.InversionPCir(B, circle, "B_inverted") print(f"Inverted B: {B_inverted.coord}") ``` -------------------------------- ### PPArgs: Point-to-Point Vector Arguments Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.vector.args.md Represents a vector defined by its start and end points. This model is used for constructing vectors based on two Point objects. ```python class PPArgs(ArgsModelBase): construct_type: Literal['PP'] = 'PP' start: Point end: Point model_config = {'arbitrary_types_allowed': True, 'frozen': False} ``` -------------------------------- ### Nine Point Circle Theorem Construction and Verification Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates constructing a triangle, its key associated points (midpoints, altitude feet, Euler points), and the nine-point circle. It verifies that all nine points lie on the constructed circle and shows the dependency graph. ```python import numpy as np from manimgeo.components import Point, LineSegment, InfinityLine, Circle from manimgeo.utils import GeoUtils # Construct triangle ABC A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([5, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") # Construct edges AB = LineSegment.PP(A, B, "AB") BC = LineSegment.PP(B, C, "BC") AC = LineSegment.PP(A, C, "AC") # Three midpoints of sides AB_mid = Point.MidPP(A, B, "AB_mid") BC_mid = Point.MidPP(B, C, "BC_mid") AC_mid = Point.MidPP(A, C, "AC_mid") # Three altitude feet AB_foot = Point.VerticalPL(C, AB, "AB_foot") BC_foot = Point.VerticalPL(A, BC, "BC_foot") AC_foot = Point.VerticalPL(B, AC, "AC_foot") # Orthocenter and three Euler points (midpoints from vertices to orthocenter) orthocenter = Point.IntersectionLL( InfinityLine.PP(AB_foot, C), InfinityLine.PP(BC_foot, A), True, # Treat as infinite lines "Orthocenter" ) euler_A = Point.MidPP(A, orthocenter, "Euler_A") euler_B = Point.MidPP(B, orthocenter, "Euler_B") euler_C = Point.MidPP(C, orthocenter, "Euler_C") # Construct nine-point circle through the three midpoints nine_point_circle = Circle.PPP(AB_mid, BC_mid, AC_mid, "NinePointCircle") print(f"Nine-point circle: center={nine_point_circle.center}, radius={nine_point_circle.radius:.4f}") # Verify all nine points lie on the circle all_nine_points = [ AB_mid, BC_mid, AC_mid, # Midpoints AB_foot, BC_foot, AC_foot, # Altitude feet euler_A, euler_B, euler_C # Euler points ] for point in all_nine_points: distance = np.linalg.norm(point.coord - nine_point_circle.center) assert np.isclose(distance, nine_point_circle.radius), f"{point.name} not on circle" print(f"{point.name}: distance to center = {distance:.4f} (radius = {nine_point_circle.radius:.4f})") print("\nAll nine points verified on the nine-point circle!") # Show dependency graph print("\nDependency tree from vertex A:") GeoUtils.print_dependencies(A, max_depth=3) ``` -------------------------------- ### NPPArgs: Numpy Point-to-Point Vector Arguments Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.vector.args.md Represents a vector defined by start and end points using numpy ndarrays. This model is for vectors specified by two numpy arrays. ```python class NPPArgs(ArgsModelBase): construct_type: Literal['NPP'] = 'NPP' start: ndarray end: ndarray model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'frozen': False} ``` -------------------------------- ### Vector Construction and Properties Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Shows how to create Vector objects from pairs of points or using explicit coordinates. It also highlights properties like the vector's components, norm, and unit direction. ```python import numpy as np from manimgeo.components import Point, Vector, LineSegment A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([3, 4, 0]), "B") # Vector from two points v1 = Vector.PP(A, B, "AB_vec") print(f"Vector {v1.name}: vec={v1.vec}, norm={v1.norm}, unit={v1.unit_direction}") ``` -------------------------------- ### Circle Construction and Transformations Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Illustrates various methods for constructing Circle objects, including using center and radius, center and a point, three points, or a line segment as diameter. Also shows transformations like translation and inversion. ```python import numpy as np from manimgeo.components import Point, Circle, LineSegment, Vector A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([3, 0, 0]), "B") C = Point.Free(np.array([0, 4, 0]), "C") # Circle from center and radius circle1 = Circle.PR(A, 5.0, name="circle_radius") print(f"Circle: center={circle1.center}, radius={circle1.radius}") print(f"Area={circle1.area:.2f}, Circumference={circle1.circumference:.2f}") # Circle from center and point on circle circle2 = Circle.PP(A, B, name="circle_point") print(f"Circle through B: radius={circle2.radius}") # Circle through three points (circumscribed circle) D = Point.Free(np.array([3, 4, 0]), "D") circumcircle = Circle.PPP(A, B, D, "circumcircle") print(f"Circumcircle: center={circumcircle.center}, radius={circumcircle.radius}") # Inscribed circle of triangle inscribed = Circle.InscribePPP(A, B, C, "inscribed") print(f"Inscribed circle: center={inscribed.center}, radius={inscribed.radius:.2f}") # Circle from radius line segment radius_seg = LineSegment.PP(A, B, "radius_segment") circle3 = Circle.L(radius_seg, name="circle_from_segment") print(f"Circle from segment: radius={circle3.radius}") # Translation of circle v = Vector.N(np.array([2, 2, 0]), "v") translated = Circle.TranslationCirV(circle1, v, "translated_circle") print(f"Translated center: {translated.center}") # Inverse circle (circle inversion) inverse = Circle.InverseCirCir(circle2, circle1, "inverse_circle") print(f"Inverse circle radius: {inverse.radius}") # Get point on circle at angle (in radians) point_on_circle = circle1.get_point_at_angle(np.pi / 4) print(f"Point at 45 degrees: {point_on_circle}") ``` -------------------------------- ### Create and Manipulate Vectors in ManimGeo Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates how to create vectors from line segments, explicit coordinates, or norm and direction. Also shows vector arithmetic operations like addition, subtraction, and scalar multiplication. ```python from manim import * from manimgeo.components import Point, Angle, LineSegment, InfinityLine, Vector # Vector from line segment # Assuming A and B are defined Point objects A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([4, 0, 0]), "B") AB = LineSegment.PP(A, B, "AB") v2 = Vector.L(AB, "seg_vec") print(f"Vector from segment: {v2.vec}") # Vector from explicit coordinates v3 = Vector.N(np.array([1, 0, 0]), "unit_x") print(f"Unit x vector: {v3.vec}") # Vector from norm and direction v4 = Vector.NNormDirection(5.0, np.array([0.6, 0.8, 0]), "scaled") print(f"Scaled vector: {v4.vec}") # [3. 4. 0.] # Vector arithmetic (creates new dependent vectors) # Assuming v1 is a defined Vector object v1 = Vector.N(np.array([1, 1, 0]), "v1") v_sum = v1 + v3 # Addition print(f"v1 + v3 = {v_sum.vec}") v_diff = v1 - v3 # Subtraction print(f"v1 - v3 = {v_diff.vec}") v_scaled = v1 * 2 # Scalar multiplication print(f"v1 * 2 = {v_scaled.vec}") ``` -------------------------------- ### Construct and Operate on Angles in ManimGeo Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Shows how to create angles using three points, two lines, or explicit values. Supports operations like scaling, addition, and reversing the turn direction. ```python import numpy as np from manimgeo.components import Point, Angle, LineSegment, InfinityLine A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([4, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") # Angle from three points (start, center, end) angle_BAC = Angle.PPP(B, A, C, "angle_BAC") print(f"Angle {angle_BAC.name}: {np.degrees(angle_BAC.angle):.2f} degrees") print(f"Direction: {angle_BAC.turn}") # Counterclockwise or Clockwise # Angle from two lines AB = InfinityLine.PP(A, B, "AB") AC = InfinityLine.PP(A, C, "AC") angle_lines = Angle.LL(AB, AC, "angle_lines") print(f"Angle between lines: {np.degrees(angle_lines.angle):.2f} degrees") # Angle from line segment and point seg = LineSegment.PP(A, B, "seg") angle_lp = Angle.LP(seg, C, "angle_LP") print(f"Angle from segment to point: {np.degrees(angle_lp.angle):.2f} degrees") # Explicit angle value (in radians) right_angle = Angle.N(np.pi / 2, turn="Counterclockwise", name="right_angle") print(f"Right angle: {np.degrees(right_angle.angle):.2f} degrees") # Angle arithmetic half_angle = right_angle * 0.5 print(f"Half of right angle: {np.degrees(half_angle.angle):.2f} degrees") angle_sum = angle_BAC + right_angle print(f"Sum: {np.degrees(angle_sum.angle):.2f} degrees") # Reverse angle direction reversed_angle = Angle.TurnA(angle_BAC, "reversed") print(f"Reversed: {np.degrees(reversed_angle.angle):.2f} degrees") ``` -------------------------------- ### GeometryAdapter Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.base.md Documentation for the GeometryAdapter class, which handles geometry adaptations. ```APIDOC ## GeometryAdapter ### Description Represents an adapter for geometry objects, providing methods to bind attributes and define construction types. ### Class `manimgeo.components.base.base_adapter.GeometryAdapter` ### Attributes - **args** - Description of args - **construct_type** - Description of construct_type - **model_config** - Description of model_config ### Methods - **bind_attributes()** - Description of bind_attributes method ``` -------------------------------- ### Applying Geometric Transformations to Points Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates derived point construction using geometric transformations such as reflection, projection, translation, and extension. ```python import numpy as np from manimgeo.components import Point, LineSegment, InfinityLine, Circle, Vector A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([4, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") AB = InfinityLine.PP(A, B, "AB") N = Point.ExtensionPP(A, B, factor=2.0, name="N") C_reflected = Point.AxisymmetricPL(C, AB, "C_reflected") foot = Point.VerticalPL(C, AB, "foot") v = Vector.N(np.array([1, 2, 0]), "v") A_translated = Point.TranslationPV(A, v, "A_translated") ``` -------------------------------- ### ManimGeo Utilities Module Functions Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/modules.md This section details functions and classes available in the manimgeo.utils module and its submodules. ```APIDOC ## manimgeo.utils.config ### Description Handles configuration for ManimGeo. ### Classes - `GeoConfig`: Configuration class for ManimGeo. ## manimgeo.utils.output ### Description Provides utilities for output formatting, including color manipulation. ### Functions - `generate_simple_color(color_name)`: Generates a simple color value. - `hsl_to_rgb(h, s, l)`: Converts HSL color values to RGB. - `generate_color_from_id(id_value)`: Generates a color based on an ID. - `color_text(text, color)`: Applies color to text. ## manimgeo.utils.utils ### Description General utility functions. ### Functions - `flatten(nested_list)`: Flattens a nested list. - `print_dependencies()`: Prints the project's dependencies. ## manimgeo.utils.version ### Description Utilities for checking library versions. ### Functions - `check_library_version(library_name, required_version)`: Checks if a library is installed and meets the required version. ``` -------------------------------- ### PointAdapter Class Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.point.adapter.md Details the PointAdapter class, its attributes, and configuration. ```APIDOC ## Class: manimgeo.components.point.adapter.PointAdapter ### Description An adapter class for Point constructs, inheriting from GeometryAdapter. ### Attributes - **coord** (ndarray): Represents the coordinates of the point. - **model_config** (ClassVar[ConfigDict]): Configuration for the Pydantic model, allowing arbitrary types and disabling freezing. ### Example Usage ```python from manimgeo.components.point.adapter import PointAdapter import numpy as np # Assuming PointConstructArgs is defined elsewhere and compatible # For demonstration, we'll use a placeholder class PointConstructArgs: pass # Example of creating a PointAdapter instance # Note: The actual initialization might require specific arguments based on PointConstructArgs # This is a simplified example. point_data = PointConstructArgs() point_data.coord = np.array([1, 2, 3]) # Example coordinate adapter = PointAdapter(data=point_data) print(adapter.coord) print(adapter.model_config) ``` ``` -------------------------------- ### JAnim Geometry Animation with GeoJAnimManager Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Integrates ManimGeo geometry with JAnim for animations. It creates VItems that automatically track geometric changes and can be added to the JAnim timeline. Error handling is consistent with the ManimGL manager. ```python # Requires: pip install manimgeo[janim] import numpy as np from manimgeo.components import Point, LineSegment, Circle from manimgeo.anime.janim import GeoJAnimManager # In a JAnim Timeline class: # from janim.imports import Timeline # class MyTimeline(Timeline): # def construct(self): # manager = GeoJAnimManager(self) # Pass timeline for auto-updater # Create geometry A = Point.Free(np.array([0, 0]), "A") B = Point.Free(np.array([3, 0]), "B") circle = Circle.PP(A, B, name="circle") # Example without actual JAnim runtime: # manager = GeoJAnimManager() # Create VItems with updaters # vitem, updater = manager.create_vitem_from_geometry(A) # Create multiple VItems and add updaters to timeline at once # vitems = manager.create_vitems_with_add_updater( # [A, B, circle], # duration=2.0 # Animation duration for updaters # ) # Control tracing # manager.start_trace() # Begin tracking geometry changes # manager.stop_trace() # Stop tracking # Error handling configuration (same as ManimGL) # manager.set_on_error_exec("vis") # Hide on error ``` -------------------------------- ### Visualize Dependencies with GeoUtils in ManimGeo Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Utilizes the GeoUtils class to visualize the dependency graph of geometric objects. Useful for debugging complex scenes by showing how objects relate to each other. ```python import numpy as np from manimgeo.components import Point, LineSegment, Circle from manimgeo.utils import GeoUtils # Build a geometry scene A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([4, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") AB = LineSegment.PP(A, B, "AB") M = Point.MidL(AB, "M") circumcircle = Circle.PPP(A, B, C, "circumcircle") # Print dependency tree from a root object print("Dependencies of A:") GeoUtils.print_dependencies(A) # Output shows all objects that depend on A: # · Point - (A) # · LineSegment - (AB) # · Point - (M) # · Circle - (circumcircle) # Limit depth for complex graphs GeoUtils.print_dependencies(A, max_depth=2) ``` -------------------------------- ### ManimGeo Components Package Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.md Documentation for the manimgeo.components package, which includes various geometric components. ```APIDOC ## manimgeo.components Package ### Description This package houses reusable geometric components and their adapters. ### Subpackages - **angle**: Contains modules for handling angles and their representations. - **base**: Provides base classes and adapters for geometric objects. ### Modules and Classes #### Angle Package (`manimgeo.components.angle`) - **AngleAdapter (`manimgeo.components.angle.adapter.AngleAdapter`)**: Adapter for angle-related functionalities. - **Angle (`manimgeo.components.angle.angle.Angle`)**: Represents an angle. - **Args (`manimgeo.components.angle.args`)**: Contains various argument types for angle construction and manipulation, including: - `Number` - `PPPArgs` (Point-Point-Point arguments) - `LLArgs` (Line-Line arguments) - `LPArgs` (Line-Point arguments) - `NArgs` (Number arguments) - `TurnAArgs` (Turn-Angle arguments) - `AddAAArgs` (Add-Angle-Angle arguments) - `SubAAArgs` (Subtract-Angle-Angle arguments) - `MulNAArgs` (Multiply-Number-Angle arguments) - `AngleConstructArgs` - `AngleConstructType` #### Base Package (`manimgeo.components.base`) - **GeometryAdapter (`manimgeo.components.base.base_adapter.GeometryAdapter`)**: A base adapter class for geometric objects. This class appears to have multiple aliased references within the documentation. ``` -------------------------------- ### ManimGeo Math Module Functions Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/modules.md This section details functions available in the manimgeo.math module and its submodules. ```APIDOC ## manimgeo.math.planes ### Description Provides functions related to geometric planes. ### Functions - `plane_get_ABCD()`: Retrieves the coefficients of a plane in ABCD form. ## manimgeo.math.points ### Description Provides functions for working with points in geometric contexts. ### Functions - `axisymmetric_point(point, axis)`: Calculates the axisymmetric point with respect to a given axis. - `inversion_point(point, center, radius)`: Computes the inversion of a point with respect to a circle. ## manimgeo.math.three_points ### Description Provides functions for geometric calculations involving three points. ### Functions - `inscribed(p1, p2, p3)`: Calculates properties related to the inscribed circle of a triangle defined by three points. - `circumcenter(p1, p2, p3)`: Computes the circumcenter of a triangle defined by three points. - `orthocenter(p1, p2, p3)`: Computes the orthocenter of a triangle defined by three points. ## manimgeo.math.vectors ### Description Provides functions for vector operations. ### Functions - `unit_direction_vector(p1, p2)`: Calculates the unit direction vector between two points. - `get_two_vector_from_normal(normal_vector)`: Derives two orthogonal vectors from a given normal vector. ``` -------------------------------- ### LineAdapter Class Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.line.adapter.md Details about the LineAdapter class, including its attributes and configuration. ```APIDOC ## Class: LineAdapter ### Description Represents a line segment with start and end points, providing properties like length and unit direction. It inherits from GeometryAdapter and uses Pydantic for configuration. ### Attributes - **start** (ndarray) - The starting point of the line. - **end** (ndarray) - The ending point of the line. - **length** (Number) - The total length of the line. - **unit_direction** (ndarray) - The normalized direction vector of the line. ### Configuration - **model_config** (ClassVar[ConfigDict]) - Configuration for the Pydantic model, allowing arbitrary types and specifying if the model is frozen. - `arbitrary_types_allowed`: True - `frozen`: False ``` -------------------------------- ### ManimGeo Anime Package Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.md Documentation for the manimgeo.anime package, which handles animation-related functionalities. ```APIDOC ## manimgeo.anime Package ### Description This package contains modules for managing and executing animations within ManimGeo. ### Subpackages - **janim**: Contains modules related to J-animations. - **manimgl**: Contains modules related to ManimGL integration. ### Modules - **manager**: Provides `GeoManager` for controlling animation updates and traces. - **state**: Provides `StateManager` for managing animation states and strategies. ### Key Classes and Methods #### GeoManager (`manimgeo.anime.manager.GeoManager`) - **start_update()**: Starts the animation update process. - **start_trace()**: Begins tracing animation events. - **stop_trace()**: Stops tracing animation events. #### StateManager (`manimgeo.anime.state.StateManager`) - **states**: Accesses the current animation states. - **manage_type**: Defines the type of state management. - **strategy_func**: The function used for state strategy. - **set_strategy_func(func)**: Sets the strategy function for state management. - **update()**: Updates the animation state. ``` -------------------------------- ### Circle Argument Classes Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.circle.md Documentation for various argument classes used to define circles based on different input parameters. ```APIDOC ## Circle Argument Classes ### Description These classes define the structure for arguments used to construct circles, catering to different definition methods. ### CNRArgs Defines a circle using Center, Normal, and Radius. - **Class**: `manimgeo.components.circle.args.CNRArgs` - **Fields**: - `construct_type` (str) - Type of construction ('CNR'). - `center` (tuple or np.ndarray) - Center coordinates. - `normal` (tuple or np.ndarray) - Normal vector. - `radius` (float) - Radius of the circle. - `model_config` (dict) - Configuration settings. ### PRArgs Defines a circle using a Point, Radius, and Normal vector. - **Class**: `manimgeo.components.circle.args.PRArgs` - **Fields**: - `construct_type` (str) - Type of construction ('PR'). - `center` (tuple or np.ndarray) - Center coordinates. - `radius` (float) - Radius of the circle. - `normal` (tuple or np.ndarray) - Normal vector. - `model_config` (dict) - Configuration settings. ### PPArgs Defines a circle using a Center point and a Point on the circumference. - **Class**: `manimgeo.components.circle.args.PPArgs` - **Fields**: - `construct_type` (str) - Type of construction ('PP'). - `center` (tuple or np.ndarray) - Center coordinates. - `point` (tuple or np.ndarray) - A point on the circumference. - `normal` (tuple or np.ndarray) - Normal vector. - `model_config` (dict) - Configuration settings. ### LArgs Defines a circle using a radius segment and a normal vector. - **Class**: `manimgeo.components.circle.args.LArgs` - **Fields**: - `construct_type` (str) - Type of construction ('L'). - `radius_segment` (tuple or np.ndarray) - A vector representing the radius. - `normal` (tuple or np.ndarray) - Normal vector. - `model_config` (dict) - Configuration settings. ### PPPArgs Defines a circle using three points lying on the circumference. - **Class**: `manimgeo.components.circle.args.PPPArgs` - **Fields**: - `construct_type` (str) - Type of construction ('PPP'). - `point1` (tuple or np.ndarray) - First point on the circumference. - `point2` (tuple or np.ndarray) - Second point on the circumference. - `point3` (tuple or np.ndarray) - Third point on the circumference. - `model_config` (dict) - Configuration settings. ### TranslationCirVArgs Defines a circle by translating an existing circle by a vector. - **Class**: `manimgeo.components.circle.args.TranslationCirVArgs` - **Fields**: - `construct_type` (str) - Type of construction ('TranslationCirV'). - `circle` (dict) - Arguments for the base circle. - `vector` (tuple or np.ndarray) - Translation vector. - `model_config` (dict) - Configuration settings. ### Number Represents a numerical value, likely used within argument definitions. - **Class**: `manimgeo.components.circle.args.Number` ``` -------------------------------- ### Geometric Point Construction Arguments Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.md Defines the input schemas for constructing points based on existing geometric entities like lines, circles, and other points. ```APIDOC ## POST /components/point/args ### Description Defines the configuration objects required to construct new points in a geometric scene. Each argument class specifies the necessary dependencies (points, lines, circles) and construction parameters. ### Method POST ### Endpoint /components/point/args ### Parameters #### Request Body - **MidPPArgs** (object) - Optional - Arguments for midpoint between two points (point1, point2). - **MidLArgs** (object) - Optional - Arguments for midpoint of a line (line). - **ExtensionPPArgs** (object) - Optional - Arguments for point extension (start, through, factor). - **AxisymmetricPLArgs** (object) - Optional - Arguments for axisymmetric point projection (point, line). - **VerticalPLArgs** (object) - Optional - Arguments for vertical point projection (point, line). - **ParallelPLArgs** (object) - Optional - Arguments for parallel point construction (point, line, distance). - **InversionPCirArgs** (object) - Optional - Arguments for point inversion relative to a circle (point, circle). - **IntersectionLLArgs** (object) - Optional - Arguments for intersection of two lines (line1, line2). ### Request Example { "MidPPArgs": { "point1": "A", "point2": "B" } } ### Response #### Success Response (200) - **status** (string) - Confirmation of argument validation. #### Response Example { "status": "success" } ``` -------------------------------- ### Manage Collections of Geometric Objects in ManimGeo Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Demonstrates how to group geometric objects into collections and perform filtering operations. Supports set operations like union, intersection, and difference between collections. ```python import numpy as np from manimgeo.components import Point, MultipleComponents # Create multiple points points = [ Point.Free(np.array([i, i, 0]), f"P{i}") for i in range(5) ] # Group objects into a collection collection = MultipleComponents.Multiple(points, "all_points") print(f"Collection has {len(collection.geometry_objects)} objects") # Filter with a function that processes all objects at once def filter_far_from_origin(objs): return [np.linalg.norm(p.coord) > 3 for p in objs] filtered = MultipleComponents.FilteredMultiple( points, filter_far_from_origin, "far_points" ) print(f"Filtered: {len(filtered.geometry_objects)} points") # Filter with per-object function filtered_mono = MultipleComponents.FilteredMultipleMono( points, lambda p: p.coord[0] > 2, # x > 2 "x_greater_than_2" ) print(f"Points with x > 2: {len(filtered_mono.geometry_objects)}") # Create another collection other_points = [Point.Free(np.array([i, 0, 0]), f"Q{i}") for i in range(3)] collection2 = MultipleComponents.Multiple(other_points, "other_points") # Set operations using operators union = collection + collection2 # Union print(f"Union size: {len(union.geometry_objects)}") intersection = collection & collection2 # Intersection print(f"Intersection size: {len(intersection.geometry_objects)}") difference = collection - collection2 # Difference print(f"Difference size: {len(difference.geometry_objects)}") ``` -------------------------------- ### Computing Triangle Centers Source: https://context7.com/lifecheckpoint/manimgeo/llms.txt Illustrates the construction of various triangle centers including centroids, circumcenters, incenters, and orthocenters based on three vertices. ```python import numpy as np from manimgeo.components import Point A = Point.Free(np.array([0, 0, 0]), "A") B = Point.Free(np.array([5, 0, 0]), "B") C = Point.Free(np.array([2, 3, 0]), "C") centroid = Point.CentroidPPP(A, B, C, "Centroid") circumcenter = Point.CircumcenterPPP(A, B, C, "Circumcenter") incenter = Point.IncenterPPP(A, B, C, "Incenter") orthocenter = Point.OrthocenterPPP(A, B, C, "Orthocenter") # Verify Euler line vectors = np.array([ centroid.coord - orthocenter.coord, circumcenter.coord - orthocenter.coord ]) assert np.linalg.matrix_rank(vectors) == 1, "Points should be collinear" ``` -------------------------------- ### Line Construction Arguments Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.md Defines the argument structures required to construct lines using different geometric constraints. ```APIDOC ## POST /manimgeo/components/line/args/PPArgs ### Description Constructs a line using two points (Point-Point construction). ### Method POST ### Endpoint /manimgeo/components/line/args/PPArgs ### Request Body - **point1** (Point) - Required - The first point. - **point2** (Point) - Required - The second point. ### Response #### Success Response (200) - **construct_type** (string) - The type of construction used (PP). #### Response Example { "construct_type": "PP", "point1": [0, 0], "point2": [5, 5] } ``` -------------------------------- ### ArgsModelBase Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.base.md Documentation for the ArgsModelBase class, a base class for argument models. ```APIDOC ## ArgsModelBase ### Description A base class for models that handle arguments, defining construction types and model configurations. ### Class `manimgeo.components.base.base_argsmodel.ArgsModelBase` ### Attributes - **model_config** - Description of model_config ### Methods - **construct_type** - Description of construct_type method ``` -------------------------------- ### Circle Construction Arguments Source: https://github.com/lifecheckpoint/manimgeo/blob/main/docs/source/apidoc/manimgeo.components.circle.md Defines the argument structures used for constructing circles, such as InverseCirCirArgs and InscribePPPArgs. ```APIDOC ## Circle Construction Arguments ### Description Provides the data models required to define circle construction parameters, including inverse circle arguments and three-point inscription arguments. ### Parameters #### InverseCirCirArgs - **circle** (object) - Required - The target circle for inversion. - **base_circle** (object) - Required - The circle used as the base for inversion. #### InscribePPPArgs - **point1** (object) - Required - First point on the circle. - **point2** (object) - Required - Second point on the circle. - **point3** (object) - Required - Third point on the circle. ### Request Example { "construct_type": "InscribePPP", "point1": [0, 0, 0], "point2": [1, 0, 0], "point3": [0, 1, 0] } ```