🔺 Geometry Solver — API Reference

All pre-loaded features available in the solver playground, with signatures, parameters, and examples.

← Back to Solver
Geometry configuration

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

Figure.set_geometry(geometry_type, curvature=None, sphere_radius=None, dimension=None ) classmethod
Set the active geometry. Use GEOMETRY_TYPE_* constants.
set_geometry(GEOMETRY_TYPE_SPHERICAL, sphere_radius=6371) # Now distances are great-circle distances in km
get_geometry() classmethod
Return the current Geometry parameters (has "geometry_type", "curvature", "sphere_radius", "dimension").
geometry = Figure.get_geometry() print(geometry["geometry_type"], geometry["sphere_radius"])
get_geometry_type() classmethod
Get current geometry type.
geometry_type = Figure.get_geometry_type()
get_geometry_curvature() classmethod
Get current curvature of Hyperbolic geometry. Can be None if geometry is not Hyperbolic.
curvature = Figure.get_geometry_curvature()
get_geometry_sphere_radius() classmethod
Get current sphere radius of Spherical geometry. Can be None if geometry is not Spherical.
sphere_radius = Figure.get_geometry_sphere_radius()
get_dimension_space() classmethod
Get current dimension space. Minimum allowed: 2. Maximum allowed: MAX_DIMENSIONS (15), Default: 3
dimensions = Figure.get_dimension_space()
Geometry type constants
GEOMETRY_TYPE_EUCLIDEAN = 1
Flat plane — default.
GEOMETRY_TYPE_HYPERBOLIC = 2
Lobachevskian / Poincaré model.
GEOMETRY_TYPE_SPHERICAL = 3
Riemannian — requires sphere_radius.
Figure — base class

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()...

Figure.list_param(oid) classmethod
List parameters names for a figure id.
ParameterTypeDescription
oidintFigure identifier returned by .create().
Returns: List of parameter names. Note: all defined parameters name will be displayed.
Figure.set_param(segment_ab, "length", 5) Figure.set_param(point_a, "coordinates", {0: 1.0, 1: 2.0})
Figure.set_param(oid, param, value) classmethod
Write one parameter value for figure oid.
ParameterTypeDescription
oidintFigure identifier returned by .create()
paramstrParameter name, e.g. "length", "size", "coordinates".
valueanyValue to store. Use None to clear.
Returns: None
Figure.set_param(segment_ab, "length", 5) Figure.set_param(point_a, "coordinates", {0: 1.0, 1: 2.0})
Figure.get_param(oid, param) → value classmethod
Read one parameter value from the registry. Returns None if the parameter is not set.
ParameterTypeDescription
oidintFigure identifier returned by .create()
paramstrParameter name.
Returns: Stored value, or None.
length = Figure.get_param(segment_ab, "length") sides = Figure.get_param(triangle_abc, "sides") # Note: sides is a list of ids
Figure.calculate_all(max_iterations=100) classmethod
Run constraint propagation to a fixed point across all figures in the registry. Calls each figure's calculate() repeatedly until no new values are set or max_iterations is reached. Always call this after setting up initial parameters.
ParameterTypeDescription
max_iterationsintSafety cap — default 100.
Returns: None
Figure.set_param(pt, "coordinates", {0: 0.0, 1: 0.0}) Figure.calculate_all() # All derived params (area, angles, radii…) are now set.
Figure.clear_all() classmethod
Wipe the entire geometry constraints, return type of geometry to default Euclidean with dimension space =3. Call this at the start of each new problem.
Returns: None
Figure.clear_all() # always call before building a new scene
Figure.add_interaction(oid_1, oid_2, interact_oid, interact_type) classmethod
Record a geometric relationship between two figures. The solver reads interactions to propagate constraints across figure boundaries (e.g. circumscribed circle radius = triangle circumradius).
ParameterTypeDescription
oid_1intFirst figure OID.
oid_2intSecond figure OID.
interact_oidint|NoneOID of the interaction figure itself (usually None).
interact_typeintINTERACTION_* or POINT_ON_* constant.
Returns: None
Figure.add_interaction(circle, triangle, None, INTERACTION_CIRCUMSCRIBED) Figure.add_interaction(pt, circle, None, POINT_ON_CIRCLE_OUTLINE)
Figure.bulk_get_param(oids, param) → list classmethod
Fetch the same parameter from a list of OIDs in one call. Returns a list of values (None where not set). Useful for collecting all side lengths or angle sizes from a figure.
ParameterTypeDescription
oidslist[int]List of OIDs.
paramstrParameter name.
Returns: list — one value per OID.
sides = Figure.get_param(tri, "sides") lengths = Figure.bulk_get_param(sides, "length") # → [3.0, 5.0, 4.0]
FigurePlane

