A shaft cross-section is a circle 22.3 mm across. A keyway is machined into it: a square-sided notch 7.3 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 19.7 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_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(19)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 7.3, description="the keyway is 7.3 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 22.3, description="the shaft is 22.3 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 19.7, description="from the flat bottom of the keyway across to the far side of the shaft measures 19.7")


A shaft cross-section is a circle 25.8 mm across. A keyway is machined into it: a square-sided notch 6.8 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 22.6 mm.

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.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_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(22)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 6.8, description="the keyway is 6.8 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 25.8, description="the shaft is 25.8 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 22.6, description="from the flat bottom of the keyway across to the far side of the shaft measures 22.6")

the shaft radius is half the stated across-size

the two side walls sit at +/- half the keyway width either side of the centreline

the side walls are parallel to the keyway centreline and the flat bottom is square to it

S is diametrically opposite, so the across measurement equals the bottom height plus the radius

the keyway depth below the shaft surface is the shaft size minus the across measurement

the side walls run UP from the flat bottom to the surface, not down


A shaft cross-section is a circle 21 mm across. A keyway is machined into it: a square-sided notch 6.1 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 18 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_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(19)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 6.1, description="the keyway is 6.1 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 21, description="the shaft is 21 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 18, description="from the flat bottom of the keyway across to the far side of the shaft measures 18")


A shaft cross-section is a circle 22.1 mm across. A keyway is machined into it: a square-sided notch 7.5 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 18.7 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_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(19)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 7.5, description="the keyway is 7.5 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 22.1, description="the shaft is 22.1 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 18.7, description="from the flat bottom of the keyway across to the far side of the shaft measures 18.7")


A shaft cross-section is a circle 23.5 mm across. A keyway is machined into it: a square-sided notch 8.2 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 21 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_0042. 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(20)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 8.2, description="the keyway is 8.2 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 23.5, description="the shaft is 23.5 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 21, description="from the flat bottom of the keyway across to the far side of the shaft measures 21")


A shaft cross-section is a circle 33.7 mm across. A keyway is machined into it: a square-sided notch 5.9 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 30.7 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_0043. 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)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 5.9, description="the keyway is 5.9 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 33.7, description="the shaft is 33.7 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 30.7, description="from the flat bottom of the keyway across to the far side of the shaft measures 30.7")


A shaft cross-section is a circle 26.4 mm across. A keyway is machined into it: a square-sided notch 5.2 mm wide with a flat bottom. Set up coordinates with the shaft centre at the origin O and the keyway cut symmetrically about the positive y-direction, so that the keyway centreline is the y-axis. The flat bottom of the keyway runs from its left corner K to its right corner L. The two side walls run from those corners out to the shaft surface, breaking out at M above K and at N above L. S is the point on the shaft surface directly opposite the keyway. Measured from the flat bottom of the keyway across to the far side of the shaft at S, the distance is 23.8 mm.

