![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Functions | |
| std::tuple< float, int, int > | ComputeUVAtlas (TriangleMesh &mesh, const size_t width, const size_t height, const float gutter, const float max_stretch, int parallel_partitions, int nthreads) |
| std::tuple< float, int, int > cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas | ( | TriangleMesh & | mesh, |
| const size_t | width = 512, |
||
| const size_t | height = 512, |
||
| const float | gutter = 1.0f, |
||
| const float | max_stretch = 1.f/6, |
||
| int | parallel_partitions = 1, |
||
| int | nthreads = 0 |
||
| ) |
Creates an UV atlas and adds it as triangle attr 'texture_uvs' to the mesh.
Input meshes must be manifold for this method to work.
The algorithm is based on:
| mesh | Input and output mesh. |
| width | The target width of the texture. The uv coordinates will still be in the range [0..1] but parameters like gutter use pixels as units. |
| height | The target height of the texture. |
| gutter | This is the space around the uv islands in pixels. |
| max_stretch | The maximum amount of stretching allowed. The parameter range is [0..1] with 0 meaning no stretch allowed. |
| max_stretch_out | Output parameter returning the actual maximum amount of stretch. |
| num_charts_out | Output parameter with the number of charts created. |
| parallel_partitions | The approximate number of partitions created before computing the UV atlas for parallelizing the computation. Parallelization can be enabled with values > 1. Note that parallelization increases the number of UV islands and can lead to results with lower quality. |
| nthreads | The number of threads used when parallel_partitions is > 1. Set to 0 for automatic number of thread detection. |
Definition at line 175 of file UVUnwrapping.cpp.
References cloudViewer::core::Tensor::Arange(), cloudViewer::core::Tensor::Contiguous(), cloudViewer::core::Float32, cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::t::geometry::TriangleMesh::GetDevice(), cloudViewer::core::Tensor::GetLength(), cloudViewer::t::geometry::TriangleMesh::GetTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::GetTriangleIndices(), cloudViewer::t::geometry::TriangleMesh::GetVertexPositions(), height, ib, cloudViewer::core::Int64, LogError, LogInfo, max(), original_face_idx, cloudViewer::t::geometry::TriangleMesh::PCAPartition(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::t::geometry::TriangleMesh::SetTriangleAttr(), cloudViewer::core::Tensor::To(), vb, and width.
Referenced by cloudViewer::t::geometry::TriangleMesh::ComputeUVAtlas().