Represents a plane in space. Parameters of 3D function Ax + By +Cz + D = 0 are stored as coefficients List [A, B, C, D].

FigurePlane.create() → int classmethod
Contains parameters and methods of Plane in 3D.
ParameterTypeDescription
namestingDisplay label, e.g. "Plane_A".
oidintPlane OID.
typeintELEMENT_TYPE_PLANE.
functionlist[int]Function that defines thePlane. keeps [A,B,C,D] of A*x + B*y + C*z + D = 0.
FigurePlane.setup_instance(plane, points=[A,B,C])
FigurePlane.setup_instance(plane, points=[A,B,C]) classmethod
Calculates Plane's "function" based on coordinates of those 3 Points.
ParameterTypeDescription
oidintPlane OID.
pointslist[int] Three Points with all coordinates known to calculate Plane's function.
FigurePlane.setup_instance(plane, points=[point_a, point_b, point_c])
FigurePlane.is_point_on_plane(oid, point) → bool classmethod
If point's coordinates are set, checks is point situated on given plane.Return False if Point is not on Plane or if no enough parameters to check this.
ParameterTypeDescription
oidintPlane OID.
pointintPoint OID.
FigurePlane.is_point_on_plane(plane, point_a)
FigurePlane.is_orientation_crossing(oid, points) → bool classmethod
4 points A,B,C,D will form opposite segments AB|CD and BC|AD. Function checks if those segments are crossing on Plane.
ParameterTypeDescription
oidintPlane OID.
pointslist[int]Points OIDs. 4 points should be provided - [A,B,C,D]
FigurePlane.is_orienttion_crossing(plane, [A,B,C,D])
FigurePoint

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.

