Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 18.8 mm long and bar QR is 11 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 17 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

Report every point as [x, y] in the datum frame described in the text, and every circle as {centre_label: radius}. Give at least 4 decimal places: a stated fact counts as satisfied only when its residual is below 5e-3 mm.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0025. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(27)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 18.8, description="bar PQ is 18.8 long")
scene.constraint.eq(Q.distance(R), 11, description="bar QR is 11 long")
scene.constraint.eq(P.distance(R), 17, description="the mechanism is set so that R sits 17 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")

the parallelogram condition is the vector relation R = Q + S - P

equivalently the two diagonals PR and QS bisect each other

the opposite bars are equal, so |SR| = |PQ| and |PS| = |QR| without being stated again

the diagonal is limited to between |PQ - QR| and PQ + QR, and the stated value lies inside that range

Q above the diagonal and S below it fixes which way the parallelogram folds


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 16.8 mm long and bar QR is 8.6 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 21.9 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0026. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(33)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 16.8, description="bar PQ is 16.8 long")
scene.constraint.eq(Q.distance(R), 8.6, description="bar QR is 8.6 long")
scene.constraint.eq(P.distance(R), 21.9, description="the mechanism is set so that R sits 21.9 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 14.9 mm long and bar QR is 11.2 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 11 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0027. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(19)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 14.9, description="bar PQ is 14.9 long")
scene.constraint.eq(Q.distance(R), 11.2, description="bar QR is 11.2 long")
scene.constraint.eq(P.distance(R), 11, description="the mechanism is set so that R sits 11 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 15.4 mm long and bar QR is 12.9 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 19.2 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0028. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(30)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 15.4, description="bar PQ is 15.4 long")
scene.constraint.eq(Q.distance(R), 12.9, description="bar QR is 12.9 long")
scene.constraint.eq(P.distance(R), 19.2, description="the mechanism is set so that R sits 19.2 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 16.5 mm long and bar QR is 9.1 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 15.8 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0029. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(26)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 16.5, description="bar PQ is 16.5 long")
scene.constraint.eq(Q.distance(R), 9.1, description="bar QR is 9.1 long")
scene.constraint.eq(P.distance(R), 15.8, description="the mechanism is set so that R sits 15.8 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 21.8 mm long and bar QR is 8.8 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 22.8 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0030. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(35)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 21.8, description="bar PQ is 21.8 long")
scene.constraint.eq(Q.distance(R), 8.8, description="bar QR is 8.8 long")
scene.constraint.eq(P.distance(R), 22.8, description="the mechanism is set so that R sits 22.8 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 17.9 mm long and bar QR is 8.1 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 22.5 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0031. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(34)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 17.9, description="bar PQ is 17.9 long")
scene.constraint.eq(Q.distance(R), 8.1, description="bar QR is 8.1 long")
scene.constraint.eq(P.distance(R), 22.5, description="the mechanism is set so that R sits 22.5 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Four bars are pinned together so that they always form a parallelogram, with pins at P, Q, R and S taken in order round the loop: bar PQ stays parallel and equal to bar SR, and bar QR stays parallel and equal to bar PS. Pin P is fixed to the bench. Bar PQ is 21.5 mm long and bar QR is 9.1 mm long. Set up coordinates with P at the origin and with the mechanism opened out so that pin R sits 25.2 mm from P along the positive x-direction. In this position pin Q lies above the line PR and pin S below it.

"""Pantograph parallelogram set to a diagonal

Oracle formalization for mech_t1_mech_pantograph_0032. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

P, Q, R, S = scene.add.points(["P", "Q", "R", "S"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the fixed pin of the pantograph (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the fixed pin of the pantograph (y)")
scene.constraint.eq(R.y, P.y, description="datum: the diagonal PR is laid along the x-axis")
scene.constraint.gt(R.x, 1.0, description="datum: R lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 21.5, description="bar PQ is 21.5 long")
scene.constraint.eq(Q.distance(R), 9.1, description="bar QR is 9.1 long")
scene.constraint.eq(P.distance(R), 25.2, description="the mechanism is set so that R sits 25.2 from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="the four bars always form a parallelogram (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="the four bars always form a parallelogram (y)")
scene.constraint.gt(cross(P, R, Q), 0.05, description="pin Q lies above the diagonal PR and pin S below it")


Two identical straight bars, each 37.2 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 15.6 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0033. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(46)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 37.2, description="the first bar is 37.2 long")
scene.constraint.eq(F2.distance(U2), 37.2, description="the second bar is 37.2 long")
scene.constraint.eq(X.y - F1.y, 15.6, description="the crossing pin sits 15.6 above the floor")

'halfway along both' means X is the midpoint of each bar

so each half-bar is half the stated bar length

because X is a midpoint and sits h above the floor, each upper end is 2h above the floor

each lower end is sqrt((half bar)^2 - h^2) horizontally away from X

the lower ends rest apart, which rules out the collapsed arrangement with both bars on top of each other


Two identical straight bars, each 34.2 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 12.7 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0034. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 34.2, description="the first bar is 34.2 long")
scene.constraint.eq(F2.distance(U2), 34.2, description="the second bar is 34.2 long")
scene.constraint.eq(X.y - F1.y, 12.7, description="the crossing pin sits 12.7 above the floor")


Two identical straight bars, each 29 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 6.7 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0035. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 29, description="the first bar is 29 long")
scene.constraint.eq(F2.distance(U2), 29, description="the second bar is 29 long")
scene.constraint.eq(X.y - F1.y, 6.7, description="the crossing pin sits 6.7 above the floor")


Two identical straight bars, each 32.6 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 7.2 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0036. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(43)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 32.6, description="the first bar is 32.6 long")
scene.constraint.eq(F2.distance(U2), 32.6, description="the second bar is 32.6 long")
scene.constraint.eq(X.y - F1.y, 7.2, description="the crossing pin sits 7.2 above the floor")


Two identical straight bars, each 34.9 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 12.5 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0037. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 34.9, description="the first bar is 34.9 long")
scene.constraint.eq(F2.distance(U2), 34.9, description="the second bar is 34.9 long")
scene.constraint.eq(X.y - F1.y, 12.5, description="the crossing pin sits 12.5 above the floor")


Two identical straight bars, each 39.3 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 13.3 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0038. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(43)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 39.3, description="the first bar is 39.3 long")
scene.constraint.eq(F2.distance(U2), 39.3, description="the second bar is 39.3 long")
scene.constraint.eq(X.y - F1.y, 13.3, description="the crossing pin sits 13.3 above the floor")


Two identical straight bars, each 36.7 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 9.1 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0039. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(46)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 36.7, description="the first bar is 36.7 long")
scene.constraint.eq(F2.distance(U2), 36.7, description="the second bar is 36.7 long")
scene.constraint.eq(X.y - F1.y, 9.1, description="the crossing pin sits 9.1 above the floor")


Two identical straight bars, each 36.7 mm long, are crossed over each other and pinned together at a single point X that is exactly halfway along both of them. The lower end of the first bar is F1 and the lower end of the second is F2; both rest on the same flat floor, a distance apart from each other. The upper ends are U1 on the first bar and U2 on the second. Set up coordinates with F1 at the origin and the floor as the line through it. Arrange the pair so that the crossing pin X sits 11.2 mm above the floor.

"""Scissor pair at a stated pin height

Oracle formalization for mech_t1_mech_scissor_0040. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(43)

F1, F2, U1, U2, X = scene.add.points(["F1", "F2", "U1", "U2", "X"])

scene.constraint.eq(F1.x, 0, description="datum: F1 is the origin, the lower end of the first bar (x)")
scene.constraint.eq(F1.y, 0, description="datum: F1 is the origin, the lower end of the first bar (y)")
scene.constraint.eq(F2.y, F1.y, description="both lower ends rest on the same flat floor")
scene.constraint.gt(F2.x - F1.x, 2.0, description="the two lower ends rest apart from each other on the floor")
scene.relate.is_midpoint(X, scene.add.line_segment(F1, U1))
scene.relate.is_midpoint(X, scene.add.line_segment(F2, U2))
scene.constraint.eq(F1.distance(U1), 36.7, description="the first bar is 36.7 long")
scene.constraint.eq(F2.distance(U2), 36.7, description="the second bar is 36.7 long")
scene.constraint.eq(X.y - F1.y, 11.2, description="the crossing pin sits 11.2 above the floor")


A short bar 13.4 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 31.3 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs -5.2 mm above the level of O. Show the arrangement at the moment when the short bar stands 35 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0009. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(56)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 13.4, description="the short bar OP is 13.4 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 35, description="the short bar stands 35 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 31.3, description="the long bar PQ is 31.3 long")
scene.constraint.eq(Q.y, -5.2, description="the block runs on a straight rail -5.2 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")

the rail is the horizontal line at the stated height, so the block centre has that y

at the stated instant P is at O plus the crank length times (cos, sin) of the crank angle

the block is where a circle of the conrod length centred at P cuts the rail line

that circle cuts the rail line twice, so a choice has to be made

the block is on the far side of the crank pin, which picks one of the two intersections


A short bar 13.2 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 32.5 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs 7.9 mm above the level of O. Show the arrangement at the moment when the short bar stands 70 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0010. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(53)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 13.2, description="the short bar OP is 13.2 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 70, description="the short bar stands 70 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 32.5, description="the long bar PQ is 32.5 long")
scene.constraint.eq(Q.y, 7.9, description="the block runs on a straight rail 7.9 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 9.5 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 25.1 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs 6.9 mm above the level of O. Show the arrangement at the moment when the short bar stands 70 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0011. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(42)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 9.5, description="the short bar OP is 9.5 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 70, description="the short bar stands 70 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 25.1, description="the long bar PQ is 25.1 long")
scene.constraint.eq(Q.y, 6.9, description="the block runs on a straight rail 6.9 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 12 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 24.2 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs 7.1 mm above the level of O. Show the arrangement at the moment when the short bar stands 55 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0012. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(45)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 12, description="the short bar OP is 12 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 55, description="the short bar stands 55 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 24.2, description="the long bar PQ is 24.2 long")
scene.constraint.eq(Q.y, 7.1, description="the block runs on a straight rail 7.1 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 10.3 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 24.1 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs -3 mm above the level of O. Show the arrangement at the moment when the short bar stands 70 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0013. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(36)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 10.3, description="the short bar OP is 10.3 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 70, description="the short bar stands 70 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 24.1, description="the long bar PQ is 24.1 long")
scene.constraint.eq(Q.y, -3, description="the block runs on a straight rail -3 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 9.5 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 27.4 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs 3 mm above the level of O. Show the arrangement at the moment when the short bar stands 35 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0014. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(51)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 9.5, description="the short bar OP is 9.5 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 35, description="the short bar stands 35 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 27.4, description="the long bar PQ is 27.4 long")
scene.constraint.eq(Q.y, 3, description="the block runs on a straight rail 3 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 13 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 25.7 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs -2.6 mm above the level of O. Show the arrangement at the moment when the short bar stands 50 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0015. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(45)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 13, description="the short bar OP is 13 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 50, description="the short bar stands 50 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 25.7, description="the long bar PQ is 25.7 long")
scene.constraint.eq(Q.y, -2.6, description="the block runs on a straight rail -2.6 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A short bar 9.5 mm long is pinned to the bench at a fixed pin O and can spin all the way round. Set up coordinates with O at the origin; the datum direction is marked by a construction point E, which sits 10 mm from O, level with it. The free end of the short bar is the pin P. A second bar, 30.7 mm long, joins P to a block whose centre is Q; the block slides along a straight rail that runs -5.6 mm above the level of O. Show the arrangement at the moment when the short bar stands 35 degrees above the datum direction, turned anticlockwise from it. At that moment the block is on the far side of the crank pin from O, not folded back over it.

"""Slider-crank at a stated crank angle

Oracle formalization for mech_t1_mech_slider_crank_0016. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(52)

O, E, P, Q = scene.add.points(["O", "E", "P", "Q"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the fixed crank pin (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the fixed crank pin (y)")
scene.constraint.eq(E.y, O.y, description="construction point E is level with O")
scene.constraint.eq(E.x - O.x, 10, description="construction point E is 10 mm from O in the datum direction, so angles can be measured from it")
scene.constraint.eq(O.distance(P), 9.5, description="the short bar OP is 9.5 long")
scene.constraint.eq(scene.add.angle(P, O, E).value, 35, description="the short bar stands 35 degrees above the datum direction")
scene.constraint.gt(cross(O, E, P), 0.05, description="the short bar is turned anticlockwise from the datum direction, so P is above it")
scene.constraint.eq(P.distance(Q), 30.7, description="the long bar PQ is 30.7 long")
scene.constraint.eq(Q.y, -5.6, description="the block runs on a straight rail -5.6 above the level of O")
scene.constraint.gt(Q.x - P.x, 0.05, description="the block sits on the far side of the crank pin from the fixed pin, not folded back over it")


A straight bar 20.8 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 8.9 mm along it from the block Bh. Set the mechanism so that the block Bh is 8.3 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0087. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(30)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 8.3, description="the first block is set 8.3 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 20.8, description="the bar joining the two blocks is 20.8 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 8.9, description="the tracing point T is marked 8.9 along the bar from the first block")

each block lies on its own rail, so one has height 0 and the other has abscissa 0

the bar is rigid, so the two blocks stay exactly the bar length apart

with one block's position given, the other follows from the right-angled triangle formed with the rails

the tracing point lies ON the bar between the blocks, at the stated distance from Bh

Bv is on the upper half of its rail, which picks the sign of its position


A straight bar 22.2 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 11.1 mm along it from the block Bh. Set the mechanism so that the block Bh is 9.2 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0088. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(31)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 9.2, description="the first block is set 9.2 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 22.2, description="the bar joining the two blocks is 22.2 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 11.1, description="the tracing point T is marked 11.1 along the bar from the first block")


A straight bar 21.3 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 12.3 mm along it from the block Bh. Set the mechanism so that the block Bh is 9.5 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0089. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(30)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 9.5, description="the first block is set 9.5 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 21.3, description="the bar joining the two blocks is 21.3 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 12.3, description="the tracing point T is marked 12.3 along the bar from the first block")


A straight bar 23.8 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 17.3 mm along it from the block Bh. Set the mechanism so that the block Bh is 14 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0090. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(30)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 14, description="the first block is set 14 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 23.8, description="the bar joining the two blocks is 23.8 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 17.3, description="the tracing point T is marked 17.3 along the bar from the first block")


A straight bar 24.2 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 16.6 mm along it from the block Bh. Set the mechanism so that the block Bh is 14.9 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0091. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(30)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 14.9, description="the first block is set 14.9 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 24.2, description="the bar joining the two blocks is 24.2 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 16.6, description="the tracing point T is marked 16.6 along the bar from the first block")


A straight bar 28.1 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 16.9 mm along it from the block Bh. Set the mechanism so that the block Bh is 17.3 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0092. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(34)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 17.3, description="the first block is set 17.3 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 28.1, description="the bar joining the two blocks is 28.1 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 16.9, description="the tracing point T is marked 16.9 along the bar from the first block")


A straight bar 24.8 mm long has a small block pinned at each end. One block, Bh, slides along a horizontal rail; the other, Bv, slides along a vertical rail. The two rails cross at a point Z, which is the origin of the coordinates. A tracing point T is marked on the bar, 7.5 mm along it from the block Bh. Set the mechanism so that the block Bh is 13.8 mm from the crossing point along its own rail, in the positive direction, with the block Bv on the upper half of the vertical rail.

"""Elliptic trammel with a tracing point

Oracle formalization for mech_t1_mech_trammel_0093. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(32)

Z, Bh, Bv, T = scene.add.points(["Z", "Bh", "Bv", "T"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the crossing point of the two rails (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the crossing point of the two rails (y)")
scene.constraint.eq(Bh.y, Z.y, description="the first block runs on the horizontal rail through Z")
scene.constraint.eq(Bv.x, Z.x, description="the second block runs on the vertical rail through Z")
scene.constraint.eq(Bh.x - Z.x, 13.8, description="the first block is set 13.8 along its rail from the crossing point")
scene.constraint.gt(Bv.y - Z.y, 0.05, description="the second block sits on the upper half of the vertical rail")
scene.constraint.eq(Bh.distance(Bv), 24.8, description="the bar joining the two blocks is 24.8 long")
scene.relate.point_lies_on(T, scene.add.line_segment(Bh, Bv))
scene.constraint.eq(Bh.distance(T), 7.5, description="the tracing point T is marked 7.5 along the bar from the first block")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 31.8 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 13.5 mm long and ends at a pin W; the bar at V is 23.3 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0065. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(46)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 31.8, description="the two fixed pins are 31.8 apart")
scene.constraint.eq(U.distance(W), 13.5, description="the bar at U is 13.5 long, ending at pin W")
scene.constraint.eq(V.distance(X), 23.3, description="the bar at V is 23.3 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")

'points straight up' means W is directly above U, at U plus the bar length in the y-direction

'level with' means X has the same height as W

with its height fixed and its distance from V fixed, X is determined up to a left/right choice

the length of the third bar then follows from the two positions

X lies on the side of V facing U, which picks one of the two possibilities


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 21.7 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 13 mm long and ends at a pin W; the bar at V is 21.1 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0066. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(33)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 21.7, description="the two fixed pins are 21.7 apart")
scene.constraint.eq(U.distance(W), 13, description="the bar at U is 13 long, ending at pin W")
scene.constraint.eq(V.distance(X), 21.1, description="the bar at V is 21.1 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 25.4 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 9.4 mm long and ends at a pin W; the bar at V is 22.4 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0067. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 25.4, description="the two fixed pins are 25.4 apart")
scene.constraint.eq(U.distance(W), 9.4, description="the bar at U is 9.4 long, ending at pin W")
scene.constraint.eq(V.distance(X), 22.4, description="the bar at V is 22.4 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 29.2 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 9.7 mm long and ends at a pin W; the bar at V is 23.3 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0068. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(43)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 29.2, description="the two fixed pins are 29.2 apart")
scene.constraint.eq(U.distance(W), 9.7, description="the bar at U is 9.7 long, ending at pin W")
scene.constraint.eq(V.distance(X), 23.3, description="the bar at V is 23.3 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 23.2 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 11.1 mm long and ends at a pin W; the bar at V is 22.7 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0069. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(35)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 23.2, description="the two fixed pins are 23.2 apart")
scene.constraint.eq(U.distance(W), 11.1, description="the bar at U is 11.1 long, ending at pin W")
scene.constraint.eq(V.distance(X), 22.7, description="the bar at V is 22.7 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 23.3 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 10.2 mm long and ends at a pin W; the bar at V is 20 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0070. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(35)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 23.3, description="the two fixed pins are 23.3 apart")
scene.constraint.eq(U.distance(W), 10.2, description="the bar at U is 10.2 long, ending at pin W")
scene.constraint.eq(V.distance(X), 20, description="the bar at V is 20 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 27.3 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 13.6 mm long and ends at a pin W; the bar at V is 26.3 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0071. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(40)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 27.3, description="the two fixed pins are 27.3 apart")
scene.constraint.eq(U.distance(W), 13.6, description="the bar at U is 13.6 long, ending at pin W")
scene.constraint.eq(V.distance(X), 26.3, description="the bar at V is 26.3 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


Two bars are pinned to the bench at fixed pins U and V, which sit at the same height and are 27.6 mm apart. Set up coordinates with U at the origin and V to its right. The bar at U is 10.5 mm long and ends at a pin W; the bar at V is 16.3 mm long and ends at a pin X. A third bar joins W to X. In the position of interest the bar at U points straight up, and pin X is exactly level with pin W, lying on the side of V that faces U.

"""Two cranks joined by a common link

Oracle formalization for mech_t1_mech_two_cranks_0072. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(41)

U, V, W, X = scene.add.points(["U", "V", "W", "X"])

scene.constraint.eq(U.x, 0, description="datum: U is the origin, the first fixed pin (x)")
scene.constraint.eq(U.y, 0, description="datum: U is the origin, the first fixed pin (y)")
scene.constraint.eq(V.y, U.y, description="the two fixed pins sit at the same height on the bench")
scene.constraint.gt(V.x - U.x, 1.0, description="datum: V is to the right of U")
scene.constraint.eq(U.distance(V), 27.6, description="the two fixed pins are 27.6 apart")
scene.constraint.eq(U.distance(W), 10.5, description="the bar at U is 10.5 long, ending at pin W")
scene.constraint.eq(V.distance(X), 16.3, description="the bar at V is 16.3 long, ending at pin X")
scene.constraint.eq(W.x, U.x, description="the bar at U points straight up, so W is directly above U")
scene.constraint.gt(W.y - U.y, 0.05, description="the bar at U points UP, not down")
scene.constraint.eq(X.y, W.y, description="pin X is exactly level with pin W")
scene.constraint.lt(X.x - V.x, -0.05, description="pin X lies on the side of V towards U")


A bent lever turns about a fixed pin F. One arm runs 14.3 mm from F out to a pin G, the other arm runs 10.2 mm from F out to a pin H, and the two arms are set at a right angle to each other at F. A straight pull-rod 30.7 mm long connects pin G to a block whose centre is K; the block slides along a straight rail that runs 25 mm to the right of F. Set up coordinates with F at the origin. Place the lever so that pin H is level with F, with the arm FH reaching out to the right and the arm FG standing up above F. In this position the block sits below the level of pin G.

"""Bell crank with a pull-rod to a rail

Oracle formalization for mech_t2_mech_bell_crank_0041. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

def cross(A, B, P):
    """z-component of (B-A) x (P-A). Positive iff P lies to the LEFT of the
    directed line A->B. Used to state 'above', 'on the far side', 'anticlockwise'
    without any appeal to a picture."""
    return (B.x - A.x) * (P.y - A.y) - (B.y - A.y) * (P.x - A.x)

def dot(A, B, C, D):
    """(B-A) . (D-C). Positive iff the two directions point the same way."""
    return (B.x - A.x) * (D.x - C.x) + (B.y - A.y) * (D.y - C.y)

scene = GeoScene(38)

F, G, H, K = scene.add.points(["F", "G", "H", "K"])

scene.constraint.eq(F.x, 0, description="datum: F is the origin, the fixed pin of the bent lever (x)")
scene.constraint.eq(F.y, 0, description="datum: F is the origin, the fixed pin of the bent lever (y)")
scene.constraint.eq(H.y, F.y, description="pin H is level with the fixed pin F")
scene.constraint.gt(H.x - F.x, 1.0, description="the arm FH reaches out in the +x direction")
scene.constraint.eq(F.distance(G), 14.3, description="the arm FG is 14.3 long")
scene.constraint.eq(F.distance(H), 10.2, description="the arm FH is 10.2 long")
scene.relate.right_angle(G, F, H)
scene.constraint.gt(G.y - F.y, 0.05, description="the arm FG stands up above the fixed pin")
scene.constraint.eq(K.x - F.x, 25, description="the block runs on a straight rail 25 to the right of F")
scene.constraint.eq(G.distance(K), 30.7, description="the pull-rod from G to the block is 30.7 long")
scene.constraint.lt(K.y - G.y, -0.05, description="the block sits below the level of pin G")

'H is level with F' means H has the same height as F, so the arm FH lies along the datum direction

the right angle at F then forces the arm FG to stand straight up

the block lies on the vertical line at the stated offset from F

the block is where a circle of the rod length centred at G cuts that vertical line - two crossings

the block sits below the level of G, which picks one of the two crossings