my.catmull.clark.tri: 3D triangle mesh smoothing

Description Usage Arguments Examples

Description

These functions make triangle mesh smooth with Catmull Clark subdivision

Usage

1

Arguments

x.vet

is a list.

Examples

 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
library(rgl)
library(misc3d)
library(Matrix)
library(onion)
v <- matrix(c(1,2,3,2,3,1,3,3,3),byrow=TRUE,ncol=3)
u <- v[c(3,2,1,3,2,2,2,3),]
my.tri.v.id(v,u)
k <- 4
out <- my.3d.obj(3,k)
obj <- out$xyz[which(out$xyz.val==1),]
plot3d(obj)
xyz.arr <- array(out$xyz.val,c(2^k,2^k,2^k))
tris <- my.peri.tri(xyz.arr)
drawScene.rgl(tris)
ttt <- my.tri.vid(tris)
sss <- my.tri.vet(ttt[[2]])
x.vet <- list(ttt[[1]],sss)
new.vet <- my.catmull.clark.tri(x.vet)
plot3d(new.vet[[1]][new.vet[[2]]$v.of.t,])
drawScene.rgl(tris)
tris2 <- tris
tris2$v1 <- new.vet[[1]][new.vet[[2]]$v.of.t[,1],]
tris2$v2 <- new.vet[[1]][new.vet[[2]]$v.of.t[,2],]
tris2$v3 <- new.vet[[1]][new.vet[[2]]$v.of.t[,3],]
drawScene.rgl(tris2)
vot <- new.vet[[2]]$v.of.t
voe <- new.vet[[2]]$v.of.e
toe <- new.vet[[2]]$t.of.e
tri.sorted <- my.sort.tri.dir(toe,voe,vot)
vertices <- new.vet[[1]][,1]*Hi+new.vet[[1]][,2]*Hj+new.vet[[1]][,3]*Hk
faces.v <- t(tri.sorted)
my.mesh.tri.plot(vertices,faces.v)
tmp.out <- my.mesh.back.euler(vertices,faces.v,step=0.005,eps=10^(-10),max.iter=200)
for(i in 1:20){
	tmp.out <- my.mesh.back.euler(tmp.out,faces.v,step=0.005)
	my.mesh.tri.plot(tmp.out,faces.v)
}
my.mesh.tri.plot(tmp.out,faces.v)

ryamada22/Ronlyryamada documentation built on May 28, 2019, 10:43 a.m.