Jump to content

Catmull–Clark subdivision surface: Difference between revisions

m
Line 457:
(print_string "surface {\n"; List.iter pr_face fl; print_string "}\n")
 
let c000c p q r = {let s i x=( if i = 0 then -1.0); y=(-else 1.0) in { x = s p; y = s q; z =(-1.0) s r } ;;
let c001 = { x=(-1.0); y=(-1.0); z= 1.0 }
let c010 = { x=(-1.0); y= 1.0 ; z=(-1.0) }
let c011 = { x=(-1.0); y= 1.0 ; z= 1.0 }
let c100 = { x= 1.0 ; y=(-1.0); z=(-1.0) }
let c101 = { x= 1.0 ; y=(-1.0); z= 1.0 }
let c110 = { x= 1.0 ; y= 1.0 ; z=(-1.0) }
let c111 = { x= 1.0 ; y= 1.0 ; z= 1.0 }
let cube = [
(Face [c000c 0 0 0;c001 c 0 0 1;c011 c 0 1 1;c010 c 0 1 0]); (Face [c100c 1 0 0;c101 c 1 0 1;c111 c 1 1 1;c110 c 1 1 0]);
(Face [c000c 0 0 0;c100 c 1 0 0;c101 c 1 0 1;c001 c 0 0 1]); (Face [c010c 0 1 0;c110 c 1 1 0;c111 c 1 1 1;c011 c 0 1 1]);
(Face [c000c 0 0 0;c010 c 0 1 0;c110 c 1 1 0;c100 c 1 0 0]); (Face [c001c 0 0 1;c011 c 0 1 1;c111 c 1 1 1;c101 c 1 0 1]) ];; in
show_faces cube;
 
show_faces (catmull_clark cube;;)</lang>
show_faces (catmull_clark cube);;</lang>
with output:
<pre>surface {
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.