"""Keyway in a shaft cross-section

Oracle formalization for cad_t2_cad_keyway_0044. 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(22)

O, S, K, L, M, N = scene.add.points(["O", "S", "K", "L", "M", "N"])

scene.constraint.eq(O.x, 0, description="datum: O is the origin, the shaft centre (x)")
scene.constraint.eq(O.y, 0, description="datum: O is the origin, the shaft centre (y)")
scene.constraint.eq(K.x + L.x, 0, description="datum: the keyway is cut symmetrically about the y-axis")
scene.constraint.eq(L.x - K.x, 5.2, description="the keyway is 5.2 wide between its two side walls")
scene.constraint.gt(L.x, 0.05, description="L is the right-hand bottom corner and K the left-hand one")
scene.constraint.eq(K.y, L.y, description="the bottom of the keyway is flat and square to the keyway centreline")
shaft = scene.add.circle(O)
scene.constraint.eq(2 * shaft.radius, 26.4, description="the shaft is 26.4 across")
scene.relate.point_lies_on(M, shaft)
scene.relate.point_lies_on(N, shaft)
scene.constraint.eq(M.x, K.x, description="the left side wall runs straight up from K, parallel to the keyway centreline, and breaks out at M on the shaft surface")
scene.constraint.eq(N.x, L.x, description="the right side wall runs straight up from L and breaks out at N on the shaft surface")
scene.constraint.gt(M.y - K.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.constraint.gt(N.y - L.y, 0.05, description="the side walls run upward from the flat bottom to the shaft surface")
scene.relate.point_lies_on(S, shaft)
scene.constraint.eq(S.x, O.x, description="S is the point on the shaft surface directly opposite the keyway")
scene.constraint.lt(S.y, -0.05, description="S is on the far side of the shaft from the keyway")
scene.constraint.eq(K.y - S.y, 23.8, description="from the flat bottom of the keyway across to the far side of the shaft measures 23.8")


A rectangular cover plate measures 30.1 mm by 21.3 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 30.1 mm edge running from P along the positive x-direction to Q, and the 21.3 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 6.8 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 14.7 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(44)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 30.1, description="plate is 30.1 long along PQ")
scene.constraint.eq(P.distance(S), 21.3, description="plate is 21.3 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 14.7, description="the two slot end centres are 14.7 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 6.8, description="the slot is 6.8 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 6.8, description="the slot is 6.8 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")

each end arc has radius = HALF the stated slot width

both end centres lie on the plate's long centreline

symmetric placement puts the centres at +/- d/2 from the plate centre

'runs smoothly into' means the straight side is tangent to both end arcs

the side named is the UPPER one, not the lower


A rectangular cover plate measures 36.3 mm by 19.3 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 36.3 mm edge running from P along the positive x-direction to Q, and the 19.3 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 8.2 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 16.5 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(52)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 36.3, description="plate is 36.3 long along PQ")
scene.constraint.eq(P.distance(S), 19.3, description="plate is 19.3 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 16.5, description="the two slot end centres are 16.5 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 8.2, description="the slot is 8.2 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 8.2, description="the slot is 8.2 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 33.3 mm by 16.9 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 33.3 mm edge running from P along the positive x-direction to Q, and the 16.9 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 7.9 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 14 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(48)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 33.3, description="plate is 33.3 long along PQ")
scene.constraint.eq(P.distance(S), 16.9, description="plate is 16.9 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 14, description="the two slot end centres are 14 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 7.9, description="the slot is 7.9 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 7.9, description="the slot is 7.9 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 31.3 mm by 18.6 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 31.3 mm edge running from P along the positive x-direction to Q, and the 18.6 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 8.4 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 14.3 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(46)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 31.3, description="plate is 31.3 long along PQ")
scene.constraint.eq(P.distance(S), 18.6, description="plate is 18.6 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 14.3, description="the two slot end centres are 14.3 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 8.4, description="the slot is 8.4 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 8.4, description="the slot is 8.4 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 41.7 mm by 17.4 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 41.7 mm edge running from P along the positive x-direction to Q, and the 17.4 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 6.7 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 11.9 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(59)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 41.7, description="plate is 41.7 long along PQ")
scene.constraint.eq(P.distance(S), 17.4, description="plate is 17.4 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 11.9, description="the two slot end centres are 11.9 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 6.7, description="the slot is 6.7 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 6.7, description="the slot is 6.7 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 41.5 mm by 23.4 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 41.5 mm edge running from P along the positive x-direction to Q, and the 23.4 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 8.5 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 15.1 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(59)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 41.5, description="plate is 41.5 long along PQ")
scene.constraint.eq(P.distance(S), 23.4, description="plate is 23.4 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 15.1, description="the two slot end centres are 15.1 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 8.5, description="the slot is 8.5 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 8.5, description="the slot is 8.5 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 38.5 mm by 23.7 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 38.5 mm edge running from P along the positive x-direction to Q, and the 23.7 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 8.5 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 19.5 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_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(55)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 38.5, description="plate is 38.5 long along PQ")
scene.constraint.eq(P.distance(S), 23.7, description="plate is 23.7 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 19.5, description="the two slot end centres are 19.5 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 8.5, description="the slot is 8.5 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 8.5, description="the slot is 8.5 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 42.4 mm by 16.1 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 42.4 mm edge running from P along the positive x-direction to Q, and the 16.1 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 7.1 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 16.9 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_0017. 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(60)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 42.4, description="plate is 42.4 long along PQ")
scene.constraint.eq(P.distance(S), 16.1, description="plate is 16.1 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 16.9, description="the two slot end centres are 16.9 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 7.1, description="the slot is 7.1 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 7.1, description="the slot is 7.1 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A rectangular cover plate measures 42.5 mm by 25.1 mm. Set up coordinates with the plate's bottom-left corner at the origin P, the 42.5 mm edge running from P along the positive x-direction to Q, and the 25.1 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot is machined along the plate's long centreline. The slot is 8.1 mm wide and both of its ends are rounded off as semicircles. The two end centres are C at the left-hand end and D at the right-hand end; they are 17.1 mm apart and are placed symmetrically about the middle of the plate. The upper straight side of the slot runs smoothly into both rounded ends, touching the left end at T and the right end at V.

"""Rounded-end slot in a cover plate

