File: path.ml

package info (click to toggle)
mlpost 0.9-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,844 kB
  • sloc: ml: 21,094; javascript: 4,047; makefile: 430; ansic: 34; lisp: 19; sh: 15
file content (52 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
open Mlpost
open Path
open Point
open Command
open Picture
module H = Helpers

let z0 = (0., 0.)

let z1 = (60., 40.)

let z2 = (40., 90.)

let z3 = (10., 70.)

let z4 = (30., 50.)

let l1 = [ z0; z1; z2; z3; z4 ]

let labels1 =
  H.dotlabels ~pos:Ptop [ "0"; "2"; "4" ] (map_bp [ z0; z2; z4 ])
  @ [
      dotlabel ~pos:Pleft (tex "3") (bpp z3);
      dotlabel ~pos:Pright (tex "1") (bpp z1);
    ]

let lcontrols =
  [
    ((26.8, -1.8), (51.4, 14.6));
    ((67.1, 61.), (59.8, 84.6));
    ((25.4, 94.), (10.5, 84.5));
    ((9.6, 58.8), (18.8, 49.6));
  ]

let lcontrolsbp = List.map (fun (a, b) -> JControls (bpp a, bpp b)) lcontrols

let draw5 =
  [
    draw (jointpath l1 lcontrolsbp);
    (let hull =
       List.fold_left2
         (fun acc (c1, c2) f -> f :: c2 :: c1 :: acc)
         [ (0., 0.) ] lcontrols (List.tl l1)
     in
     (* As long as we dont have the dashed lines : gray *)
     draw
       ~dashed:(Dash.scaled 0.5 Dash.evenly)
       (path ~style:JLine (List.rev hull)));
  ]
  @ labels1

let _ = Metapost.emit "path" draw5