A cover plate measures 45.5 mm by 29.8 mm. Set up coordinates with the bottom-left corner at the origin P, the 45.5 mm long edge running from P along the positive x-direction to Q, and the 29.8 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 6.1 mm wide with rounded ends is cut across the plate at 50 degrees to the long edge, rotated anticlockwise from it. Its two end centres are C and D, 13.9 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 50 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_0066. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

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

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

scene = GeoScene(64)

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), 45.5, description="plate is 45.5 long along PQ")
scene.constraint.eq(P.distance(S), 29.8, description="plate is 29.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.9, description="the two slot end centres are 13.9 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, 50, description="the slot axis CD is set at 50 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.1, description="the slot is 6.1 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 6.1, description="the slot is 6.1 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.9 mm spacing along the 50 degree direction


A cover plate measures 36.4 mm by 30.8 mm. Set up coordinates with the bottom-left corner at the origin P, the 36.4 mm long edge running from P along the positive x-direction to Q, and the 30.8 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 5.9 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, 17.6 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.

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.

"""Angled rounded-end slot

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

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

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

scene = GeoScene(52)

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), 36.4, description="plate is 36.4 long along PQ")
scene.constraint.eq(P.distance(S), 30.8, description="plate is 30.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), 17.6, description="the two slot end centres are 17.6 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, 5.9, description="the slot is 5.9 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 5.9, description="the slot is 5.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")

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.6 mm spacing along the 30 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 36.9 mm by 30.3 mm. Set up coordinates with the bottom-left corner at the origin P, the 36.9 mm long edge running from P along the positive x-direction to Q, and the 30.3 mm edge running from P along the positive y-direction to S; R is the remaining corner. A slot 5.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, 14.4 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_0068. Every constraint below corresponds to one
statement in the problem text; the datum constraints fix the coordinate frame
the text describes, and the inequality constraints encode the discrete choices
the text makes explicit (which side, which branch).
"""
from pygeox import GeoScene

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

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

scene = GeoScene(53)

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), 36.9, description="plate is 36.9 long along PQ")
scene.constraint.eq(P.distance(S), 30.3, description="plate is 30.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(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), 14.4, description="the two slot end centres are 14.4 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, 5.9, description="the slot is 5.9 wide and its first end is a semicircle spanning that width")
scene.constraint.eq(2 * arc_D.radius, 5.9, description="the slot is 5.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 14.4 mm spacing along the 20 degree direction


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 18.8 mm across, the boss is 11.2 mm across, and their centres are 35.4 mm apart. The flank is an arc of radius 37.9 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

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

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 35.4, description="hub and boss centres are 35.4 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 18.8, description="the hub is 18.8 across")
scene.constraint.eq(2 * boss.radius, 11.2, description="the boss is 11.2 across")
scene.constraint.eq(flank.radius, 37.9, description="the flank arc has radius 37.9")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")

hub and boss radii are half the stated across-sizes

two circles touch externally exactly when the distance between centres equals the sum of the radii

so F is at distance (flank radius + hub radius) from C and (flank radius + boss radius) from D

each tangency point lies on the straight line joining the two centres involved

the flank named is the one above the line of centres, not its mirror image


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 14.9 mm across, the boss is 11.5 mm across, and their centres are 34.8 mm apart. The flank is an arc of radius 19.3 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

Oracle formalization for cad_t3_cad_flank_arc_0054. 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(50)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 34.8, description="hub and boss centres are 34.8 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 14.9, description="the hub is 14.9 across")
scene.constraint.eq(2 * boss.radius, 11.5, description="the boss is 11.5 across")
scene.constraint.eq(flank.radius, 19.3, description="the flank arc has radius 19.3")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 20.8 mm across, the boss is 10.4 mm across, and their centres are 36.6 mm apart. The flank is an arc of radius 37.1 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

Oracle formalization for cad_t3_cad_flank_arc_0055. 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(58)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 36.6, description="hub and boss centres are 36.6 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 20.8, description="the hub is 20.8 across")
scene.constraint.eq(2 * boss.radius, 10.4, description="the boss is 10.4 across")
scene.constraint.eq(flank.radius, 37.1, description="the flank arc has radius 37.1")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 21 mm across, the boss is 12 mm across, and their centres are 30.9 mm apart. The flank is an arc of radius 23.3 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

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

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

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

scene = GeoScene(45)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 30.9, description="hub and boss centres are 30.9 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 21, description="the hub is 21 across")
scene.constraint.eq(2 * boss.radius, 12, description="the boss is 12 across")
scene.constraint.eq(flank.radius, 23.3, description="the flank arc has radius 23.3")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 15.6 mm across, the boss is 11 mm across, and their centres are 30.6 mm apart. The flank is an arc of radius 32.5 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

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

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 30.6, description="hub and boss centres are 30.6 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 15.6, description="the hub is 15.6 across")
scene.constraint.eq(2 * boss.radius, 11, description="the boss is 11 across")
scene.constraint.eq(flank.radius, 32.5, description="the flank arc has radius 32.5")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 16.4 mm across, the boss is 9.3 mm across, and their centres are 29.4 mm apart. The flank is an arc of radius 21.9 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

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

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

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

scene = GeoScene(43)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 29.4, description="hub and boss centres are 29.4 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 16.4, description="the hub is 16.4 across")
scene.constraint.eq(2 * boss.radius, 9.3, description="the boss is 9.3 across")
scene.constraint.eq(flank.radius, 21.9, description="the flank arc has radius 21.9")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 15.7 mm across, the boss is 9.2 mm across, and their centres are 24.8 mm apart. The flank is an arc of radius 21.3 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

Oracle formalization for cad_t3_cad_flank_arc_0059. 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(37)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 24.8, description="hub and boss centres are 24.8 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 15.7, description="the hub is 15.7 across")
scene.constraint.eq(2 * boss.radius, 9.2, description="the boss is 9.2 across")
scene.constraint.eq(flank.radius, 21.3, description="the flank arc has radius 21.3")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A lever is shaped from two circles joined by a curved flank. Set up coordinates with the hub centre at the origin C and the boss centre at D on the positive x-axis. The hub is 16.7 mm across, the boss is 11.1 mm across, and their centres are 28.3 mm apart. The flank is an arc of radius 23.3 mm centred at F. It touches the hub at T and the boss at V, and it bulges away from the line of centres, wrapping around neither circle - each of T and V lies between its own circle's centre and F. The flank shown is the one on the upper side of the line of centres.

"""Lever flank arc tangent to hub and boss

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

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

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

scene = GeoScene(42)

C, D, F, T, V = scene.add.points(["C", "D", "F", "T", "V"])

scene.constraint.eq(C.x, 0, description="datum: C is the origin, the hub centre (x)")
scene.constraint.eq(C.y, 0, description="datum: C is the origin, the hub centre (y)")
scene.constraint.eq(D.y, 0, description="datum: the line of centres CD runs along the x-axis")
scene.constraint.gt(D.x, 1.0, description="datum: the boss lies in the +x direction from the hub")
scene.constraint.eq(C.distance(D), 28.3, description="hub and boss centres are 28.3 apart")
hub = scene.add.circle(C)
boss = scene.add.circle(D)
flank = scene.add.circle(F)
scene.constraint.eq(2 * hub.radius, 16.7, description="the hub is 16.7 across")
scene.constraint.eq(2 * boss.radius, 11.1, description="the boss is 11.1 across")
scene.constraint.eq(flank.radius, 23.3, description="the flank arc has radius 23.3")
scene.relate.point_lies_on(T, hub)
scene.relate.point_lies_on(T, flank)
scene.relate.point_lies_on(T, scene.add.line_segment(C, F))
scene.relate.point_lies_on(V, boss)
scene.relate.point_lies_on(V, flank)
scene.relate.point_lies_on(V, scene.add.line_segment(D, F))
scene.constraint.gt(cross(C, D, F), 0.05, description="the flank shown is the one on the upper side of the line of centres")


A curved sheet-metal panel is set out from a chord and a bulge. Set up coordinates with the left-hand end of the chord at the origin A, the chord running from A along the positive x-direction to B. The chord from A to B measures 29 mm. Measured at the middle of the chord, the arc bulges 5.3 mm clear of it, reaching its crown at M. The arc is a true circular arc through A, M and B, centred at O, and it bulges upward - away from the side its centre is on. Work out where the centre is and how big the radius has to be.

"""Arc set out from chord and bulge

Oracle formalization for cadh_t4_cadh_arc_sagitta_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(43)

A, B, M, O = scene.add.points(["A", "B", "M", "O"])

scene.constraint.eq(A.x, 0, description="datum: A is the origin, the left-hand end of the chord (x)")
scene.constraint.eq(A.y, 0, description="datum: A is the origin, the left-hand end of the chord (y)")
scene.constraint.eq(B.y, 0, description="datum: the chord AB runs along the x-axis")
scene.constraint.gt(B.x, 1.0, description="datum: B is to the right of A")
scene.constraint.eq(A.distance(B), 29, description="the chord from A to B measures 29")
scene.constraint.eq(2 * M.x, A.x + B.x, description="the crown M is measured at the middle of the chord")
scene.constraint.eq(M.y - A.y, 5.3, description="the arc bulges 5.3 clear of the chord at the crown")
arc = scene.add.circle(O)
scene.relate.point_lies_on(A, arc)
scene.relate.point_lies_on(B, arc)
scene.relate.point_lies_on(M, arc)
scene.constraint.lt(O.y, -0.05, description="the arc bulges upward, so its centre lies below the chord")

the radius is NOT given - it follows from the chord and the bulge

the crown lies at the middle of the chord, directly out from it

A, M and B all lie on one circle, which pins the centre on the perpendicular bisector of the chord

the radius works out as (chord squared over four, plus bulge squared) divided by twice the bulge

the arc bulges upward, so the centre is on the far side of the chord from the crown


A curved sheet-metal panel is set out from a chord and a bulge. Set up coordinates with the left-hand end of the chord at the origin A, the chord running from A along the positive x-direction to B. The chord from A to B measures 26.3 mm. Measured at the middle of the chord, the arc bulges 5.6 mm clear of it, reaching its crown at M. The arc is a true circular arc through A, M and B, centred at O, and it bulges upward - away from the side its centre is on. Work out where the centre is and how big the radius has to be.

"""Arc set out from chord and bulge

Oracle formalization for cadh_t4_cadh_arc_sagitta_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(39)

A, B, M, O = scene.add.points(["A", "B", "M", "O"])

scene.constraint.eq(A.x, 0, description="datum: A is the origin, the left-hand end of the chord (x)")
scene.constraint.eq(A.y, 0, description="datum: A is the origin, the left-hand end of the chord (y)")
scene.constraint.eq(B.y, 0, description="datum: the chord AB runs along the x-axis")
scene.constraint.gt(B.x, 1.0, description="datum: B is to the right of A")
scene.constraint.eq(A.distance(B), 26.3, description="the chord from A to B measures 26.3")
scene.constraint.eq(2 * M.x, A.x + B.x, description="the crown M is measured at the middle of the chord")
scene.constraint.eq(M.y - A.y, 5.6, description="the arc bulges 5.6 clear of the chord at the crown")
arc = scene.add.circle(O)
scene.relate.point_lies_on(A, arc)
scene.relate.point_lies_on(B, arc)
scene.relate.point_lies_on(M, arc)
scene.constraint.lt(O.y, -0.05, description="the arc bulges upward, so its centre lies below the chord")


A curved sheet-metal panel is set out from a chord and a bulge. Set up coordinates with the left-hand end of the chord at the origin A, the chord running from A along the positive x-direction to B. The chord from A to B measures 28.4 mm. Measured at the middle of the chord, the arc bulges 5.3 mm clear of it, reaching its crown at M. The arc is a true circular arc through A, M and B, centred at O, and it bulges upward - away from the side its centre is on. Work out where the centre is and how big the radius has to be.

"""Arc set out from chord and bulge

Oracle formalization for cadh_t4_cadh_arc_sagitta_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(42)

A, B, M, O = scene.add.points(["A", "B", "M", "O"])

scene.constraint.eq(A.x, 0, description="datum: A is the origin, the left-hand end of the chord (x)")
scene.constraint.eq(A.y, 0, description="datum: A is the origin, the left-hand end of the chord (y)")
scene.constraint.eq(B.y, 0, description="datum: the chord AB runs along the x-axis")
scene.constraint.gt(B.x, 1.0, description="datum: B is to the right of A")
scene.constraint.eq(A.distance(B), 28.4, description="the chord from A to B measures 28.4")
scene.constraint.eq(2 * M.x, A.x + B.x, description="the crown M is measured at the middle of the chord")
scene.constraint.eq(M.y - A.y, 5.3, description="the arc bulges 5.3 clear of the chord at the crown")
arc = scene.add.circle(O)
scene.relate.point_lies_on(A, arc)
scene.relate.point_lies_on(B, arc)
scene.relate.point_lies_on(M, arc)
scene.constraint.lt(O.y, -0.05, description="the arc bulges upward, so its centre lies below the chord")


A curved sheet-metal panel is set out from a chord and a bulge. Set up coordinates with the left-hand end of the chord at the origin A, the chord running from A along the positive x-direction to B. The chord from A to B measures 25.4 mm. Measured at the middle of the chord, the arc bulges 9.1 mm clear of it, reaching its crown at M. The arc is a true circular arc through A, M and B, centred at O, and it bulges upward - away from the side its centre is on. Work out where the centre is and how big the radius has to be.

"""Arc set out from chord and bulge

Oracle formalization for cadh_t4_cadh_arc_sagitta_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(38)

A, B, M, O = scene.add.points(["A", "B", "M", "O"])

scene.constraint.eq(A.x, 0, description="datum: A is the origin, the left-hand end of the chord (x)")
scene.constraint.eq(A.y, 0, description="datum: A is the origin, the left-hand end of the chord (y)")
scene.constraint.eq(B.y, 0, description="datum: the chord AB runs along the x-axis")
scene.constraint.gt(B.x, 1.0, description="datum: B is to the right of A")
scene.constraint.eq(A.distance(B), 25.4, description="the chord from A to B measures 25.4")
scene.constraint.eq(2 * M.x, A.x + B.x, description="the crown M is measured at the middle of the chord")
scene.constraint.eq(M.y - A.y, 9.1, description="the arc bulges 9.1 clear of the chord at the crown")
arc = scene.add.circle(O)
scene.relate.point_lies_on(A, arc)
scene.relate.point_lies_on(B, arc)
scene.relate.point_lies_on(M, arc)
scene.constraint.lt(O.y, -0.05, description="the arc bulges upward, so its centre lies below the chord")


A curved sheet-metal panel is set out from a chord and a bulge. Set up coordinates with the left-hand end of the chord at the origin A, the chord running from A along the positive x-direction to B. The chord from A to B measures 28.2 mm. Measured at the middle of the chord, the arc bulges 5.2 mm clear of it, reaching its crown at M. The arc is a true circular arc through A, M and B, centred at O, and it bulges upward - away from the side its centre is on. Work out where the centre is and how big the radius has to be.

"""Arc set out from chord and bulge

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

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

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

scene = GeoScene(42)

A, B, M, O = scene.add.points(["A", "B", "M", "O"])

scene.constraint.eq(A.x, 0, description="datum: A is the origin, the left-hand end of the chord (x)")
scene.constraint.eq(A.y, 0, description="datum: A is the origin, the left-hand end of the chord (y)")
scene.constraint.eq(B.y, 0, description="datum: the chord AB runs along the x-axis")
scene.constraint.gt(B.x, 1.0, description="datum: B is to the right of A")
scene.constraint.eq(A.distance(B), 28.2, description="the chord from A to B measures 28.2")
scene.constraint.eq(2 * M.x, A.x + B.x, description="the crown M is measured at the middle of the chord")
scene.constraint.eq(M.y - A.y, 5.2, description="the arc bulges 5.2 clear of the chord at the crown")
arc = scene.add.circle(O)
scene.relate.point_lies_on(A, arc)
scene.relate.point_lies_on(B, arc)
scene.relate.point_lies_on(M, arc)
scene.constraint.lt(O.y, -0.05, description="the arc bulges upward, so its centre lies below the chord")


A rectangular plate measures 37.3 mm by 25.5 mm. Set up coordinates with the bottom-left corner at the origin P, the 37.3 mm edge running from P along the positive x-direction to Q, and the 25.5 mm edge running from P along the positive y-direction to S; R is the far corner, diagonally opposite P. The corner at R is chamfered off by a straight cut taking 12.8 mm off along each of the two edges meeting there: the cut runs from G1 on edge QR to G2 on edge SR, both lying on the plate between the corners named. A hole 6.3 mm across is to be drilled with its centre N on the line 14.6 mm up from edge PQ. The hole is pushed as far towards the chamfered corner as it will go, stopping at the point where exactly 2.5 mm of material is left between the hole and the chamfer face.

"""Hole pushed up to its exact clearance limit

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

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

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

scene = GeoScene(53)

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

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.3, description="plate is 37.3 long along PQ")
scene.constraint.eq(P.distance(S), 25.5, description="plate is 25.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.relate.point_lies_on(G1, scene.add.line_segment(Q, R))
scene.relate.point_lies_on(G2, scene.add.line_segment(S, R))
scene.constraint.eq(G1.distance(R), 12.8, description="the chamfer takes 12.8 off along edge QR")
scene.constraint.eq(G2.distance(R), 12.8, description="the chamfer takes 12.8 off along edge SR")
scene.constraint.eq(N.y, 14.6, description="the hole centre sits on the line 14.6 up from edge PQ")
scene.constraint.eq(cross(G1, G2, N) / G1.distance(G2), 5.65, description="the hole is pushed towards the chamfer until exactly 2.5 of material is left between the hole and the chamfer face")

the hole radius is half the stated across-size

'exactly X of material left' is an EQUATION, not a limit to stay under - the clearance is used up completely

the material left is measured from the hole EDGE, so the centre is (clearance + radius) from the chamfer face

that distance is the perpendicular distance from N to the line through G1 and G2

G1 and G2 lie on the plate between the named corners, not on the extensions of those edges


A rectangular plate measures 34.9 mm by 28.2 mm. Set up coordinates with the bottom-left corner at the origin P, the 34.9 mm edge running from P along the positive x-direction to Q, and the 28.2 mm edge running from P along the positive y-direction to S; R is the far corner, diagonally opposite P. The corner at R is chamfered off by a straight cut taking 13.8 mm off along each of the two edges meeting there: the cut runs from G1 on edge QR to G2 on edge SR, both lying on the plate between the corners named. A hole 7 mm across is to be drilled with its centre N on the line 14.9 mm up from edge PQ. The hole is pushed as far towards the chamfered corner as it will go, stopping at the point where exactly 2.1 mm of material is left between the hole and the chamfer face.

"""Hole pushed up to its exact clearance limit

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

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

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

scene = GeoScene(50)

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

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), 34.9, description="plate is 34.9 long along PQ")
scene.constraint.eq(P.distance(S), 28.2, description="plate is 28.2 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.relate.point_lies_on(G1, scene.add.line_segment(Q, R))
scene.relate.point_lies_on(G2, scene.add.line_segment(S, R))
scene.constraint.eq(G1.distance(R), 13.8, description="the chamfer takes 13.8 off along edge QR")
scene.constraint.eq(G2.distance(R), 13.8, description="the chamfer takes 13.8 off along edge SR")
scene.constraint.eq(N.y, 14.9, description="the hole centre sits on the line 14.9 up from edge PQ")
scene.constraint.eq(cross(G1, G2, N) / G1.distance(G2), 5.6, description="the hole is pushed towards the chamfer until exactly 2.1 of material is left between the hole and the chamfer face")


A rectangular plate measures 44.8 mm by 25.1 mm. Set up coordinates with the bottom-left corner at the origin P, the 44.8 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 far corner, diagonally opposite P. The corner at R is chamfered off by a straight cut taking 14.4 mm off along each of the two edges meeting there: the cut runs from G1 on edge QR to G2 on edge SR, both lying on the plate between the corners named. A hole 7.3 mm across is to be drilled with its centre N on the line 15 mm up from edge PQ. The hole is pushed as far towards the chamfered corner as it will go, stopping at the point where exactly 2.1 mm of material is left between the hole and the chamfer face.

"""Hole pushed up to its exact clearance limit

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

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

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

scene = GeoScene(63)

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

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.8, description="plate is 44.8 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.relate.point_lies_on(G1, scene.add.line_segment(Q, R))
scene.relate.point_lies_on(G2, scene.add.line_segment(S, R))
scene.constraint.eq(G1.distance(R), 14.4, description="the chamfer takes 14.4 off along edge QR")
scene.constraint.eq(G2.distance(R), 14.4, description="the chamfer takes 14.4 off along edge SR")
scene.constraint.eq(N.y, 15, description="the hole centre sits on the line 15 up from edge PQ")
scene.constraint.eq(cross(G1, G2, N) / G1.distance(G2), 5.75, description="the hole is pushed towards the chamfer until exactly 2.1 of material is left between the hole and the chamfer face")


A rectangular plate measures 40.2 mm by 24.4 mm. Set up coordinates with the bottom-left corner at the origin P, the 40.2 mm edge running from P along the positive x-direction to Q, and the 24.4 mm edge running from P along the positive y-direction to S; R is the far corner, diagonally opposite P. The corner at R is chamfered off by a straight cut taking 14.5 mm off along each of the two edges meeting there: the cut runs from G1 on edge QR to G2 on edge SR, both lying on the plate between the corners named. A hole 5.9 mm across is to be drilled with its centre N on the line 14.6 mm up from edge PQ. The hole is pushed as far towards the chamfered corner as it will go, stopping at the point where exactly 3.4 mm of material is left between the hole and the chamfer face.

"""Hole pushed up to its exact clearance limit

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

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

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

scene = GeoScene(57)

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

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), 40.2, description="plate is 40.2 long along PQ")
scene.constraint.eq(P.distance(S), 24.4, description="plate is 24.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.relate.point_lies_on(G1, scene.add.line_segment(Q, R))
scene.relate.point_lies_on(G2, scene.add.line_segment(S, R))
scene.constraint.eq(G1.distance(R), 14.5, description="the chamfer takes 14.5 off along edge QR")
scene.constraint.eq(G2.distance(R), 14.5, description="the chamfer takes 14.5 off along edge SR")
scene.constraint.eq(N.y, 14.6, description="the hole centre sits on the line 14.6 up from edge PQ")
scene.constraint.eq(cross(G1, G2, N) / G1.distance(G2), 6.35, description="the hole is pushed towards the chamfer until exactly 3.4 of material is left between the hole and the chamfer face")


A rectangular plate measures 36 mm by 27.1 mm. Set up coordinates with the bottom-left corner at the origin P, the 36 mm edge running from P along the positive x-direction to Q, and the 27.1 mm edge running from P along the positive y-direction to S; R is the far corner, diagonally opposite P. The corner at R is chamfered off by a straight cut taking 14.7 mm off along each of the two edges meeting there: the cut runs from G1 on edge QR to G2 on edge SR, both lying on the plate between the corners named. A hole 6.3 mm across is to be drilled with its centre N on the line 12 mm up from edge PQ. The hole is pushed as far towards the chamfered corner as it will go, stopping at the point where exactly 3.5 mm of material is left between the hole and the chamfer face.

"""Hole pushed up to its exact clearance limit

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

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

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

scene = GeoScene(52)

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

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, description="plate is 36 long along PQ")
scene.constraint.eq(P.distance(S), 27.1, description="plate is 27.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.relate.point_lies_on(G1, scene.add.line_segment(Q, R))
scene.relate.point_lies_on(G2, scene.add.line_segment(S, R))
scene.constraint.eq(G1.distance(R), 14.7, description="the chamfer takes 14.7 off along edge QR")
scene.constraint.eq(G2.distance(R), 14.7, description="the chamfer takes 14.7 off along edge SR")
scene.constraint.eq(N.y, 12, description="the hole centre sits on the line 12 up from edge PQ")
scene.constraint.eq(cross(G1, G2, N) / G1.distance(G2), 6.65, description="the hole is pushed towards the chamfer until exactly 3.5 of material is left between the hole and the chamfer face")


A round bar is dropped into a vee block and a flat cover plate is then clamped down across the top of the vee, trapping the bar so that it touches all three faces at once. 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.3 mm long and the included angle of the vee, measured at the apex between the two faces, is 55 degrees. The cover plate lies along the straight line from A to B. The bar's centre is F; it touches the right-hand face at T, the left-hand face at U, and the underside of the cover at W. The bar is the one that fits inside the vee, between the apex and the cover. Work out how big the bar has to be.

"""Bar trapped in a vee under a cover plate

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

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: A is the right-hand face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 22.3, description="each vee face is 22.3 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 55, description="the included angle of the vee is 55 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
cover = scene.add.line_segment(A, B)
bar = scene.add.circle(F)
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.relate.tangent_to_circle(cover, bar, W)
scene.constraint.gt(F.y, 0.05, description="the bar sits inside the vee, above the apex")

the bar size is NOT given - it is fixed by having to touch all three faces at once

touching all three sides of the triangle ZAB makes the bar the inscribed circle of that triangle

so its radius is the triangle's area divided by its semi-perimeter

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

the bar is the one inside the vee, not the larger circle that touches the same three lines from beyond the cover


A round bar is dropped into a vee block and a flat cover plate is then clamped down across the top of the vee, trapping the bar so that it touches all three faces at once. 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.4 mm long and the included angle of the vee, measured at the apex between the two faces, is 70 degrees. The cover plate lies along the straight line from A to B. The bar's centre is F; it touches the right-hand face at T, the left-hand face at U, and the underside of the cover at W. The bar is the one that fits inside the vee, between the apex and the cover. Work out how big the bar has to be.

"""Bar trapped in a vee under a cover plate

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

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: A is the right-hand face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 24.4, description="each vee face is 24.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)
cover = scene.add.line_segment(A, B)
bar = scene.add.circle(F)
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.relate.tangent_to_circle(cover, bar, W)
scene.constraint.gt(F.y, 0.05, description="the bar sits inside the vee, above the apex")


A round bar is dropped into a vee block and a flat cover plate is then clamped down across the top of the vee, trapping the bar so that it touches all three faces at once. 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 mm long and the included angle of the vee, measured at the apex between the two faces, is 90 degrees. The cover plate lies along the straight line from A to B. The bar's centre is F; it touches the right-hand face at T, the left-hand face at U, and the underside of the cover at W. The bar is the one that fits inside the vee, between the apex and the cover. Work out how big the bar has to be.

"""Bar trapped in a vee under a cover plate

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

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: A is the right-hand face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 25, description="each vee face is 25 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)
cover = scene.add.line_segment(A, B)
bar = scene.add.circle(F)
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.relate.tangent_to_circle(cover, bar, W)
scene.constraint.gt(F.y, 0.05, description="the bar sits inside the vee, above the apex")


A round bar is dropped into a vee block and a flat cover plate is then clamped down across the top of the vee, trapping the bar so that it touches all three faces at once. 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 60 degrees. The cover plate lies along the straight line from A to B. The bar's centre is F; it touches the right-hand face at T, the left-hand face at U, and the underside of the cover at W. The bar is the one that fits inside the vee, between the apex and the cover. Work out how big the bar has to be.

"""Bar trapped in a vee under a cover plate

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

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: A is the right-hand face end, B 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, 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)
cover = scene.add.line_segment(A, B)
bar = scene.add.circle(F)
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.relate.tangent_to_circle(cover, bar, W)
scene.constraint.gt(F.y, 0.05, description="the bar sits inside the vee, above the apex")


A round bar is dropped into a vee block and a flat cover plate is then clamped down across the top of the vee, trapping the bar so that it touches all three faces at once. 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.8 mm long and the included angle of the vee, measured at the apex between the two faces, is 55 degrees. The cover plate lies along the straight line from A to B. The bar's centre is F; it touches the right-hand face at T, the left-hand face at U, and the underside of the cover at W. The bar is the one that fits inside the vee, between the apex and the cover. Work out how big the bar has to be.

"""Bar trapped in a vee under a cover plate

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

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: A is the right-hand face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 22.8, description="each vee face is 22.8 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 55, description="the included angle of the vee is 55 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
cover = scene.add.line_segment(A, B)
bar = scene.add.circle(F)
scene.relate.tangent_to_circle(face_r, bar, T)
scene.relate.tangent_to_circle(face_l, bar, U)
scene.relate.tangent_to_circle(cover, bar, W)
scene.constraint.gt(F.y, 0.05, description="the bar sits inside the vee, above the apex")


A stiffening rib is folded to a vee and then machined to a constant wall thickness, so the inner profile runs parallel to the outer one all the way round. Set up coordinates with the outside corner of the rib at the origin Z, opening upward and symmetric about the positive y-direction; the right-hand outer face runs from Z to A and the left-hand outer face from Z to B. Each outer face is 35.9 mm long and the two meet at 110 degrees. The wall is 7 mm thick, measured square to each face. K is the point where the two inner faces meet; Ta is the point on the right-hand outer face nearest to K, and Tb the point on the left-hand outer face nearest to K. Work out how far K sits from the outside corner.

"""Inner corner of a constant-thickness offset at a non-right angle

Oracle formalization for cadh_t4_cadh_offset_corner_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(43)

Z, A, B, K, Ta, Tb = scene.add.points(["Z", "A", "B", "K", "Ta", "Tb"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the outside corner of the rib (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the outside corner of the rib (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the rib is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the rib is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: A is the right-hand outer face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 35.9, description="each outer face is 35.9 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 110, description="the two outer faces meet at 110 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
scene.relate.point_lies_on(Ta, face_r)
scene.relate.point_lies_on(Tb, face_l)
scene.relate.perpendicular(scene.add.line_segment(K, Ta), face_r)
scene.relate.perpendicular(scene.add.line_segment(K, Tb), face_l)
scene.constraint.eq(K.distance(Ta), 7, description="the rib is 7 thick, measured square to the right-hand face")
scene.constraint.eq(K.distance(Tb), 7, description="the rib is 7 thick, measured square to the left-hand face")
scene.constraint.gt(K.y, 0.05, description="the inner corner K lies inside the rib, on the same side as the material")

the inner corner is NOT the wall thickness from the outer corner - that only holds at a right angle

the nearest point on a face is the foot of the perpendicular, so K is the stated thickness square to BOTH faces

being the same distance from both faces puts K on the bisector of the corner

the distance from the outer corner along the bisector is the thickness divided by the sine of HALF the included angle

K lies inside the rib on the material side, not on the mirror-image side of the apex


A stiffening rib is folded to a vee and then machined to a constant wall thickness, so the inner profile runs parallel to the outer one all the way round. Set up coordinates with the outside corner of the rib at the origin Z, opening upward and symmetric about the positive y-direction; the right-hand outer face runs from Z to A and the left-hand outer face from Z to B. Each outer face is 27.5 mm long and the two meet at 60 degrees. The wall is 3.8 mm thick, measured square to each face. K is the point where the two inner faces meet; Ta is the point on the right-hand outer face nearest to K, and Tb the point on the left-hand outer face nearest to K. Work out how far K sits from the outside corner.

"""Inner corner of a constant-thickness offset at a non-right angle

Oracle formalization for cadh_t4_cadh_offset_corner_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(36)

Z, A, B, K, Ta, Tb = scene.add.points(["Z", "A", "B", "K", "Ta", "Tb"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the outside corner of the rib (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the outside corner of the rib (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the rib is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the rib is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: A is the right-hand outer face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 27.5, description="each outer face is 27.5 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 60, description="the two outer faces meet at 60 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
scene.relate.point_lies_on(Ta, face_r)
scene.relate.point_lies_on(Tb, face_l)
scene.relate.perpendicular(scene.add.line_segment(K, Ta), face_r)
scene.relate.perpendicular(scene.add.line_segment(K, Tb), face_l)
scene.constraint.eq(K.distance(Ta), 3.8, description="the rib is 3.8 thick, measured square to the right-hand face")
scene.constraint.eq(K.distance(Tb), 3.8, description="the rib is 3.8 thick, measured square to the left-hand face")
scene.constraint.gt(K.y, 0.05, description="the inner corner K lies inside the rib, on the same side as the material")


A stiffening rib is folded to a vee and then machined to a constant wall thickness, so the inner profile runs parallel to the outer one all the way round. Set up coordinates with the outside corner of the rib at the origin Z, opening upward and symmetric about the positive y-direction; the right-hand outer face runs from Z to A and the left-hand outer face from Z to B. Each outer face is 34.6 mm long and the two meet at 50 degrees. The wall is 3.7 mm thick, measured square to each face. K is the point where the two inner faces meet; Ta is the point on the right-hand outer face nearest to K, and Tb the point on the left-hand outer face nearest to K. Work out how far K sits from the outside corner.

"""Inner corner of a constant-thickness offset at a non-right angle

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

Z, A, B, K, Ta, Tb = scene.add.points(["Z", "A", "B", "K", "Ta", "Tb"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the outside corner of the rib (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the outside corner of the rib (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the rib is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the rib is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: A is the right-hand outer face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 34.6, description="each outer face is 34.6 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 50, description="the two outer faces meet at 50 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
scene.relate.point_lies_on(Ta, face_r)
scene.relate.point_lies_on(Tb, face_l)
scene.relate.perpendicular(scene.add.line_segment(K, Ta), face_r)
scene.relate.perpendicular(scene.add.line_segment(K, Tb), face_l)
scene.constraint.eq(K.distance(Ta), 3.7, description="the rib is 3.7 thick, measured square to the right-hand face")
scene.constraint.eq(K.distance(Tb), 3.7, description="the rib is 3.7 thick, measured square to the left-hand face")
scene.constraint.gt(K.y, 0.05, description="the inner corner K lies inside the rib, on the same side as the material")


A stiffening rib is folded to a vee and then machined to a constant wall thickness, so the inner profile runs parallel to the outer one all the way round. Set up coordinates with the outside corner of the rib at the origin Z, opening upward and symmetric about the positive y-direction; the right-hand outer face runs from Z to A and the left-hand outer face from Z to B. Each outer face is 37.9 mm long and the two meet at 50 degrees. The wall is 3.3 mm thick, measured square to each face. K is the point where the two inner faces meet; Ta is the point on the right-hand outer face nearest to K, and Tb the point on the left-hand outer face nearest to K. Work out how far K sits from the outside corner.

"""Inner corner of a constant-thickness offset at a non-right angle

Oracle formalization for cadh_t4_cadh_offset_corner_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(50)

Z, A, B, K, Ta, Tb = scene.add.points(["Z", "A", "B", "K", "Ta", "Tb"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the outside corner of the rib (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the outside corner of the rib (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the rib is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the rib is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: A is the right-hand outer face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 37.9, description="each outer face is 37.9 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 50, description="the two outer faces meet at 50 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
scene.relate.point_lies_on(Ta, face_r)
scene.relate.point_lies_on(Tb, face_l)
scene.relate.perpendicular(scene.add.line_segment(K, Ta), face_r)
scene.relate.perpendicular(scene.add.line_segment(K, Tb), face_l)
scene.constraint.eq(K.distance(Ta), 3.3, description="the rib is 3.3 thick, measured square to the right-hand face")
scene.constraint.eq(K.distance(Tb), 3.3, description="the rib is 3.3 thick, measured square to the left-hand face")
scene.constraint.gt(K.y, 0.05, description="the inner corner K lies inside the rib, on the same side as the material")


A stiffening rib is folded to a vee and then machined to a constant wall thickness, so the inner profile runs parallel to the outer one all the way round. Set up coordinates with the outside corner of the rib at the origin Z, opening upward and symmetric about the positive y-direction; the right-hand outer face runs from Z to A and the left-hand outer face from Z to B. Each outer face is 34.7 mm long and the two meet at 70 degrees. The wall is 5.7 mm thick, measured square to each face. K is the point where the two inner faces meet; Ta is the point on the right-hand outer face nearest to K, and Tb the point on the left-hand outer face nearest to K. Work out how far K sits from the outside corner.

"""Inner corner of a constant-thickness offset at a non-right angle

Oracle formalization for cadh_t4_cadh_offset_corner_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(42)

Z, A, B, K, Ta, Tb = scene.add.points(["Z", "A", "B", "K", "Ta", "Tb"])

scene.constraint.eq(Z.x, 0, description="datum: Z is the origin, the outside corner of the rib (x)")
scene.constraint.eq(Z.y, 0, description="datum: Z is the origin, the outside corner of the rib (y)")
scene.constraint.eq(A.x + B.x, 0, description="datum: the rib is symmetric about the y-axis")
scene.constraint.eq(A.y, B.y, description="datum: the rib is symmetric about the y-axis")
scene.constraint.gt(A.x, 1.0, description="datum: A is the right-hand outer face end, B the left-hand one")
scene.constraint.eq(Z.distance(A), 34.7, description="each outer face is 34.7 long")
scene.constraint.eq(scene.add.angle(A, Z, B).value, 70, description="the two outer faces meet at 70 degrees")
face_r = scene.add.line_segment(Z, A)
face_l = scene.add.line_segment(Z, B)
scene.relate.point_lies_on(Ta, face_r)
scene.relate.point_lies_on(Tb, face_l)
scene.relate.perpendicular(scene.add.line_segment(K, Ta), face_r)
scene.relate.perpendicular(scene.add.line_segment(K, Tb), face_l)
scene.constraint.eq(K.distance(Ta), 5.7, description="the rib is 5.7 thick, measured square to the right-hand face")
scene.constraint.eq(K.distance(Tb), 5.7, description="the rib is 5.7 thick, measured square to the left-hand face")
scene.constraint.gt(K.y, 0.05, description="the inner corner K lies inside the rib, on the same side as the material")


A step in a pressed panel is blended with an S-curve made of two arcs. Set up coordinates with the left-hand end of the lower face at the origin P; the lower face runs from P along the positive x-direction to Q and is 37.1 mm long. The upper face runs parallel to it 18.4 mm above, from S (directly above P) to R (directly above Q). The first arc, radius 9.5 mm and centred at C1, runs smoothly out of the lower face, leaving it at T1 which is 10.6 mm along from P. The second arc, radius 7.3 mm and centred at C2, runs smoothly into the upper face at T2. The two arcs meet each other at J, and the curve is smooth there too - there is no kink where one arc becomes the other. The S-curve runs left to right, climbing from the lower face to the upper one.

"""Ogee (S-curve) blend between two parallel faces

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

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

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

scene = GeoScene(53)

P, Q, S, R, C1, C2, T1, T2, J = scene.add.points(["P", "Q", "S", "R", "C1", "C2", "T1", "T2", "J"])

scene.constraint.eq(P.x, 0, description="datum: P is the origin, the left-hand end of the lower face (x)")
scene.constraint.eq(P.y, 0, description="datum: P is the origin, the left-hand end of the lower face (y)")
scene.constraint.eq(Q.y, 0, description="datum: the lower face PQ runs along the x-axis")
scene.constraint.gt(Q.x, 1.0, description="datum: the part extends in the +x direction")
scene.constraint.eq(P.distance(Q), 37.1, description="the lower face is 37.1 long")
scene.constraint.eq(S.y - P.y, 18.4, description="the upper face is 18.4 above the lower one")
scene.constraint.eq(R.y - Q.y, 18.4, description="the upper face is parallel to the lower one")
scene.constraint.eq(S.x, P.x, description="the upper face starts directly above P")
scene.constraint.eq(R.x, Q.x, description="the upper face ends directly above Q")
lower = scene.add.line_segment(P, Q)
upper = scene.add.line_segment(S, R)
arc1 = scene.add.circle(C1)
arc2 = scene.add.circle(C2)
scene.constraint.eq(arc1.radius, 9.5, description="the first blend arc has radius 9.5")
scene.constraint.eq(arc2.radius, 7.3, description="the second blend arc has radius 7.3")
scene.relate.tangent_to_circle(lower, arc1, T1)
scene.relate.tangent_to_circle(upper, arc2, T2)
scene.relate.point_lies_on(J, arc1)
scene.relate.point_lies_on(J, arc2)
scene.relate.point_lies_on(J, scene.add.line_segment(C1, C2))
scene.constraint.eq(T1.x, 10.6, description="the S-curve leaves the lower face 10.6 along from P")
scene.constraint.gt(C1.y, 0.05, description="the first arc curves up away from the lower face")
scene.constraint.gt(T2.x - T1.x, 0.05, description="the S-curve runs left to right, from the lower face up to the upper one")

'runs smoothly out of' a straight face means the arc is tangent to it, so its centre sits one radius away, square to the face

'no kink where one arc becomes the other' means the two arcs are tangent to EACH OTHER at J

two arcs tangent to each other with the curve bending opposite ways have centre distance equal to the SUM of the radii, with J on the line joining the centres

that fixes how far along the second arc must sit - it is not a free choice

the first arc curves upward away from the lower face, and the curve runs left to right