Anonymous user
Catmull–Clark subdivision surface: Difference between revisions
Catmull–Clark subdivision surface (view source)
Revision as of 20:19, 7 November 2011
, 12 years ago→{{header|Tcl}}: Corrected point updating on edge of hole
m (→{{header|Tcl}}) |
(→{{header|Tcl}}: Corrected point updating on edge of hole) |
||
Line 501:
=={{header|Tcl}}==
This code handles both holes and arbitrary polygons in the input data.
<lang tcl>package require Tcl 8.5
Line 583 ⟶ 582:
foreach e $edges {
set ep [selectFrom $points $e]
if {[llength $fp4e($e)] > 1} {
} else {
foreach p $ep {
lappend ep_heavy($p) $mid
}
}
lappend edgepoints $mid
set en4e($e) $i
foreach p $ep {
Line 598 ⟶ 600:
# Generate the new vertex points with our lookup tables.
foreach p $points {
lappend newPoints [add3 [mulC [/ [- $n 3.0] $n] $p] \
} else {
# Update a point on the edge of a hole. This formula is not
lappend newPoints [centroid [list $p] $ep4p($p)]▼
# described on the WP page, but produces a nice result.
} ▼
}
|