FigurePoint.create() → int classmethod
Contains parameters and methods of Point.
ParameterTypeDescription
namestrDisplay label, e.g. "A".
oidintPoint OID.
typeintELEMENT_TYPE_POINT
coordinatesDict[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.
A = FigurePoint.create()
FigurePoint.setup_instance(oid, name=None) classmethod
Assign a label to a point. Coordinates are set separately with Figure.set_param.
ParameterTypeDescription
oidintPoint OID.
namestrDisplay label, e.g. "A".
A = FigurePoint.create() FigurePoint.setup_instance(A, name='A') Figure.set_param(A, 'coordinates', {0: 0.0, 1: 0.0}) # x=0, y=0 Figure.set_param(B, 'coordinates', {0: 3.0, 1: None}) # y unknown
FigurePoint.get_or_create(name=None, x=None, y=None, z=0.0) → int classmethod
Create a point and optionally set its coordinates in one call. Returns the OID.
A = FigurePoint.get_or_create(name='A', x=0.0, y=0.0)
FigureSegment

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.

FigureSegment.create() → int classmethod
Contains parameters and methods of Segment.
ParameterTypeDescription
namestringDisplay label, e.g. "AB".
oidintSegment OID.
typeintELEMENT_TYPE_SEGMENT.
endslist[int]Two point OIDs — [start_oid, end_oid].
pointslist[int]Intermediate point OIDs between "ends" in orded from left to right — [point_a, point_b, point_c].
lengthfloatKnown length. Derived automatically if both endpoints have coordinates.
subsegmentslist[int]<TBD> List of segments made by intermediate points.
lineint<TBD> Parent line OID.
p1 = FigurePoint.create(); FigurePoint.setup_instance(p1, name='P') p2 = FigurePoint.create(); FigurePoint.setup_instance(p2, name='Q') seg = FigureSegment.create()
FigureSegment.setup_instance(oid, name=None, ends=None, length=None) classmethod
Initialise a segment. ends is a list of two point OIDs. Either ends, length, or both may be provided.
ParameterTypeDescription
endslist[int]Two point OIDs — [start_oid, end_oid].
lengthfloatKnown length. Derived automatically if both endpoints have coordinates.
p1 = FigurePoint.create(); FigurePoint.setup_instance(p1, name='P') p2 = FigurePoint.create(); FigurePoint.setup_instance(p2, name='Q') seg = FigureSegment.create() FigureSegment.setup_instance(seg, name='PQ', ends=[p1, p2], length=5)
FigureSegment.get_or_create(ends=None) → int classmethod
Return an existing segment with these endpoints if one exists, otherwise create a new one. Avoids duplicate segments when figures share sides.
ParameterTypeDescription
endslist[int]Two Points OIDs that are ends of this Segment.
seg = FigureSegment.get_or_create(ends=[p1, p2])
FigureSegment.add_point(segment, point_to_add, between=None, after=None, before=None) classmethod
Adds intermediate Point to the Segment and creates sub-segments from end points to added point. Interaction of type POINT_ON_SEGMENT is create automatically.
ParameterTypeDescription
segmentintSegment's OID.
point_to_addintOID of Point to add.
betweenlist[int]Two Points OIDs between which to add a point.
beforeintPoint OID before which to add new point.
afterintPoint OID after which to add new point.
p1 = FigurePoint.create() p2 = FigurePoint.create() p3 = FigurePoint.create() seg = FigureSegment.get_or_create(ends=[p1, p2]) FigureSegment.add_point(seg, p3, after=p1)
FigureAngle
FigureAngle.create() → int classmethod
Contains parameters and methods of Angle.
ParameterTypeDescription
namestringDisplay label, e.g. "ABC"
oidintAngle OID.
typeintELEMENT_TYPE_ANGLE.
angle_typeintStandard Angle type depends on size(acute, right, obtuse, straight).
formed_bylsit[int]Two OID of elements creating this Angle. Use Segments for now.
vertexintOID of Point - vertex of the Angle.
sizefloatAngle size in degrees.
bisectorint<TBD> OID of element - bisector of the Angle
angleA = FigureAngle.create()
FigureAngle.setup_instance(oid, name=None, formed_by=None, vertex=None, size=None) classmethod
Initialise an angle. Usually you access angles from a triangle or polygon via Figure.get_param(tri, "angles") rather than creating them manually.
ParameterTypeDescription
formed_bylist[int]Two segment OIDs that form the angle.
vertexintPoint OID at the vertex of the angle.
sizefloatAngle size in degrees.
angleA = FigureAngle.create()
FigureAngle.setup_instance(angleA, formed_by=[segment ab, segment_bc])
FigureAngle.get_or_create(formed_by=None, vertex=None) classmethod
Returns existent Angle OID if it already exists, or creates a new one. If you need to operate with exact triangle's or polygon's angle that was created when triangle or polygon created.
ParameterTypeDescription
formed_bylist[int]Two segment OIDs that form the angle. Should be defined with vertex.
vertexintPoint OID at the vertex of the angle. Should be defined with formed_by
angle = Figure.get_or_create(formed_by=[AB, BC], vertex=B)
FigureCircle
FigureCircle.create() → int classmethod
Contains parameters and methods of Circle.
ParameterTypeDescription
namestringDisplay label, e.g. "Circ_O".
oidintTriangle OID.
typeintELEMENT_TYPE_CIRCLE.
centerintOID of Point - center of the Circle.
radiusfloatKnown radius length.
diameterfloatKnown diameter length.
circumferencefloatKnown circumference length.
areafloatKnown area size.
pointslist[inf]list of points on the circumference.
O = FigurePoint.create() FigurePoint.setup_instance(O, name='O') circ_O = FigureCircle.create()
FigureCircle.setup_instance(oid, name=None, center=None, radius=None, diameter=None, circumference=None, area=None) classmethod
Initialise a circle. Provide one known metric (radius, diameter, area, or circumference) and the solver derives the rest. Link to a triangle via add_interaction to have the circumradius/inradius computed automatically.
ParameterTypeDescription
centerintOID of a FigurePoint for the centre.
radiusfloatKnown radius.
diameterfloatKnown diameter (= 2r).
Derived params (after calculate_all): radius, diameter, area, circumference.
O = FigurePoint.create(); FigurePoint.setup_instance(O, name='O') circ = FigureCircle.create() FigureCircle.setup_instance(circ, name='C', center=O) # Link to triangle so circumradius is derived automatically Figure.add_interaction(circ, tri, None, INTERACTION_CIRCUMSCRIBED) Figure.add_interaction(tri, circ, None, INTERACTION_INSCRIBED) for pt in [A, B, C]: Figure.add_interaction(pt, circ, None, POINT_ON_CIRCLE_OUTLINE)
FigureCircle.add_point_to_circumference(oid, point2add, between=None, after=None, before=None) classmethod
Add points to Circle's circumference. Interaction type POINT_ON_CIRCLE_OUTLINE is created automatically.
ParameterTypeDescription
oidintCircle OID.
point2addintOID of Point to be added to circumference. Note: if non of between, after, before is specificed- point is added as last in the list..
betweenlist[int]OIDs of 2 neighboring Points between which to add a new point.
afterintOID of Point after which to add a new point.
beforeintOID of Point before which to add a new point.
Derived params (after calculate_all): radius, diameter, area, circumference.
O = FigurePoint.create() FigurePoint.setup_instance(O, name='O') circ = FigureCircle.create() FigureCircle.setup_instance(circ, name='C', center=O) A = FigurePoint.create() B = FigurePoint.create() FigureCircle.add_point(circ, A) FigureCircle.add_point(circ, B, after=A)
FigureTriangle
FigureTriangle.create() → int classmethod
Contains parameters and methods of Triangle.
ParameterTypeDescription
namestringDisplay label, e.g. "ABC".
oidintTriangle OID.
typeintELEMENT_TYPE_TRIANGLE.
type_by_angleintTRIANGLE_ANGLE_TYPE_ACUTE, TRIANGLE_ANGLE_TYPE_RIGHT, TRIANGLE_ANGLE_TYPE_OBTUSE.
type_by_sideintTRIANGLE_SIDE_TYPE_GENERAL, TRIANGLE_SIDE_TYPE_ISOSCELES, TRIANGLE_SIDE_TYPE_EQUILATERAL.
angleslist[int]Exactly 3 Angle OIDs - angles of the Triangle.
sideslist[int]Exactly 3 Segment OIDs - sides of the Triangle.
heightslist[int]<TBD>Exactly 3 Segment OIDs - heights of the Triangle.
medianslist[int]<TBD>Exactly 3 Segment OIDs - medians of the Triangle.
isosceles_sideslist[int]Exactly 2 Segment OIDs - isosceles sides if Triangle is ISOSCELES.
isosceles_angleslist[int]Exactly 2 Angle OIDs - isosceles angles if Triangle is ISOSCELES..
isosceles_vertexintOID of Angle - vertex of ISOSCELES Triangle.
isosceles_baseintOID of Segment - base of ISOSCELES Triangle].
obtuse_angleintOID of Obtuse Angle if Triangle is OBTUSE.
right_angleintOID of Right Angle if Triangle is RIGHT.
right_hypotenuseintOID of Segment that is Hypotenuse of Right Triangle if it is RIGHT.
right_legslist[int]Exactly 2 Segment OIDs - legs of Right Triangle if it is RIGHT.
perimeterfloatPerimeter of Triangle.
areafloatArea of Triangle.
tri = FigureTriangle.create()
FigureTriangle.setup_instance(oid, name=None, points=None) classmethod
Initialise a triangle from three vertex point OIDs. Automatically creates three FigureSegment sides and three FigureAngle angles. Access them via Figure.get_param(oid, "sides") and Figure.get_param(oid, "angles").
ParameterTypeDescription
pointslist[int]Exactly 3 FigurePoint OIDs — [A, B, C].
Accessible after setup: sides (list of 3 segment OIDs), angles (list of 3 angle OIDs), area, perimeter, type_by_side, type_by_angle.
A = FigurePoint.create(); FigurePoint.setup_instance(A, name='A') B = FigurePoint.create(); FigurePoint.setup_instance(B, name='B') C = FigurePoint.create(); FigurePoint.setup_instance(C, name='C') tri = FigureTriangle.create() FigureTriangle.setup_instance(tri, name='ABC', points=[A, B, C]) sides = Figure.get_param(tri, 'sides') # [AB, AC, BC] angles = Figure.get_param(tri, 'angles') # [∠A, ∠B, ∠C] Figure.set_param(angles[1], 'size', 90) # right angle at B Figure.set_param(sides[0], 'length', 3) # |AB| = 3 Figure.set_param(sides[2], 'length', 4) # |BC| = 4 Figure.calculate_all() # → Figure.get_param(tri, "area")=6.0, Figure.get_param(tri, "perimeter")=12.0, Figure.get_param(sides[1], "length")=5.0 (Pythagorean theorem)
Triangle sub-type by angle constants
TRIANGLE_ANGLE_TYPE_ACUTE = 1
All angles are less then 90.
TRIANGLE_ANGLE_TYPE_RIGHT = 2
One angle is Right (90).
TRIANGLE_ANGLE_TYPE_OBTUSE = 3
One angle is Obtuse (more than 90).
Triangle sub-type by sides constants
TRIANGLE_SIDE_TYPE_GENERAL = 1
No special structure.
TRIANGLE_SIDE_TYPE_ISOSCELES = 2
Two sides are equal.
TRIANGLE_SIDE_TYPE_EQUILATERAL = 3
All 3 sides are equal.
FigurePolygon

