Affine Transform Test: The file affine_test.ml tests the code generation for the affine translation transform. The affine transformation is defined by the module type AFFINE in the file src/affine.ml. The implementation in the same file is a functor that is parametric in the number type, the vector, tuple, and number types. The following instantiation is an example for creating an affien transformation module over the exact float number types, and the 2D vector (V2R), tuple (Record2D) and point (P2R) types: module AT2R = AffineTransformations (Float_Real_Exact) (V2R) (P2R) (Record2D) The interface for the affine transformation has the function: translation : 'a V.vector_s -> 'a t which creates a translation transform (whose type is 'a t) from given a vector specifying the coordinate displacement. Applying a transform to a basic object (point or a vector) is done by the following two functions: val apply_p : 'a t -> 'a P.point_s -> 'a P.point_s val apply_v : 'a t -> 'a V.vector_s -> 'a V.vector_s The affine_test.ml creates 2D and 3D translation transforms over exact floating point number types, with a recrod tuple type. The generator module 'Gen' can be used to generate code for the transforms over the concrete choices. The output file affine_out.ml contains two function, corresponding to the two calls for 2D translation: module AT2R = AffineTransformations (Float_Real_Exact) (V2R) (P2R) (Record2D) module G2R = Gen (AT2R) ;; G2R.translate () ;; (* Outputs (manually indented for readibility): - : ('a, AT2R.P.point -> AT2R.V.vector -> AT2R.P.point) code = .< fun p_1 -> fun v_2 -> { c0 = (p_1.c0 +. v_2.c0); c1 = (p_1.c1 +. v_2.c1) } >. *) and for 3D translation: module AT3R = AffineTransformations (Float_Real_Exact) (V3R) (P3R) (Record3D) module G3R = Gen (AT3R) ;; G3R.translate () ;; (* Outputs (manually indented for readibility): - : ('a, AT3R.P.point -> AT3R.V.vector -> AT3R.P.point) code = .< fun p_1 -> fun v_2 -> { x = (p_1.x +. v_2.x); y = (p_1.y +. v_2.y); z = (p_1.z +. v_2.z) } >. *)