Oracle formalization for cad_t2_cad_rounded_slot_0018. 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(60)

P, Q, R, S, C, D, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 42.5, description="plate is 42.5 long along PQ")
scene.constraint.eq(P.distance(S), 25.1, description="plate is 25.1 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(2 * C.y, P.y + S.y, description="slot end centre C lies midway between the two long edges")
scene.constraint.eq(2 * D.y, P.y + S.y, description="slot end centre D lies midway between the two long edges")
scene.constraint.eq(C.distance(D), 17.1, description="the two slot end centres are 17.1 apart")
scene.constraint.eq(C.x + D.x, P.x + Q.x, description="the two slot end centres are placed symmetrically about the middle of the plate")
scene.constraint.gt(D.x - C.x, 0.05, description="C is the left-hand end of the slot and D the right-hand end")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 8.1, description="the slot is 8.1 wide and its left end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 8.1, description="the slot is 8.1 wide and its right end is a semicircle spanning that width")
upper_side = scene.add.line(T, V)
scene.relate.tangent_to_circle(upper_side, arc_C, T)
scene.relate.tangent_to_circle(upper_side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the upper side of the slot")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the upper side of the slot")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 16.1 mm long and the included angle of the vee, measured at the apex between the two faces, is 90 degrees. The bar is 10.7 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0077. 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(20)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 16.1, description="each vee face is 16.1 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 90, description="the included angle of the vee is 90 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 10.7, description="the bar is 10.7 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")

the bar radius is half the stated across-size

'rests against both faces' means the bar circle is tangent to both faces

by symmetry the bar centre lies on the bisector of the vee, i.e. the y-axis

the centre height above the apex is the bar radius divided by the sine of HALF the included angle

each contact point is the foot of the perpendicular from F onto that face

the bar sits inside the vee, above the apex, not on the far side of it


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 17.3 mm long and the included angle of the vee, measured at the apex between the two faces, is 80 degrees. The bar is 14.4 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0078. 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(22)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 17.3, description="each vee face is 17.3 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 80, description="the included angle of the vee is 80 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 14.4, description="the bar is 14.4 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 25.3 mm long and the included angle of the vee, measured at the apex between the two faces, is 90 degrees. The bar is 12.8 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0079. 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(28)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 25.3, description="each vee face is 25.3 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 90, description="the included angle of the vee is 90 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 12.8, description="the bar is 12.8 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 20.1 mm long and the included angle of the vee, measured at the apex between the two faces, is 60 degrees. The bar is 15.1 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0080. 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(28)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 20.1, description="each vee face is 20.1 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 60, description="the included angle of the vee is 60 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 15.1, description="the bar is 15.1 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 23.2 mm long and the included angle of the vee, measured at the apex between the two faces, is 120 degrees. The bar is 11.4 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0081. 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, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 23.2, description="each vee face is 23.2 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 120, description="the included angle of the vee is 120 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 11.4, description="the bar is 11.4 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 23.9 mm long and the included angle of the vee, measured at the apex between the two faces, is 80 degrees. The bar is 9.2 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0082. 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(29)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 23.9, description="each vee face is 23.9 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 80, description="the included angle of the vee is 80 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 9.2, description="the bar is 9.2 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 24.8 mm long and the included angle of the vee, measured at the apex between the two faces, is 120 degrees. The bar is 10.7 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0083. 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)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 24.8, description="each vee face is 24.8 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 120, description="the included angle of the vee is 120 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 10.7, description="the bar is 10.7 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A round bar is set down into a vee block and rests against both faces. Set up coordinates with the apex of the vee at the origin Z, the vee opening upward and symmetric about the positive y-direction; the right-hand face runs from Z to A and the left-hand face runs from Z to B. Each face is 22.4 mm long and the included angle of the vee, measured at the apex between the two faces, is 70 degrees. The bar is 15.3 mm across, its centre is at F, and it seats down inside the vee until it touches the right-hand face at T and the left-hand face at U.

