# caml2geom / test1.ml

 ``` 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 53 54 55``` ```open Caml2geom open Printf (*-----------------------------------------------------------------------*) let _ = printf "Coord.epsilon = %f\n" (Coord.epsilon) ;; let _ = printf "Coord.infinity () = %f\n" (Coord.infinity ()) ;; let _ = printf "Coord.are_near 4.00 4.09 = %B\n" (Coord.are_near 4.00 4.09) ;; let _ = printf "Coord.are_near_eps 0.1 4.00 4.09 = %B\n" (Coord.are_near_eps 0.1 4.00 4.09);; let _ = printf "Coord.rel_error_bound 4.00 4.09 = %B\n" (Coord.rel_error_bound 4.00 4.09) ;; let _ = printf "Coord.rel_error_bound_eps 0.1 4.00 4.09 = %B\n" (Coord.rel_error_bound_eps 0.1 4.00 4.09);; (*-----------------------------------------------------------------------*) let c = Coord.epsilon let p = Point.copy (Point.make 0. 0.) ;; Point.set_coord p 1 50. ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.set_coord p 0 10. ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.normalize p ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; let p = Point.ccw p ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; let p = Point.cw p ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; let p = Point.neg p ;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.add_to p (Point.make 100. 100.);; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.sub_from p (Point.make 100. 100.);; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.mul_by p 1000.;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; Point.div_by p 1000.;; let _ = printf "(%f,%f) %f\n" (Point.coord p 0) (Point.coord (Point.copy p) 1) (Point.length p);; let q = Point.make 0. 0.;; let _ = printf "(%f,%f) %f\n" (Point.coord q 0) (Point.coord q 1) (Point.length q);; Point.set q (Point.make (-50.) 50.);; let _ = printf "(%f,%f) %f\n" (Point.coord q 0) (Point.coord q 1) (Point.length q);; (*-----------------------------------------------------------------------*) let bez = Bezier.make_order3 0. 10. 15. 1. ;; let _ = printf "at0 -> %f\n" (Bezier.at0 bez) ;; let _ = printf "at1 -> %f\n" (Bezier.at1 bez) ;; let _ = printf "at 0.25 -> %f\n" (Bezier.value_at bez 0.25) ;; let _ = printf "at 1/3 -> %f\n" (Bezier.value_at bez (1./.3.)) ;; let _ = printf "at 0.5 -> %f\n" (Bezier.value_at bez 0.5) ;; let _ = printf "at 2/3 -> %f\n" (Bezier.value_at bez (2./.3.)) ;; let _ = printf "at 0.75 -> %f\n" (Bezier.value_at bez 0.75) ;; (*-----------------------------------------------------------------------*) ```