I have managed to use the tripack package which is a bit simpler to use
(for me) and performs better (timely)...

##################################################
# inputFile format: x y z
inputFile <- "d:\\inputfile.xyz.txt"

# output file will contain a x3d scene embedded in a html file to be viewed
in a browser supporting WebGL/X3DOM
outputFile <- "d:\\scene.x3d.html"

library(tripack)
points <- read.table( inputFile )
mesh <- tri.mesh(x, y)
tris <- triangles(mesh)
nodes <- cbind(tris[,1], tris[,2], tris[,3])

write("<html><head><link rel='stylesheet' type='text/css' href='
http://www.x3dom.org/download/x3dom.css'></link></head><body>
<X3D profile='Interchange'
style='width:100%;height100%'><Scene><Transform><Shape DEF='river'>
<Appearance><Material ambientIntensity='0.0' diffuseColor='0.7 0.4 0'
shininess='1.0'/></Appearance>
<IndexedTriangleSet index='", file=outputFile, append=FALSE)
write.table(nodes, file=outputFile, row.names=FALSE, col.names=FALSE,
append = TRUE)
write("'><Coordinate point='", file=outputFile, append=TRUE)
write.table(cbind(x,y,z), file=outputFile, row.names=FALSE,
col.names=FALSE, append = TRUE)
write("'/></IndexedTriangleSet></Shape></Transform></Scene></X3D>
<script type='text/javascript'
src='http://www.x3dom.org/download/x3dom.js'></script></body></html>",
file=outputFile, append=TRUE)

##################################################

2012/7/20 Rolf Turner <rolf.tur...@xtra.co.nz>

> On 19/07/12 20:40, Erdal Karaca wrote:
>
>> Oh, I dont want anyone to do anything for me. I am just asking for
>> hints/infos to be able to do it myself...
>> I was hoping that someone has already done this...
>> But anyways, I will post my solution once I have succeeded...
>>
>
> If you haven't already looked at it, you may find it helpful to experiment
> with the "triang.list()" function and the "z" argument to "deldir()".
>
> If I understand correctly what you are after, the output of triang.list()
> may go some way toward providing it.
>
>     cheers,
>
>         Rolf Turner
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to