"""Round bar seated in a vee block

Oracle formalization for cad_t2_cad_vee_block_0084. 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(29)

Z, A, B, F, T, U = scene.add.points(["Z", "A", "B", "F", "T", "U"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the apex of the vee (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the apex of the vee (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the vee is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the vee is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: face ZA is the right-hand face and ZB the left-hand one")
scene.constraint.eq(Z.distance(A), 22.4, description="each vee face is 22.4 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 70, description="the included angle of the vee is 70 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
bar = scene.add.circle(F)
scene.constraint.eq(2 * bar.radius, 15.3, description="the bar is 15.3 across")
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.constraint.gt(F.y - Z.y, 0.05, description="the bar rests INSIDE the vee, above the apex")


A cover plate measures 42.6 mm by 30.7 mm. Set up coordinates with the bottom-left corner at the origin P, the 42.6 mm long edge running from P along the positive x-direction to Q, and the 30.7 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 7.3 mm wide with rounded ends is cut across the plate at 25 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 17.7 mm apart, and the slot is centred on the plate, so the midpoint between C and D is the centre of the plate. E is a construction point 5 mm from C in the datum direction, level with C, put there so the 25 degree angle can be measured as the angle DCE. One straight side of the slot touches the first end at T and the second at V; it is the side on the left when looking from C towards D.

"""Angled rounded-end slot

Oracle formalization for cad_t3_cad_angled_slot_0061. 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(60)

