你可以如何在外部的 .obj 文件上使用 MVC_post_processor_3?

huangapple go评论98阅读模式
英文:

How can I use MVC_post_processor_3 on an external .obj file?

问题

基本上,我想在我用自己的代码参数化的3D对象上使用MVC_post_processor_3。

我查看了文档,但没有真正找到任何后处理器的示例/演示。我无法正确理解函数的参数。我尝试基于“Surface_mesh_parameterization”中的示例,但输出的.off文件将网格折叠到(0,0,0)。我认为这是因为我无法从.obj文件中读取纹理坐标。

我在Google上也没有找到如何使用后处理器的任何信息。

英文:

Basically, I want to use MVC_post_processor_3 on a 3D object I parameterized using my own code.

I checked documentations but didn't really find any example/demo of post processor. I'm unable to understand the parameters to the function properly. I tried to do it based on examples from "Surface_mesh_parameterization" but the output .off file just collapse the mesh at (0,0,0). I think it's because I'm unable to read the texture co-ordinates from the .obj file.

I also didn't find anything on google on how to use the post-processor.

答案1

得分: 1

你可以查看ARAP参数化器中的用法:


// 后处理函数
// 使用Karni等人的凸虚拟边界算法[2005]来修复结果中(希望很少)的翻转。
template <typename VertexUVMap,
        typename VertexIndexMap>
Error_code post_process(const Triangle_mesh& mesh,
                      const Vertex_set& vertices,
                      const Faces_vector& faces,
                      halfedge_descriptor bhd,
                      VertexUVMap uvmap,
                      const VertexIndexMap vimap) const
{
    typedef MVC_post_processor_3<Triangle_mesh>     Post_processor;

    Post_processor p;
    Error_code status = p.parameterize(mesh, vertices, faces, bhd, uvmap, vimap);
    if(status != OK)
        return status;

#ifdef CGAL_SMP_ARAP_DEBUG
    output_uvmap("ARAP_final_post_processing.off", mesh, vertices, faces, uvmap, vimap);
#endif

    return OK;
}

(链接:https://github.com/CGAL/cgal/blob/fb48b16a37a34226e915e9e4ecf5892d6df6579f/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h#L1244)

  • mesh 是您的输入3D网格
  • verticesfaces 是可选的,您可以省略它们。如果您想要更多细节,请查看内部函数 initialize_containers()
  • bhd 是您的输入3D网格的边界半边,意味着没有关联面的半边。这个半边所属的边界将被固定。
  • uvmap 是一个将您的输入3D网格的顶点与参数化相关联的属性映射。在ARAP示例中,该参数化是使用ARAP计算的,但在这里,您需要填入您的值。值类型是2D点。您可以查看包的示例,了解如何定义和填充UV属性映射(例如,https://doc.cgal.org/latest/Surface_mesh_parameterization/Surface_mesh_parameterization_2simple_parameterization_8cpp-example.html)。
  • vimap 是另一个属性映射,将唯一索引与您的输入3D网格的每个顶点相关联[*]。您可以使用内部函数 fill_index_map_of_cc() 初始化它。

输出写入 uvmap,您可以查看 output_uvmap() 来查看用法示例。

  • 如果您的网格具有多个连接组件,则会处理单个连接组件,其中包含 bhd 所属的组件。
英文:

You can have a look at its usage in the ARAP parameterizer:


// Post processing functions
  // Use the convex virtual boundary algorithm of Karni et al.[2005] to fix
  // the (hopefully few) flips in the result.
  template <typename VertexUVMap,
            typename VertexIndexMap>
  Error_code post_process(const Triangle_mesh& mesh,
                          const Vertex_set& vertices,
                          const Faces_vector& faces,
                          halfedge_descriptor bhd,
                          VertexUVMap uvmap,
                          const VertexIndexMap vimap) const
  {
    typedef MVC_post_processor_3<Triangle_mesh>     Post_processor;

    Post_processor p;
    Error_code status = p.parameterize(mesh, vertices, faces, bhd, uvmap, vimap);
    if(status != OK)
      return status;

#ifdef CGAL_SMP_ARAP_DEBUG
    output_uvmap("ARAP_final_post_processing.off", mesh, vertices, faces, uvmap, vimap);
#endif

    return OK;
  }

(https://github.com/CGAL/cgal/blob/fb48b16a37a34226e915e9e4ecf5892d6df6579f/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h#L1244)

  • mesh is your input 3D mesh
  • vertices and faces are optional, you can omit those. Check the internal function initialize_containers() if you want more detail.
  • bhd is a border halfedge of your input 3D mesh, meaning an halfedge without an incident face. The border on which this halfedge belongs will be fixed.
  • uvmap is a property map associating vertices of your input 3D mesh to your parameterization. In the ARAP example, that parameterization is computed with ARAP, but here you have to fill in your values. The value type is a 2D point. You can look at the package's example to see how to define and fill UV property maps (https://doc.cgal.org/latest/Surface_mesh_parameterization/Surface_mesh_parameterization_2simple_parameterization_8cpp-example.html for example).
  • vimap is another property map associating a unique index to each of your input 3D mesh's vertices [*]. You can initialize that with the internal function fill_index_map_of_cc().

The output is written in uvmap, and you can have a look at output_uvmap() at an example of usage.

  • If your mesh has multiple connected components, then a single connected component is treated, the one that contains to bhd

huangapple
  • 本文由 发表于 2023年2月27日 01:39:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75573864.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定