Small graphic fix
This commit is contained in:
parent
a2b9ff1da1
commit
59dc2d2b32
36
trees.ml
36
trees.ml
|
@ -465,7 +465,7 @@ let rec print_vertexes (l : node list) r width height = match l with
|
||||||
set_line_width 5;
|
set_line_width 5;
|
||||||
draw_circle xd yd r;
|
draw_circle xd yd r;
|
||||||
|
|
||||||
set_color (rgb 32 255 32);
|
set_color (rgb 32 192 32);
|
||||||
fill_circle xd yd r;
|
fill_circle xd yd r;
|
||||||
|
|
||||||
set_color black;
|
set_color black;
|
||||||
|
@ -510,7 +510,7 @@ let rec insert_abr tr e = match tr with
|
||||||
|
|
||||||
let successive_insert () =
|
let successive_insert () =
|
||||||
let cur_tree = ref (Empty) in
|
let cur_tree = ref (Empty) in
|
||||||
open_graph " 1400x1000" ;
|
open_graph " 1600x1000" ;
|
||||||
set_window_title "Trees" ;
|
set_window_title "Trees" ;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -521,11 +521,11 @@ let successive_insert () =
|
||||||
|
|
||||||
cur_tree := insert_abr !cur_tree elt;
|
cur_tree := insert_abr !cur_tree elt;
|
||||||
|
|
||||||
open_graph " 1200x1000" ;
|
open_graph " 1600x1000" ;
|
||||||
set_window_title "Trees" ;
|
set_window_title "Trees" ;
|
||||||
(*ignore (pretty_tree_printing_new_version !cur_tree 40 100 1200 1000 true)*)
|
(*ignore (pretty_tree_printing_new_version !cur_tree 40 100 1200 1000 true)*)
|
||||||
(*ignore (even_more_pretty_printing !cur_tree 20 100 false);*)
|
(*ignore (even_more_pretty_printing !cur_tree 20 100 false);*)
|
||||||
finalized_printing !cur_tree 30 1400 1000 current_increment;
|
finalized_printing !cur_tree 30 1600 1000 current_increment;
|
||||||
|
|
||||||
for i = 0 to 19 do
|
for i = 0 to 19 do
|
||||||
Printf.printf "| %d " current_increment.(i)
|
Printf.printf "| %d " current_increment.(i)
|
||||||
|
@ -678,7 +678,7 @@ let rec detect_collision2 (tr : int abr2) haschanged (side : int ref) =
|
||||||
|
|
||||||
|
|
||||||
let decode2 (p : pt) r width height =
|
let decode2 (p : pt) r width height =
|
||||||
(width/2 + p.x * r, height - r - (2*r)*p.y) ;;
|
(width/2 + p.x/2 * r, height - r - (3*r)*p.y) ;;
|
||||||
|
|
||||||
let raw_print (tr : int abr2) =
|
let raw_print (tr : int abr2) =
|
||||||
let rec aux t d = match t with
|
let rec aux t d = match t with
|
||||||
|
@ -744,7 +744,7 @@ let rec insert_abr2 (tr : int abr2) e =
|
||||||
|
|
||||||
let successive_insert_semiauto () =
|
let successive_insert_semiauto () =
|
||||||
let cur_tree = ref Empty in
|
let cur_tree = ref Empty in
|
||||||
open_graph " 1400x1000" ;
|
open_graph " 1600x1000" ;
|
||||||
set_window_title "Trees" ;
|
set_window_title "Trees" ;
|
||||||
|
|
||||||
let radius = 20 in
|
let radius = 20 in
|
||||||
|
@ -755,7 +755,10 @@ let successive_insert_semiauto () =
|
||||||
|
|
||||||
let elt_to_add = ref 500 in
|
let elt_to_add = ref 500 in
|
||||||
|
|
||||||
cur_tree := insert_abr2 !cur_tree !elt_to_add;
|
cur_tree := insert_abr2 !cur_tree 500;
|
||||||
|
cur_tree := insert_abr2 !cur_tree 250;
|
||||||
|
cur_tree := insert_abr2 !cur_tree 750;
|
||||||
|
|
||||||
try
|
try
|
||||||
while true do
|
while true do
|
||||||
for i = 0 to period-1 do
|
for i = 0 to period-1 do
|
||||||
|
@ -763,7 +766,7 @@ let successive_insert_semiauto () =
|
||||||
(*Stdlib.print_endline "Enter an integer :";
|
(*Stdlib.print_endline "Enter an integer :";
|
||||||
elt_to_add := Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity;*)
|
elt_to_add := Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity;*)
|
||||||
|
|
||||||
open_graph " 1200x1000" ;
|
open_graph " 1600x1000" ;
|
||||||
set_window_title "Trees" ;
|
set_window_title "Trees" ;
|
||||||
|
|
||||||
ct := 0;
|
ct := 0;
|
||||||
|
@ -778,23 +781,18 @@ let successive_insert_semiauto () =
|
||||||
Stdlib.print_endline "[]";*)
|
Stdlib.print_endline "[]";*)
|
||||||
incr ct;
|
incr ct;
|
||||||
|
|
||||||
open_graph " 1200x1000" ;
|
open_graph " 1600x1000" ;
|
||||||
set_window_title "Trees" ;
|
set_window_title "Trees" ;
|
||||||
|
|
||||||
print_tree2 !cur_tree radius 1400 1000 ;
|
print_tree2 !cur_tree radius 1600 1000 ;
|
||||||
|
|
||||||
if !changed then
|
|
||||||
Unix.sleepf 0.5;
|
|
||||||
done;
|
done;
|
||||||
|
|
||||||
print_tree2 !cur_tree radius 1400 1000 ;
|
print_tree2 !cur_tree radius 1600 1000 ;
|
||||||
Unix.sleepf 0.1;
|
Unix.sleepf 0.04;
|
||||||
done;
|
done;
|
||||||
|
|
||||||
Stdlib.print_endline "Enter an integer :";
|
Stdlib.print_endline "Enter an integer to add 10 more :";
|
||||||
elt_to_add := Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity;
|
ignore (Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity);
|
||||||
|
|
||||||
print_int 0;
|
|
||||||
|
|
||||||
(*raw_print !cur_tree ;*)
|
(*raw_print !cur_tree ;*)
|
||||||
done;
|
done;
|
||||||
|
|
Loading…
Reference in New Issue