A general polygon with 4 or more vertices. Set sub-type to a POLYGON_SUBTYPE_* constant to activate specialised calculations.

FigurePolygon.create() → int classmethod
Contains parameters and methods of Polygon.
ParameterTypeDescription
namestringDisplay label, e.g. "ABCD".
oidintPolygon OID.
typeintELEMENT_TYPE_POLYGON.
sub-typeintPOLYGON_SUBTYPE_GENERAL, POLYGON_SUBTYPE_PARALLELOGRAM, POLYGON_SUBTYPE_SQUARE... e.t.c..
angleslist[int]List of Angle OIDs - angles of the Polygon.
sideslist[int]List of Segment OIDs - sides of the Polygon.
heightslist[int]<TBD>List of Segment OIDs - heights of the Polygon.
medianslist[int]<TBD>List of Segment OIDs - medians of the Polygon.
diagonalslist[int]List of Segment OIDs - diagonals of the Polygon.
type_by_angleintPOLYGON_BY_ANGLE_CONVEX, POLYGON_BY_ANGLE_CONCAVE.
type_by_equalityintPOLYGON_BY_EQUALITY_REGULAR, POLYGON_BY_EQUALITY_IRREGULAR.
type_by_shapeintPOLYGON_BY_SHAPE_SIMPLE, POLYGON_BY_SHAPE_SELFINTERSECTING.
inscriptionboolCondition - is Polygon "inscriptable" into some circle.
sides_numberintNumber of sides. n-lygon
perimeterfloatPerimetr of Polygon.
areafloatArea of Polygon.
A = FigurePoint.create()
FigurePolygon.setup_instance(oid, name=None, points=None) classmethod
Initialise a polygon from ordered vertex OIDs. Creates sides and angles automatically. Then set Figure.set_param(oid, "sub-type", POLYGON_SUBTYPE_SQUARE) to activate square-specific propagation (all sides equal, all angles 90°).
ParameterTypeDescription
pointslist[int]Ordered vertex OIDs (≥ 4), listed in winding order.
Derived params: area, perimeter, diagonal. Sides and angles are linked OIDs.
A = FigurePoint.create(); FigurePoint.setup_instance(A, name='A') B = FigurePoint.create(); FigurePoint.setup_instance(B, name='B') C = FigurePoint.create(); FigurePoint.setup_instance(C, name='C') D = FigurePoint.create(); FigurePoint.setup_instance(D, name='D') sq = FigurePolygon.create() FigurePolygon.setup_instance(sq, name='ABCD', points=[A, B, C, D]) Figure.set_polygon_type(sq, POLYGON_SUBTYPE_SQUARE) # Set 3 known corners — 4th is computed Figure.set_param(A, 'coordinates', {0: 0.0, 1: 0.0}) Figure.set_param(B, 'coordinates', {0: 4.0, 1: 0.0}) Figure.set_param(C, 'coordinates', {0: 4.0, 1: 4.0}) Figure.calculate_all() # D=(0,4) derived; area=16
FigurePolygon.set_polygon_type(oid, sub_type) classmethod
Defines subtype of Polygon if it is a part of task condition. For example: Define a Square ABCD.... Must be used instead of set_param to define necessary interactions automatically.
ParameterTypeDescription
oidintPolygon OID.
sub_typeintSupported Sub-type: POLYGON_SUBTYPE_RECTANGLE, POLYGON_SUBTYPE_PARALLELOGRAM, e.t.c.
Derived params: area, perimeter, diagonal. Sides and angles are linked OIDs.
A = FigurePoint.create(); FigurePoint.setup_instance(A, name='A') B = FigurePoint.create(); FigurePoint.setup_instance(B, name='B') C = FigurePoint.create(); FigurePoint.setup_instance(C, name='C') D = FigurePoint.create(); FigurePoint.setup_instance(D, name='D') sq = FigurePolygon.create() FigurePolygon.setup_instance(sq, name='ABCD', points=[A, B, C, D]) Figure.set_polygon_type(sq, POLYGON_SUBTYPE_SQUARE)
Polygon sub-type constants
POLYGON_SUBTYPE_GENERAL = 0
No special structure assumed.
POLYGON_SUBTYPE_QUADRILATERAL = 1
Polygon with 2 sides without special structure.
POLYGON_SUBTYPE_RECTANGLE = 2
Rectangle.
POLYGON_SUBTYPE_SQUARE = 3
Square.
POLYGON_SUBTYPE_PARALLELOGRAM = 4
Parallelogram.
POLYGON_SUBTYPE_RHOMBUS = 5
All 4 sides equal.
FigureEllipse
FigureEllipse.create() → int classmethod
Contains parameters and methods of Ellipse..
<TBD> Eccentricity of the Ellipse.
ParameterTypeDescription
namestringDisplay label, e.g. "ell_E".
oidintEllipse OID.
typeintELEMENT_TYPE_ELLIPSE.
semi_majorfloatLength of the major semi-axis (a).
semi_minorfloatLength of the minor semi-axis (b).
centerintOID of Point - center of the Ellipse.
areafloatArea size of the Ellipse.
circumferencefloatCircumference length of the Ellipse.
eccentricityfloat.
focal_distancefloat<TBD>Focal distance of the Ellipse.
O = FigurePoint.create(); FigurePoint.setup_instance(O, name='O') Figure.set_param(O, 'coordinates', {0: 0.0, 1: 0.0}) el = FigureEllipse.create() FigureEllipse.setup_instance(el, name='E', semi_major=5, semi_minor=3, center=O) FigureEllipse.calculate(el)
FigureEllipse.setup_instance(oid, name=None, semi_major=None, semi_minor=None, center=None) classmethod
Initialise an ellipse. Provide the two semi-axes and optionally a centre point OID.
ParameterTypeDescription
semi_majorfloatLength of the major semi-axis (a).
semi_minorfloatLength of the minor semi-axis (b).
centerintFigurePoint OID for the centre.
Derived params: area = πab, eccentricity = √(1−b²/a²), focal_distance.
O = FigurePoint.create(); FigurePoint.setup_instance(O, name='O') Figure.set_param(O, 'coordinates', {0: 0.0, 1: 0.0}) el = FigureEllipse.create() FigureEllipse.setup_instance(el, name='E', semi_major=5, semi_minor=3, center=O) FigureEllipse.calculate(el)
FigureFunction

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.

