Catmull–Clark subdivision surface: Difference between revisions
Content added Content deleted
Line 457: | Line 457: | ||
(print_string "surface {\n"; List.iter pr_face fl; print_string "}\n") |
(print_string "surface {\n"; List.iter pr_face fl; print_string "}\n") |
||
let |
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 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 = [ |
let cube = [ |
||
(Face [ |
(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 [ |
(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 [ |
(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> |
|||
with output: |
with output: |
||
<pre>surface { |
<pre>surface { |