Catmull–Clark subdivision surface: Difference between revisions

Content added Content deleted
Line 458: Line 458:
let c p q r = let s i = if i = 0 then -1.0 else 1.0 in { x = s p; y = s q; z = s r } ;;
let c p q r = let s i = if i = 0 then -1.0 else 1.0 in { x = s p; y = s q; z = s r } ;;
let cube = [
let cube = [
(Face [c 0 0 0; c 0 0 1; c 0 1 1; c 0 1 0]); (Face [c 1 0 0; c 1 0 1; c 1 1 1; c 1 1 0]);
Face [c 0 0 0; c 0 0 1; c 0 1 1; c 0 1 0]; Face [c 1 0 0; c 1 0 1; c 1 1 1; c 1 1 0];
(Face [c 0 0 0; c 1 0 0; c 1 0 1; c 0 0 1]); (Face [c 0 1 0; c 1 1 0; c 1 1 1; c 0 1 1]);
Face [c 0 0 0; c 1 0 0; c 1 0 1; c 0 0 1]; Face [c 0 1 0; c 1 1 0; c 1 1 1; c 0 1 1];
(Face [c 0 0 0; c 0 1 0; c 1 1 0; c 1 0 0]); (Face [c 0 0 1; c 0 1 1; c 1 1 1; c 1 0 1]) ] in
Face [c 0 0 0; c 0 1 0; c 1 1 0; c 1 0 0]; Face [c 0 0 1; c 0 1 1; c 1 1 1; c 1 0 1] ] in
show_faces cube;
show_faces cube;
show_faces (catmull_clark cube)</lang>
show_faces (catmull_clark cube)</lang>