FigureFunction.create() → int classmethod
Contains parameters and methods of Function.
ParameterTypeDescription
namestringDisplay label, e.g. "Parabola".
oidintFunction OID.
typeintELEMENT_TYPE_FUNCTION
expressionstr | callableFunction expression.
dimint1 for f(x), 2 for f(x,y). Default 1.
endslist[int]Exactly 2 OIDs of Points - limits of the Function segment.
pointslist[int]<TBD> Intermediate points on Function graph between Ends.
x_minfloatLesser integration bound in x.
x_maxfloatHigher integration bound in x.
y_minfloatLesser integration bound in y (dim=2 only).
y_maxfloatHigher integration bound in y (dim=2 only).
n_pointsintQuadrature points. Default 1000.
integral_valuefloatFunction's segment Integral values (limited by end points).
integral_expressionstr | callableFunction Integral expression.
base_valuefloatSubtract from f(x) before integrating (area between two functions). Default 0.0.
func_parab = FigureFunction.create()
FigureFunction.setup_instance(oid, name=None, expression=None, dim=1, ends=None, x_min=None, x_max=None, y_min=None, y_max=None, n_points=1000, base_value=0.0) classmethod
Define the function and its domain. 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.
ParameterTypeDescription
expressionstr | callableFunction expression.
dimint1 for f(x), 2 for f(x,y). Default 1.
endslist[point1,point2]OIDs of Points that limit the Function segment.
x_min, x_maxfloatIntegration bounds in x.
y_min, y_maxfloatIntegration bounds in y (dim=2 only).
n_pointsintQuadrature points. Default 1000.
base_valuefloatSubtract from f(x) before integrating (area between two functions). Default 0.
After FigureFunction.calculate(oid): integral_value (float), integral_expression (str, polynomial antiderivative only).
# 1-D: area under parabola point1 = FigurePoint.create() point2 = FigurePoint.create() f = FigureFunction.create() FigureFunction.setup_instance(f, name='parabola', expression='x**2', ends=[point1, point2], x_min=-2, x_max=2) FigureFunction.calculate(f) print(Figure.get_param(f, 'integral_value')) # ≈ 5.3333 (exact: 16/3) # 2-D: volume under Gaussian surface g = FigureFunction.create() FigureFunction.setup_instance(g, name='gaussian', expression='exp(-(x**2+y**2))', dim=2, x_min=-3, x_max=3, y_min=-3, y_max=3) FigureFunction.calculate(g) print(Figure.get_param(g, 'integral_value')) # ≈ π
FigureFunction.evaluate(oid, *args) → float | None classmethod
Evaluate the stored function at given coordinates. Returns None if the expression fails (domain error etc.).
y = FigureFunction.evaluate(f, 1.5) # f(1.5) z = FigureFunction.evaluate(g, 1.0, 0.5) # g(1.0, 0.5) for dim=2
FigureConcyclicGroup

