🔺 Geometry Solver — API Reference
All pre-loaded features available in the solver playground, with signatures, parameters, and examples.
Switch the active geometry type before building a scene.
The geometry affects how distances, areas, and angles are computed.
Supported: Euclidean geometry: GEOMETRY_TYPE_EUCLIDEAN.
Experimental (Proof of Concept) support: Hyperbolic (Lobachevskian): GEOMETRY_TYPE_HYPERBOLIC
Experimental (Proof of Concept) support: Spherical (Riemann): GEOMETRY_TYPE_SPHERICAL
Important:
- when switching to Hyperbolic - define "curvature" parameter, or it will be default -1.0
- when switching to Spherical - define "sphere_radius" parameter, or it will be default 1.0
- when switching to Hyperbolic or Spherical - dimension is not configurable and defaulted to 2
Manages all common figure operations, topology and general actions.
These class-methods operate on any figure regardless of figure type.
Most important are:
Geometry: set_geometry(), get_geometry_type(), get_geometry_dimension()...
CRUD: set_param(), get_param(), del_param()...
Interactions: add_interaction(), find_interaction()...
General: clear_all(), calculate_all(), describe_all(), display_theorem_trace()...
| Parameter | Type | Description |
|---|---|---|
| oid | int | Figure identifier returned by .create(). |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Figure identifier returned by .create() |
| param | str | Parameter name, e.g. "length", "size", "coordinates". |
| value | any | Value to store. Use None to clear. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Figure identifier returned by .create() |
| param | str | Parameter name. |
| Parameter | Type | Description |
|---|---|---|
| max_iterations | int | Safety cap — default 100. |
| Parameter | Type | Description |
|---|---|---|
| oid_1 | int | First figure OID. |
| oid_2 | int | Second figure OID. |
| interact_oid | int|None | OID of the interaction figure itself (usually None). |
| interact_type | int | INTERACTION_* or POINT_ON_* constant. |
| Parameter | Type | Description |
|---|---|---|
| oids | list[int] | List of OIDs. |
| param | str | Parameter name. |
Represents a plane in space. Parameters of 3D function Ax + By +Cz + D = 0 are stored as coefficients List [A, B, C, D].
| Parameter | Type | Description |
|---|---|---|
| name | sting | Display label, e.g. "Plane_A". |
| oid | int | Plane OID. |
| type | int | ELEMENT_TYPE_PLANE. |
| function | list[int] | Function that defines thePlane. keeps [A,B,C,D] of A*x + B*y + C*z + D = 0. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Plane OID. |
| points | list[int] | Three Points with all coordinates known to calculate Plane's function. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Plane OID. |
| point | int | Point OID. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Plane OID. |
| points | list[int] | Points OIDs. 4 points should be provided - [A,B,C,D] |
Represents a point in space. Coordinates are stored as {0: x, 1: y} or {0: x, 1: y, 2: z}. Use None for an unknown coordinate — the solver will fill it in if enough constraints are set.
| Parameter | Type | Description |
|---|---|---|
| name | str | Display label, e.g. "A". |
| oid | int | Point OID. |
| type | int | ELEMENT_TYPE_POINT |
| coordinates | Dict[int] | Coordinates of Point: {0: int|None, 2: int|None, 3: int| None..} where 0 means x axis, 1 means y axi, 2 means z axis and so on up to 15 axis. |
Figure.set_param.| Parameter | Type | Description |
|---|---|---|
| oid | int | Point OID. |
| name | str | Display label, e.g. "A". |
A line segment between two endpoints. Length is derived from coordinates, or coordinates can be derived from length if one endpoint and direction are known.
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "AB". |
| oid | int | Segment OID. |
| type | int | ELEMENT_TYPE_SEGMENT. |
| ends | list[int] | Two point OIDs — [start_oid, end_oid]. |
| points | list[int] | Intermediate point OIDs between "ends" in orded from left to right — [point_a, point_b, point_c]. |
| length | float | Known length. Derived automatically if both endpoints have coordinates. |
| subsegments | list[int] | <TBD> List of segments made by intermediate points. |
| line | int | <TBD> Parent line OID. |
ends is a list of two point OIDs. Either ends, length, or both may be provided.| Parameter | Type | Description |
|---|---|---|
| ends | list[int] | Two point OIDs — [start_oid, end_oid]. |
| length | float | Known length. Derived automatically if both endpoints have coordinates. |
| Parameter | Type | Description |
|---|---|---|
| ends | list[int] | Two Points OIDs that are ends of this Segment. |
| Parameter | Type | Description |
|---|---|---|
| segment | int | Segment's OID. |
| point_to_add | int | OID of Point to add. |
| between | list[int] | Two Points OIDs between which to add a point. |
| before | int | Point OID before which to add new point. |
| after | int | Point OID after which to add new point. |
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "ABC" |
| oid | int | Angle OID. |
| type | int | ELEMENT_TYPE_ANGLE. |
| angle_type | int | Standard Angle type depends on size(acute, right, obtuse, straight). |
| formed_by | lsit[int] | Two OID of elements creating this Angle. Use Segments for now. |
| vertex | int | OID of Point - vertex of the Angle. |
| size | float | Angle size in degrees. |
| bisector | int | <TBD> OID of element - bisector of the Angle |
Figure.get_param(tri, "angles") rather than creating them manually.| Parameter | Type | Description |
|---|---|---|
| formed_by | list[int] | Two segment OIDs that form the angle. |
| vertex | int | Point OID at the vertex of the angle. |
| size | float | Angle size in degrees. |
FigureAngle.setup_instance(angleA, formed_by=[segment ab, segment_bc])
| Parameter | Type | Description |
|---|---|---|
| formed_by | list[int] | Two segment OIDs that form the angle. Should be defined with vertex. |
| vertex | int | Point OID at the vertex of the angle. Should be defined with formed_by |
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "Circ_O". |
| oid | int | Triangle OID. |
| type | int | ELEMENT_TYPE_CIRCLE. |
| center | int | OID of Point - center of the Circle. |
| radius | float | Known radius length. |
| diameter | float | Known diameter length. |
| circumference | float | Known circumference length. |
| area | float | Known area size. |
| points | list[inf] | list of points on the circumference. |
add_interaction to have the circumradius/inradius computed automatically.| Parameter | Type | Description |
|---|---|---|
| center | int | OID of a FigurePoint for the centre. |
| radius | float | Known radius. |
| diameter | float | Known diameter (= 2r). |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Circle OID. |
| point2add | int | OID of Point to be added to circumference. Note: if non of between, after, before is specificed- point is added as last in the list.. |
| between | list[int] | OIDs of 2 neighboring Points between which to add a new point. |
| after | int | OID of Point after which to add a new point. |
| before | int | OID of Point before which to add a new point. |
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "ABC". |
| oid | int | Triangle OID. |
| type | int | ELEMENT_TYPE_TRIANGLE. |
| type_by_angle | int | TRIANGLE_ANGLE_TYPE_ACUTE, TRIANGLE_ANGLE_TYPE_RIGHT, TRIANGLE_ANGLE_TYPE_OBTUSE. |
| type_by_side | int | TRIANGLE_SIDE_TYPE_GENERAL, TRIANGLE_SIDE_TYPE_ISOSCELES, TRIANGLE_SIDE_TYPE_EQUILATERAL. |
| angles | list[int] | Exactly 3 Angle OIDs - angles of the Triangle. |
| sides | list[int] | Exactly 3 Segment OIDs - sides of the Triangle. |
| heights | list[int] | <TBD>Exactly 3 Segment OIDs - heights of the Triangle. |
| medians | list[int] | <TBD>Exactly 3 Segment OIDs - medians of the Triangle. |
| isosceles_sides | list[int] | Exactly 2 Segment OIDs - isosceles sides if Triangle is ISOSCELES. |
| isosceles_angles | list[int] | Exactly 2 Angle OIDs - isosceles angles if Triangle is ISOSCELES.. |
| isosceles_vertex | int | OID of Angle - vertex of ISOSCELES Triangle. |
| isosceles_base | int | OID of Segment - base of ISOSCELES Triangle]. |
| obtuse_angle | int | OID of Obtuse Angle if Triangle is OBTUSE. |
| right_angle | int | OID of Right Angle if Triangle is RIGHT. |
| right_hypotenuse | int | OID of Segment that is Hypotenuse of Right Triangle if it is RIGHT. |
| right_legs | list[int] | Exactly 2 Segment OIDs - legs of Right Triangle if it is RIGHT. |
| perimeter | float | Perimeter of Triangle. |
| area | float | Area of Triangle. |
Figure.get_param(oid, "sides") and Figure.get_param(oid, "angles").| Parameter | Type | Description |
|---|---|---|
| points | list[int] | Exactly 3 FigurePoint OIDs — [A, B, C]. |
sides (list of 3 segment OIDs), angles (list of 3 angle OIDs),
area, perimeter, type_by_side, type_by_angle.
A general polygon with 4 or more vertices. Set sub-type to a
POLYGON_SUBTYPE_* constant to activate specialised calculations.
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "ABCD". |
| oid | int | Polygon OID. |
| type | int | ELEMENT_TYPE_POLYGON. |
| sub-type | int | POLYGON_SUBTYPE_GENERAL, POLYGON_SUBTYPE_PARALLELOGRAM, POLYGON_SUBTYPE_SQUARE... e.t.c.. |
| angles | list[int] | List of Angle OIDs - angles of the Polygon. |
| sides | list[int] | List of Segment OIDs - sides of the Polygon. |
| heights | list[int] | <TBD>List of Segment OIDs - heights of the Polygon. |
| medians | list[int] | <TBD>List of Segment OIDs - medians of the Polygon. |
| diagonals | list[int] | List of Segment OIDs - diagonals of the Polygon. |
| type_by_angle | int | POLYGON_BY_ANGLE_CONVEX, POLYGON_BY_ANGLE_CONCAVE. |
| type_by_equality | int | POLYGON_BY_EQUALITY_REGULAR, POLYGON_BY_EQUALITY_IRREGULAR. |
| type_by_shape | int | POLYGON_BY_SHAPE_SIMPLE, POLYGON_BY_SHAPE_SELFINTERSECTING. |
| inscription | bool | Condition - is Polygon "inscriptable" into some circle. |
| sides_number | int | Number of sides. n-lygon |
| perimeter | float | Perimetr of Polygon. |
| area | float | Area of Polygon. |
Figure.set_param(oid, "sub-type", POLYGON_SUBTYPE_SQUARE) to activate square-specific propagation (all sides equal, all angles 90°).| Parameter | Type | Description |
|---|---|---|
| points | list[int] | Ordered vertex OIDs (≥ 4), listed in winding order. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | Polygon OID. |
| sub_type | int | Supported Sub-type: POLYGON_SUBTYPE_RECTANGLE, POLYGON_SUBTYPE_PARALLELOGRAM, e.t.c. |
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "ell_E". |
| oid | int | Ellipse OID. |
| type | int | ELEMENT_TYPE_ELLIPSE. |
| semi_major | float | Length of the major semi-axis (a). |
| semi_minor | float | Length of the minor semi-axis (b). |
| center | int | OID of Point - center of the Ellipse. |
| area | float | Area size of the Ellipse. |
| circumference | float | Circumference length of the Ellipse. |
| eccentricity | float | . |
| focal_distance | float | <TBD>Focal distance of the Ellipse. |
| Parameter | Type | Description |
|---|---|---|
| semi_major | float | Length of the major semi-axis (a). |
| semi_minor | float | Length of the minor semi-axis (b). |
| center | int | FigurePoint OID for the centre. |
Define a 1-D function f(x) or 2-D function f(x,y) over a bounded domain. The solver computes the definite integral numerically via Simpson's rule and attempts a symbolic antiderivative for polynomials.
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "Parabola". |
| oid | int | Function OID. |
| type | int | ELEMENT_TYPE_FUNCTION |
| expression | str | callable | Function expression. |
| dim | int | 1 for f(x), 2 for f(x,y). Default 1. |
| ends | list[int] | Exactly 2 OIDs of Points - limits of the Function segment. |
| points | list[int] | <TBD> Intermediate points on Function graph between Ends. |
| x_min | float | Lesser integration bound in x. |
| x_max | float | Higher integration bound in x. |
| y_min | float | Lesser integration bound in y (dim=2 only). |
| y_max | float | Higher integration bound in y (dim=2 only). |
| n_points | int | Quadrature points. Default 1000. |
| integral_value | float | Function's segment Integral values (limited by end points). |
| integral_expression | str | callable | Function Integral expression. |
| base_value | float | Subtract from f(x) before integrating (area between two functions). Default 0.0. |
expression is either a Python string ("sin(x)*exp(-x)") or a callable (lambda x: x**2). Available math functions in string expressions: sin, cos, tan, asin, acos, atan, exp, log, sqrt, pi, e, abs.| Parameter | Type | Description |
|---|---|---|
| expression | str | callable | Function expression. |
| dim | int | 1 for f(x), 2 for f(x,y). Default 1. |
| ends | list[point1,point2] | OIDs of Points that limit the Function segment. |
| x_min, x_max | float | Integration bounds in x. |
| y_min, y_max | float | Integration bounds in y (dim=2 only). |
| n_points | int | Quadrature points. Default 1000. |
| base_value | float | Subtract from f(x) before integrating (area between two functions). Default 0. |
Define a Concyclic Group.
| Parameter | Type | Description |
|---|---|---|
| name | string | Display label, e.g. "ConcGrp_1". |
| oid | int | ConcyclicGroup OID. |
| type | int | ELEMENT_TYPE_CONCYCLIC_GROUP |
| center | Dict[int] | Coordinates of the center of Concyclic Group. |
| radius | float | Radius lengths of Concyclic Group. |
| plane_function | list[int] | Plane function of the Concyclic Group, where stored [A, B,C,D] of function A*x + B*y + C*z + D =0. |
| points | list[int] | List of Point OID - memebrs of the Concyclic Group. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | ConcyclicGroup OID. |
| points | list[int] | List of Point OIDs with known coordinates. |
| ends | list[point1,point2] | OIDs of Points that limit the Function segment. |
| name | string | Name of ConcyclicGroup. |
| Parameter | Type | Description |
|---|---|---|
| oid | int | ConcyclicGroup OID. |
| point | int | Point OID to measure is it's coordinates meet requirements of tho\is Concyclic Group. |
Pass these to Figure.add_interaction(oid_1, oid_2, None, CONSTANT)
to declare geometric relationships the solver should propagate.
These identify figure types in Figure.get_type(oid) results
and in interaction filtering calls. They are pre-loaded in the playground namespace.