[R] R package for reading / writing 3D file (. PLY)
kvarpun
jallouli.med.amine at gmail.com
Fri Nov 13 10:53:18 CET 2009
Duncan Murdoch-2 wrote:
>
> On 11/12/2009 11:37 AM, kvarpun wrote:
>>
>> Duncan Murdoch-2 wrote:
>>>
>>> On 11/12/2009 4:56 AM, kvarpun wrote:
>>>> Hi,
>>>>
>>>> Is there an R package that reads and writes 3D images having the
>>>> extension
>>>> PLY (PLY images of Stanford University)?
>>>>
>>>> Currently, I installed the package misc3d. This package displays these
>>>> images PLY, but it can neither read nor write PLY images.
>>>
>>> This doesn't make sense. How can it display PLY images if it can't read
>>> them? Could you give an example?
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> Thank you to tell me the name of a package that will read and write
>>>> such
>>>> images.
>>>
>>> ______________________________________________
>>> R-help at 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.
>>>
>>>
>>
>> Thank you for quick answer.
>> I have to inform you that the only available functions in the package
>> misc3d
>> are:
>>
>> contour3d Draw an Isosurface, a Three Dimension Contour
>> Plot
>> drawScene Rendering of Triangular Mesh Surface Data
>> image3d Draw Points on a 3D Grid
>> kde3d Compute a Three Dimension Kernel Density
>> Estimate
>> makeTriangles Triangle Mesh Functions
>> parametric3d Draw a 3D Parametric Plot
>> perspLighting Lighting Functions
>> phongLighting Lighting Functions
>> pointsTetrahedra Create a Set of Tetrahetra Centered at Data Points
>> scaleTriangles Triangle Mesh Functions
>> slices3d Interactive Image Slices of 3D or 4D Volume
>> Data
>> surfaceTriangles Create a Triangle Mesh Representing a Surface
>> teapot Utah Teapot
>> translateTriangles Triangle Mesh Functions
>> updateTriangles Triangle Mesh Functions
>>
>> None of them does read/write a PLY file.
>>
>>
>> You will find below a simple code for drawing a 3D image. The displayed
>> image is stored in the package misc3d (not read from a file).
>>
>> library(misc3d)
>> data(teapot)
>>
>> haveRGL <- suppressWarnings(require(rgl,quietly=TRUE))
>> ttri <- makeTriangles(teapot$vertices, teapot$edges, color = "red",
>> color2 =
>> "green")
>>
>> ## draw the teapot
>> drawScene(ttri,screen=list(y=-30,x=40), scale = FALSE)
>>
>> str(teapot)
>> # > str(teapot)
>> # List of 2
>> # $ vertices: num [1:3, 1:1976] -3,00 1,65 0,00 -2,99 1,65 ...
>> # $ edges : int [1:3, 1:3751] 1455 1469 1459 1449 1455 1459 1462 1449
>> 1459
>> 1469 ...
>>
>> # My images (PLY images) have vertices and edges like the teapot image in
>> the example. If PLY images are read by R, I will be able to manipulate
>> them.
>
> Okay, I understand now. Yes, R can display 3D images based on lines and
> polygons using the rgl package or scatterplot3d or grid graphics, but
> those have nothing to do with PLY files. As far as I know there is no
> existing code to read or write a PLY file, but from the look of it, it's
> a simple format and it wouldn't be hard to write input/output routines.
> The likely problems are:
>
> - it's an open ended format, with each application allowed to define
> its own record types. If your files come from an application that did
> that you may have trouble working out what was intended and reading it in.
>
> - some of the recommended elements are not supported in rgl or other
> 3D renderers in R. In particular, polygons with more than 4 vertices
> need to be decomposed into triangles or quads, and rgl knows nothing
> about refraction index: you'd probably need a ray-tracing renderer for
> that.
>
> - rgl scenes contain text, and as far as I can see, there's no way to
> include that in a standard PLY file, so you'd need to invent your own
> record type for it. Text is always hard to describe graphically, so
> this wouldn't be easy.
>
> Duncan Murdoch
>
> ______________________________________________
> R-help at 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.
>
>
Thank you for all these precisions.
I guess developping an R package for reading/writing PLY files is required.
Have a nice day.
--
View this message in context: http://old.nabble.com/R-package-for-reading---writing-3D-file-%28.-PLY%29-tp26315292p26333989.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list