是否有用于编写 ply 文件的 Java 库?

发布于 2024-10-05 18:46:27 字数 43 浏览 2 评论 0原文

我正在寻找一个 Java 库来编写层文件。如果没有,我想研究一下写一个。

I'm looking for a Java library to write out ply files. If there isn't one, I'd like to look into writing one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东走西顾 2024-10-12 18:46:27

如果您只想编写层文件,那么我建议您编写自己的代码。
格式非常简单。所以你自己写起来可能会更快。

首先介绍一下:

http://local.wasp.uwa .edu.au/~pbourke/dataformats/ply/

If you only want to write ply files then I would suggest to write your own code.
the format is quite simple. So you'll probably be faster writing it yourself.

Here is an introduction to start with:

http://local.wasp.uwa.edu.au/~pbourke/dataformats/ply/

断桥再见 2024-10-12 18:46:27

以下是 PLY 编写器代码片段的简化版本,您可以对其进行更改以满足您的需要。



        fos = new FileOutputStream(file);
        Writer writer= new OutputStreamWriter(fos, "UTF8");
        writer.write("ply\n");
        writer.write("format ");
        writer.write(isBinary() ? "binary_big_endian" : "ascii");
        writer.write(" 1.0\n");
        BufferedReader r=new BufferedReader(new StringReader(comment));
        String commentLine;
        while ((commentLine=r.readLine())!=null) {
            writer.write("comment ");
            writer.write(commentLine);
            writer.write('\n');
        }
        // lat,lon,alt as example
        writer.write("element vertex 3\n");
        writer.write("property double x\n");
        writer.write("property double y\n");
        writer.write("property double z\n");
        //writer.write("element face 0\n"); // no element like faces
        //writer.write("property list uchar int vertex_indices\n");
        writer.write("end_header\n");
        writer.flush();
        DataOutputStream dos=new DataOutputStream(fos);
        dos.writeDouble(x);
        dos.writeDouble(y);
        dos.writeDouble(z);
        dos.close();

    }

following is a simplified version of a PLY writer code snippet which you may change it to suit your needs.



        fos = new FileOutputStream(file);
        Writer writer= new OutputStreamWriter(fos, "UTF8");
        writer.write("ply\n");
        writer.write("format ");
        writer.write(isBinary() ? "binary_big_endian" : "ascii");
        writer.write(" 1.0\n");
        BufferedReader r=new BufferedReader(new StringReader(comment));
        String commentLine;
        while ((commentLine=r.readLine())!=null) {
            writer.write("comment ");
            writer.write(commentLine);
            writer.write('\n');
        }
        // lat,lon,alt as example
        writer.write("element vertex 3\n");
        writer.write("property double x\n");
        writer.write("property double y\n");
        writer.write("property double z\n");
        //writer.write("element face 0\n"); // no element like faces
        //writer.write("property list uchar int vertex_indices\n");
        writer.write("end_header\n");
        writer.flush();
        DataOutputStream dos=new DataOutputStream(fos);
        dos.writeDouble(x);
        dos.writeDouble(y);
        dos.writeDouble(z);
        dos.close();

    }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文