| |
- geosolver.constraint.Constraint
-
- ParametricConstraint(geosolver.constraint.Constraint, geosolver.notify.Notifier)
-
- AngleConstraint
- DistanceConstraint
- FixConstraint
- GeometricCluster
- geosolver.notify.Listener
-
- GeometricProblem(geosolver.notify.Notifier, geosolver.notify.Listener)
- GeometricSolver
- geosolver.notify.Notifier
-
- GeometricProblem(geosolver.notify.Notifier, geosolver.notify.Listener)
- ParametricConstraint(geosolver.constraint.Constraint, geosolver.notify.Notifier)
-
- AngleConstraint
- DistanceConstraint
- FixConstraint
class AngleConstraint(ParametricConstraint) |
|
A constraint on the angle in point B of a triangle ABC |
|
- Method resolution order:
- AngleConstraint
- ParametricConstraint
- geosolver.constraint.Constraint
- geosolver.notify.Notifier
Methods defined here:
- __init__(self, a, b, c, ang)
- Create a new AngleConstraint instance.
keyword args:
a - a point variable name
b - a point variable name
c - a point variable name
ang - the angle parameter value
- __str__(self)
- satisfied(self, mapping)
- return True iff mapping from variable names to points satisfies constraint
Methods inherited from ParametricConstraint:
- get_parameter(self)
- get parameter value
- set_parameter(self, value)
- set parameter value and notify any listeners
Methods inherited from geosolver.constraint.Constraint:
- variables(self)
- return a list of variables
If an attribute '_variables' has been defined, a new list
with the contents of that attribute will be returned.
Subclasses may choose to initialise this variable or to
override this function.
Methods inherited from geosolver.notify.Notifier:
- add_listener(self, listener)
- add a listener to the list (and self to listers' list)
- rem_listener(self, listener)
- remove a listener from the list (and self from listers' list)
- send_notify(self, message)
- send a message to all listeners
|
class GeometricCluster |
|
Represents the result of solving a GeometricProblem. A cluster is a list of
point variable names and a list of solutions for
those variables. A solution is a dictionary mapping variable names to
points. The cluster also keeps a list of sub-clusters (GeometricCluster)
and a set of flags, indicating incidental/structural
under/overconstrained
instance attributes:
variables - a list of point variable names
solutions - a list of solutions. Each solution is a dictionary
mapping variable names to vectors.
subs - a list of sub-clusters
flag - value meaning
OK well constrained
I_OVER incicental over-constrained
I_UNDER incidental under-constrained
S_OVER structural overconstrained
S_UNDER structural underconstrained
UNSOLVED unsolved |
|
Methods defined here:
- __init__(self)
- initialise an empty new cluster
- __str__(self)
Data and other attributes defined here:
- I_OVER = 'incidental over-constrained'
- I_UNDER = 'incidental under-constrained'
- OK = 'well constrained'
- S_OVER = 'structral over-constrained'
- S_UNDER = 'structural under-constrained'
- UNSOLVED = 'unsolved'
|
class GeometricProblem(geosolver.notify.Notifier, geosolver.notify.Listener) |
|
A geometric constraint problem with a prototype.
A problem consists of point variables (just variables for short), prototype
points for each variable and constraints.
Variables are just names and can be any hashable object (recommend strings)
Supported constraints are instances of DistanceConstraint,AngleConstraint,
FixConstraint or SelectionConstraint.
Prototype points are instances of vector.
GeometricProblem listens for changes in constraint parameters and passes
these changes, and changes in the system of constraints and the prototype,
to any other listerers (e.g. GeometricSolver)
instance attributes:
cg - a ConstraintGraph instance
prototype - a dictionary mapping variables to points |
|
- Method resolution order:
- GeometricProblem
- geosolver.notify.Notifier
- geosolver.notify.Listener
Methods defined here:
- __init__(self, dimension)
- initialize a new problem
- __str__(self)
- add_constraint(self, con)
- add a constraint
- add_point(self, variable, position)
- add a point variable with a prototype position
- get_angle(self, a, b, c)
- return the angle constraint on given points, or None
- get_distance(self, a, b)
- return the distance constraint on given points, or None
- get_fix(self, p)
- return the fix constraint on given point, or None
- get_point(self, variable)
- get prototype position of point variable
- has_point(self, variable)
- receive_notify(self, object, notify)
- When notified of changed constraint parameters, pass on to listeners
- rem_constraint(self, con)
- remove a constraint from the constraint system
- rem_point(self, var)
- remove a point variable from the constraint system
- set_point(self, variable, position)
- set prototype position of point variable
- verify(self, solution)
- returns true iff all constraints satisfied by given solution.
solution is a dictionary mapping variables (names) to values (points)
Methods inherited from geosolver.notify.Notifier:
- add_listener(self, listener)
- add a listener to the list (and self to listers' list)
- rem_listener(self, listener)
- remove a listener from the list (and self from listers' list)
- send_notify(self, message)
- send a message to all listeners
Methods inherited from geosolver.notify.Listener:
- add_notifier(self, notifier)
- add a notifier to the list (and self to notifiers' list)
- rem_notifier(self, notifier)
- remove a notifier from the list (and self from notifiers' list)
|
|