P, Q, R, S, C, D, E, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "E", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 42.6, description="plate is 42.6 long along PQ")
scene.constraint.eq(P.distance(S), 30.7, description="plate is 30.7 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(C.x + D.x, P.x + R.x, description="the slot is centred on the plate (x)")
scene.constraint.eq(C.y + D.y, P.y + R.y, description="the slot is centred on the plate (y)")
scene.constraint.eq(C.distance(D), 17.7, description="the two slot end centres are 17.7 apart")
scene.constraint.eq(E.y, C.y, description="construction point E marks the datum direction from C: it is level with C")
scene.constraint.eq(E.x - C.x, 5, description="construction point E is 5 mm from C along the datum direction")
scene.constraint.eq(scene.add.angle(D, C, E).value, 25, description="the slot axis CD is set at 25 degrees to the long edge of the plate")
scene.constraint.gt(cross(C, E, D), 0.05, description="the slot axis is rotated anticlockwise from the long edge")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 7.3, description="the slot is 7.3 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 7.3, description="the slot is 7.3 wide and its second end is a semicircle spanning that width")
side = scene.add.line(T, V)
scene.relate.tangent_to_circle(side, arc_C, T)
scene.relate.tangent_to_circle(side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the left-hand side of the slot, looking from C towards D")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the left-hand side of the slot, looking from C towards D")

each end arc radius is half the stated slot width

'centred on the plate' means the midpoint of CD is the plate centre

the end centres sit at +/- half the 17.7 mm spacing along the 25 degree direction

the straight sides are parallel to CD, offset by the end radius, and tangent to both ends

the slot axis is rotated ANTICLOCKWISE from the long edge

the side named is the left-hand one looking from C to D


A cover plate measures 39.4 mm by 33.6 mm. Set up coordinates with the bottom-left corner at the origin P, the 39.4 mm long edge running from P along the positive x-direction to Q, and the 33.6 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 5.8 mm wide with rounded ends is cut across the plate at 40 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 17.7 mm apart, and the slot is centred on the plate, so the midpoint between C and D is the centre of the plate. E is a construction point 5 mm from C in the datum direction, level with C, put there so the 40 degree angle can be measured as the angle DCE. One straight side of the slot touches the first end at T and the second at V; it is the side on the left when looking from C towards D.

"""Angled rounded-end slot

Oracle formalization for cad_t3_cad_angled_slot_0062. 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)

P, Q, R, S, C, D, E, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "E", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 39.4, description="plate is 39.4 long along PQ")
scene.constraint.eq(P.distance(S), 33.6, description="plate is 33.6 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(C.x + D.x, P.x + R.x, description="the slot is centred on the plate (x)")
scene.constraint.eq(C.y + D.y, P.y + R.y, description="the slot is centred on the plate (y)")
scene.constraint.eq(C.distance(D), 17.7, description="the two slot end centres are 17.7 apart")
scene.constraint.eq(E.y, C.y, description="construction point E marks the datum direction from C: it is level with C")
scene.constraint.eq(E.x - C.x, 5, description="construction point E is 5 mm from C along the datum direction")
scene.constraint.eq(scene.add.angle(D, C, E).value, 40, description="the slot axis CD is set at 40 degrees to the long edge of the plate")
scene.constraint.gt(cross(C, E, D), 0.05, description="the slot axis is rotated anticlockwise from the long edge")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 5.8, description="the slot is 5.8 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 5.8, description="the slot is 5.8 wide and its second end is a semicircle spanning that width")
side = scene.add.line(T, V)
scene.relate.tangent_to_circle(side, arc_C, T)
scene.relate.tangent_to_circle(side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the left-hand side of the slot, looking from C towards D")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the left-hand side of the slot, looking from C towards D")

the end centres sit at +/- half the 17.7 mm spacing along the 40 degree direction


A cover plate measures 37.8 mm by 31.5 mm. Set up coordinates with the bottom-left corner at the origin P, the 37.8 mm long edge running from P along the positive x-direction to Q, and the 31.5 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 6.9 mm wide with rounded ends is cut across the plate at 20 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 18.3 mm apart, and the slot is centred on the plate, so the midpoint between C and D is the centre of the plate. E is a construction point 5 mm from C in the datum direction, level with C, put there so the 20 degree angle can be measured as the angle DCE. One straight side of the slot touches the first end at T and the second at V; it is the side on the left when looking from C towards D.

"""Angled rounded-end slot

Oracle formalization for cad_t3_cad_angled_slot_0063. 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(54)

P, Q, R, S, C, D, E, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "E", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 37.8, description="plate is 37.8 long along PQ")
scene.constraint.eq(P.distance(S), 31.5, description="plate is 31.5 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(C.x + D.x, P.x + R.x, description="the slot is centred on the plate (x)")
scene.constraint.eq(C.y + D.y, P.y + R.y, description="the slot is centred on the plate (y)")
scene.constraint.eq(C.distance(D), 18.3, description="the two slot end centres are 18.3 apart")
scene.constraint.eq(E.y, C.y, description="construction point E marks the datum direction from C: it is level with C")
scene.constraint.eq(E.x - C.x, 5, description="construction point E is 5 mm from C along the datum direction")
scene.constraint.eq(scene.add.angle(D, C, E).value, 20, description="the slot axis CD is set at 20 degrees to the long edge of the plate")
scene.constraint.gt(cross(C, E, D), 0.05, description="the slot axis is rotated anticlockwise from the long edge")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 6.9, description="the slot is 6.9 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 6.9, description="the slot is 6.9 wide and its second end is a semicircle spanning that width")
side = scene.add.line(T, V)
scene.relate.tangent_to_circle(side, arc_C, T)
scene.relate.tangent_to_circle(side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the left-hand side of the slot, looking from C towards D")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the left-hand side of the slot, looking from C towards D")

the end centres sit at +/- half the 18.3 mm spacing along the 20 degree direction


A cover plate measures 35.5 mm by 28.8 mm. Set up coordinates with the bottom-left corner at the origin P, the 35.5 mm long edge running from P along the positive x-direction to Q, and the 28.8 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 7.8 mm wide with rounded ends is cut across the plate at 30 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 13 mm apart, and the slot is centred on the plate, so the midpoint between C and D is the centre of the plate. E is a construction point 5 mm from C in the datum direction, level with C, put there so the 30 degree angle can be measured as the angle DCE. One straight side of the slot touches the first end at T and the second at V; it is the side on the left when looking from C towards D.

"""Angled rounded-end slot

Oracle formalization for cad_t3_cad_angled_slot_0064. 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)

P, Q, R, S, C, D, E, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "E", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 35.5, description="plate is 35.5 long along PQ")
scene.constraint.eq(P.distance(S), 28.8, description="plate is 28.8 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(C.x + D.x, P.x + R.x, description="the slot is centred on the plate (x)")
scene.constraint.eq(C.y + D.y, P.y + R.y, description="the slot is centred on the plate (y)")
scene.constraint.eq(C.distance(D), 13, description="the two slot end centres are 13 apart")
scene.constraint.eq(E.y, C.y, description="construction point E marks the datum direction from C: it is level with C")
scene.constraint.eq(E.x - C.x, 5, description="construction point E is 5 mm from C along the datum direction")
scene.constraint.eq(scene.add.angle(D, C, E).value, 30, description="the slot axis CD is set at 30 degrees to the long edge of the plate")
scene.constraint.gt(cross(C, E, D), 0.05, description="the slot axis is rotated anticlockwise from the long edge")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 7.8, description="the slot is 7.8 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 7.8, description="the slot is 7.8 wide and its second end is a semicircle spanning that width")
side = scene.add.line(T, V)
scene.relate.tangent_to_circle(side, arc_C, T)
scene.relate.tangent_to_circle(side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the left-hand side of the slot, looking from C towards D")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the left-hand side of the slot, looking from C towards D")

the end centres sit at +/- half the 13 mm spacing along the 30 degree direction


A cover plate measures 44 mm by 26.7 mm. Set up coordinates with the bottom-left corner at the origin P, the 44 mm long edge running from P along the positive x-direction to Q, and the 26.7 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 6.5 mm wide with rounded ends is cut across the plate at 20 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 16.3 mm apart, and the slot is centred on the plate, so the midpoint between C and D is the centre of the plate. E is a construction point 5 mm from C in the datum direction, level with C, put there so the 20 degree angle can be measured as the angle DCE. One straight side of the slot touches the first end at T and the second at V; it is the side on the left when looking from C towards D.

"""Angled rounded-end slot

Oracle formalization for cad_t3_cad_angled_slot_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(62)

P, Q, R, S, C, D, E, T, V = scene.add.points(["P", "Q", "R", "S", "C", "D", "E", "T", "V"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the datum corner of the plate (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the datum corner of the plate (y)")
scene.constraint.eq(Q.y, 0, description="datum: edge PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the plate lies in the +x direction from P")
scene.constraint.eq(P.distance(Q), 44, description="plate is 44 long along PQ")
scene.constraint.eq(P.distance(S), 26.7, description="plate is 26.7 wide along PS")
scene.relate.perpendicular(scene.add.line_segment(P, Q), scene.add.line_segment(P, S))
scene.constraint.gt(S.y, 1.0, description="datum: the plate lies in the +y direction from P")
scene.constraint.eq(R.x, Q.x + S.x - P.x, description="plate corner R closes the rectangle (x)")
scene.constraint.eq(R.y, Q.y + S.y - P.y, description="plate corner R closes the rectangle (y)")
scene.constraint.eq(C.x + D.x, P.x + R.x, description="the slot is centred on the plate (x)")
scene.constraint.eq(C.y + D.y, P.y + R.y, description="the slot is centred on the plate (y)")
scene.constraint.eq(C.distance(D), 16.3, description="the two slot end centres are 16.3 apart")
scene.constraint.eq(E.y, C.y, description="construction point E marks the datum direction from C: it is level with C")
scene.constraint.eq(E.x - C.x, 5, description="construction point E is 5 mm from C along the datum direction")
scene.constraint.eq(scene.add.angle(D, C, E).value, 20, description="the slot axis CD is set at 20 degrees to the long edge of the plate")
scene.constraint.gt(cross(C, E, D), 0.05, description="the slot axis is rotated anticlockwise from the long edge")
arc_C = scene.add.circle(C)
arc_D = scene.add.circle(D)
scene.constraint.eq(2 * arc_C.radius, 6.5, description="the slot is 6.5 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 6.5, description="the slot is 6.5 wide and its second end is a semicircle spanning that width")
side = scene.add.line(T, V)
scene.relate.tangent_to_circle(side, arc_C, T)
scene.relate.tangent_to_circle(side, arc_D, V)
scene.constraint.gt(cross(C, D, T), 0.05, description="T is on the left-hand side of the slot, looking from C towards D")
scene.constraint.gt(cross(C, D, V), 0.05, description="V is on the left-hand side of the slot, looking from C towards D")

the end centres sit at +/- half the 16.3 mm spacing along the 20 degree direction