Commit cc06a6a2 authored by Wei Zhang's avatar Wei Zhang Committed by David Flynn
Browse files

slices/m49121: constrain slice partitions to trisoup node size

This avoids artefacts during trisoup generation by checking whether the
original slice partition interval is an integer multiple of the block
size W=2^(trisoup_node_size_log2). If not, the partition interval is
rounded up to the nearest integer that is exactly divisible by the block
size.
parent 29f0451f
......@@ -182,7 +182,8 @@ PCCTMC3Encoder3::compress(
case PartitionMethod::kNone: return 1;
case PartitionMethod::kUniformGeom:
curSlices = partitionByUniformGeom(params->partition, tileCloud, t);
curSlices = partitionByUniformGeom(
params->partition, tileCloud, t, _gps->trisoup_node_size_log2);
break;
case PartitionMethod::kOctreeUniform:
......
......@@ -101,7 +101,10 @@ shortestAxis(const Box3<T>& curBox)
std::vector<Partition>
partitionByUniformGeom(
const PartitionParams& params, const PCCPointSet3& cloud, int tileID)
const PartitionParams& params,
const PCCPointSet3& cloud,
int tileID,
int partitionBoundaryLog2)
{
std::vector<Partition> slices;
......@@ -116,6 +119,13 @@ partitionByUniformGeom(
int sliceNum = minEdge ? (maxEdge / minEdge) : 1;
int sliceSize = minEdge ? minEdge : maxEdge;
// In order to avoid issues with trisoup, don't partition points within
// a trisoup node, otherwise there will be issues fitting triangles.
int partitionBoundary = 1 << partitionBoundaryLog2;
if (sliceSize % partitionBoundary) {
sliceSize = (1 + sliceSize / partitionBoundary) * partitionBoundary;
}
while (1) {
slices.clear();
slices.resize(sliceNum);
......
......@@ -106,7 +106,10 @@ struct PartitionSet {
//============================================================================
std::vector<Partition> partitionByUniformGeom(
const PartitionParams& params, const PCCPointSet3& cloud, int tileID);
const PartitionParams& params,
const PCCPointSet3& cloud,
int tileID,
int paritionBoundaryLog2);
std::vector<Partition> partitionByOctreeDepth(
const PartitionParams& params,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment