Source file rendering3d.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
open Apronext
open Geometry
type t = {
elems3 : Drawable.t;
abciss3 : string;
ordinate3 : string;
height3 : string;
bounded3 : vertex3d list;
}
let create ~abciss ~ordinate ~height () = {
elems3 = [];
abciss3=abciss;
ordinate3=ordinate;
height3=height;
bounded3 = [];
}
let add r (d: Drawable.t) =
let x,y,z= r.abciss3, r.ordinate3, r.height3 in
let bounded3 =
List.fold_left (fun acc pol ->
let p3d = Apol.proj3D_s pol x y z in
if Apol.is_bounded p3d then
let pts =
Apol.to_generator_list p3d
|> List.rev_map (fun g -> Generatorext.to_vertices3D_s g x y z)
in
pts::acc
else acc
) r.bounded3 d
in
{r with elems3 = Drawable.union d r.elems3; bounded3}
let add_l = List.fold_left add