











open Compatibility;;
open Types;;
open Default;;
open Exceptions;;
open Basic_types;;
open Font;;
open Fonts;;
open Colors;;
open Vrml_objects_pre;;
open Calc_3D;;
open Vrml_objects_post;;
open Positionables;;
open Geometrics;;
open Geometric_properties;;
open Map;;
open Complex_geometrics;;
open Map_complex;;
open Lights;;
open Map_light;;
open Sound;;


(* get_x1 : frame -> float *)
let get_x1 frame =
    match frame.width with
      x , _ -> x
;;

(* get_x2 : frame -> float *)
let get_x2 frame =
    match frame.width with
      _ , x -> x
;;

(* get_y1 : frame -> float *)
let get_y1 frame =
    match frame.height with
      y , _ -> y
;;

(* get_y2 : frame -> float *)
let get_y2 frame =
    match frame.height with
      _ , y -> y
;;

(* get_z1 : frame -> float *)
let get_z1 frame =
    match frame.depth with
      z , _ -> z
;;

(* get_z2 : frame -> float *)
let get_z2 frame =
    match frame.depth with
      _ , z -> z
;;


(* place_top : vrml_object -> vrml_object -> vrml_object *)
let place_top obj of_object =
    let y1 = abs_float (get_y1 (get_resize_frame obj))
    and y2 = get_y2 of_object.frame
    in
       translation obj 0.0 (y1 +. y2) 0.0
;;

(* place_bottom : vrml_object -> vrml_object -> vrml_object *)
let place_bottom obj of_object =
    let y1 = get_y1 of_object.frame
    and y2 = get_y2 (get_resize_frame obj)
    in
       translation obj 0.0 (y1 -. y2) 0.0
;;

(* place_right : vrml_object -> vrml_object -> vrml_object *)
let place_right obj of_object =
    let x1 = abs_float (get_x1 (get_resize_frame obj))
    and x2 = get_x2 of_object.frame
    in
       translation obj (x1 +. x2) 0.0 0.0
;;

(* place_left : vrml_object -> vrml_object -> vrml_object *)
let place_left obj of_object =
    let x1 = get_x1 of_object.frame
    and x2 = get_x2 (get_resize_frame obj)
    in
       translation obj (x1 -. x2) 0.0 0.0
;;

(* place_front : vrml_object -> vrml_object -> vrml_object *)
let place_front obj of_object =
    let z1 = abs_float (get_z1 (get_resize_frame obj))
    and z2 = get_z2 of_object.frame
    in
       translation obj 0.0 0.0 (z1 +. z2)
;;

(* place_behind : vrml_object -> vrml_object -> vrml_object *)
let place_behind obj of_object =
    let z1 = get_z1 of_object.frame
    and z2 = get_z2 (get_resize_frame obj)
    in
       translation obj 0.0 0.0 (z1 -. z2)
;;


(* stick_top : vrml_object -> vrml_object -> vrml_object *)
let stick_top obj of_object =
    add_child of_object (place_top obj of_object)
;;

(* stick_bottom : vrml_object -> vrml_object -> vrml_object *)
let stick_bottom obj of_object =
    add_child of_object (place_bottom obj of_object)
;;

(* stick_right : vrml_object -> vrml_object -> vrml_object *)
let stick_right obj of_object =
    add_child of_object (place_right obj of_object)
;;

(* stick_left : vrml_object -> vrml_object -> vrml_object *)
let stick_left obj of_object =
    add_child of_object (place_left obj of_object)
;;

(* stick_front : vrml_object -> vrml_object -> vrml_object *)
let stick_front obj of_object =
    add_child of_object (place_front obj of_object)
;;

(* stick_behind : vrml_object -> vrml_object -> vrml_object *)
let stick_behind obj of_object =
    add_child of_object (place_behind obj of_object)
;;