Define a Concyclic Group.

FigureConcyclicGroup.create() → int classmethod
Contains parameters and methods of Concyclic Group.
ParameterTypeDescription
namestringDisplay label, e.g. "ConcGrp_1".
oidintConcyclicGroup OID.
typeintELEMENT_TYPE_CONCYCLIC_GROUP
centerDict[int]Coordinates of the center of Concyclic Group.
radiusfloatRadius lengths of Concyclic Group.
plane_functionlist[int]Plane function of the Concyclic Group, where stored [A, B,C,D] of function A*x + B*y + C*z + D =0.
pointslist[int]List of Point OID - memebrs of the Concyclic Group.
concGrp_1 = FigureConcyclicGroup.create()
FigureConcyclicGroup.setup_instance(oid, poins, name=None) classmethod
Define the Concyclic Group and it's params. From firs 3 points of the "points" finds if theare concyclic, and if yes - calculates parameters of Concyclic Group
ParameterTypeDescription
oidintConcyclicGroup OID.
pointslist[int]List of Point OIDs with known coordinates.
endslist[point1,point2]OIDs of Points that limit the Function segment.
namestringName of ConcyclicGroup.
point1 = FigurePoint.create() Figure.set_param(point1, "coordinates", <some coordinates>) point2 = FigurePoint.create() Figure.set_param(point2, "coordinates", <some coordinates>) point3 = FigurePoint.create() Figure.set_param(point4, "coordinates", <some coordinates>) concGrp_1 = FigureConcyclicGroup.create() FigureConcyclicGroup.setup_instance(concGrp_1, points=[poiny1, point2, point3], name='ConcGrp_1')
FigureConcyclicGroup.is_point_in_group(oid, point) → bool classmethod
Checks are Point's coordinates meet requirements of Concyclic Group.
ParameterTypeDescription
oidintConcyclicGroup OID.
pointintPoint OID to measure is it's coordinates meet requirements of tho\is Concyclic Group.
point1 = FigurePoint.create() Figure.set_param(point1, "coordinates", <some coordinates>) point2 = FigurePoint.create() Figure.set_param(point2, "coordinates", <some coordinates>) point3 = FigurePoint.create() Figure.set_param(point3, "coordinates", <some coordinates>) point4 = FigurePoint.create() Figure.set_param(point4, "coordinates", <some coordinates>) concGrp_1 = FigureConcyclicGroup.create() FigureConcyclicGroup.setup_instance(concGrp_1, points=[poiny1, point2, point3], name='ConcGrp_1') result = FigureConcyclicGroup.is_point_in_group(concGrp_1,point4)
Interaction constants

