MODULE Slider2; IMPORT Geometry; FUNC s = SliderVal(a, b, c) IS (E y :: b = (s, y) REL (a, c)) END; FUNC b = OnLine(a, c, t) IS b = (t, 0) REL (a, c) END; FUNC p = LinePt(k, l, m, a, b) IS (E t = SliderVal(k, l, m) :: p = OnLine(a, b, t)) END; (* "p" is the point at parametric location "t" on the Bezier curve "a", "b", "c", "d". *) FUNC p = OnCurve(a, b, c, d, t) IS (E ab , bc , cd , abc , bcd :: ab = OnLine(a, b, t) AND bc = OnLine(b, c, t) AND cd = OnLine(c, d, t) AND abc = OnLine(ab, bc, t) AND bcd = OnLine(bc, cd, t) AND p = OnLine(abc, bcd, t)) END; (* The points "k", "l", and "m" compose a slider, the points "a", "b", "c", and "d" are the control points of a Bezier curve, and "pt" is the point at parametric location "t" on the curve, where "t" is the slider value of "k", "l", and "m" (i.e., the ratio "Dist(k,l2)/Dist(k,m)", where "l2" is the projection of "l" onto the segment "km"). *) FUNC pt = CurvePt(k, l, m, a, b, c, d) IS (E t :: t = SliderVal(k, l, m) AND pt = OnCurve(a, b, c, d, t)) END;