Pass these to Figure.add_interaction(oid_1, oid_2, None, CONSTANT) to declare geometric relationships the solver should propagate.

POINT_END_OF_SEGMENT = 4
Point is the end of a Segment
POINT_ON_SEGMENT = 5
Point on the Segment, but not the end of Segment. (Intermediate point)
POINT_CENTER_OF_CIRCLE = 7
Point is the center of a Circle
POINT_ON_CIRCLE_OUTLINE = 8
Point is on Circle outline
POINT_ON_FIGURE_OUTLINE = 9
Point is on Figure outline, nota Vertex of end of side
POINT_APEX_OF_ANGLE = 10
Apex of an Angle
POINT_ON_PLANE = 12
Point on Plane
POINT_IN_CONCYCLIC_GROUP = 13
Point in Concyclic Group
INTERACTION_INSCRIBED = 15
Element is inscribed in other element (now supported - inscribed in Circle)
INTERACTION_CIRCUMSCRIBED = 16
Element is circumscribed by a Circle
INTERACTION_INTERSECTION = 17
Two elements (segments) intersected at Point
INTERACTION_RADIUS = 21
Segment is a Radius of a Circle
INTERACTION_DIAMETER = 22
Segment is a Diameter of a Circle
INTERACTION_APOTHEM = 23
Segment is an Apothem of a Polygon
INTERACTION_CONCYCLIC_WITH = 25
Element is Circumscribed by the same Circle as other element
INTERACTION_PARALLEL = 26
Segment is parallel to a Segment
INTERACTION_EQUAL = 27
Element parameter value is equal to same parameter value of other Element
Figure type constants

These identify figure types in Figure.get_type(oid) results and in interaction filtering calls. They are pre-loaded in the playground namespace.

ELEMENT_TYPE_PLANE = 1
ELEMENT_TYPE_POINT = 2
ELEMENT_TYPE_SEGMENT = 5
ELEMENT_TYPE_SIDE = 6
ELEMENT_TYPE_ANGLE = 7
ELEMENT_TYPE_TRIANGLE = 8
ELEMENT_TYPE_CIRCLE = 9
ELEMENT_TYPE_POLYGON = 11
ELEMENT_TYPE_ELLIPSE = 12
ELEMENT_TYPE_CONCYCLIC_GROUP = 22
ELEMENT_TYPE_FUNCTION = 28
No API entries match your search.