Commit 887827fd authored by David Flynn's avatar David Flynn
Browse files

refactor: rename pcc::PCCBox3<T> to pcc:Box3<T>

This is part of a series attempting to remove unhelpful typedefs.
parent 30dab101
......@@ -281,7 +281,7 @@ private:
};
template<typename T>
struct PCCBox3 {
struct Box3 {
Vec3<T> min;
Vec3<T> max;
bool contains(const Vec3<T> point) const
......@@ -291,7 +291,7 @@ struct PCCBox3 {
|| point.y() > max.y() || point.z() < min.z() || point.z() > max.z());
}
PCCBox3 merge(const PCCBox3& box)
Box3 merge(const Box3& box)
{
min.x() = std::min(min.x(), box.min.x());
min.y() = std::min(min.y(), box.min.y());
......@@ -302,7 +302,7 @@ struct PCCBox3 {
return box;
}
bool intersects(const PCCBox3& box) const
bool intersects(const Box3& box) const
{
return max.x() >= box.min.x() && min.x() <= box.max.x()
&& max.y() >= box.min.y() && min.y() <= box.max.y()
......@@ -317,13 +317,13 @@ struct PCCBox3 {
return dx * dx + dy * dy + dz * dz;
}
friend std::ostream& operator<<(std::ostream& os, const PCCBox3& box)
friend std::ostream& operator<<(std::ostream& os, const Box3& box)
{
os << box.min[0] << " " << box.min[1] << " " << box.min[2] << " "
<< box.max[0] << " " << box.max[1] << " " << box.max[2] << std::endl;
return os;
}
friend std::istream& operator>>(std::istream& is, PCCBox3& box)
friend std::istream& operator>>(std::istream& is, Box3& box)
{
is >> box.min[0] >> box.min[1] >> box.min[2] >> box.max[0] >> box.max[1]
>> box.max[2];
......@@ -335,7 +335,7 @@ struct PCCBox3 {
typedef DEPRECATED_MSVC Vec3<double> PCCVector3D DEPRECATED;
typedef DEPRECATED_MSVC Vec3<double> PCCPoint3D DEPRECATED;
typedef PCCBox3<double> PCCBox3D;
typedef Box3<double> PCCBox3D;
typedef DEPRECATED_MSVC Vec3<uint8_t> PCCColor3B DEPRECATED;
template<typename T>
......
......@@ -59,7 +59,7 @@ inline void
quantizePositionsUniq(
const float scaleFactor,
const Vec3<int> offset,
const PCCBox3<int> clamp,
const Box3<int> clamp,
const PCCPointSet3& src,
PCCPointSet3* dst)
{
......@@ -108,7 +108,7 @@ inline void
quantizePositions(
const float scaleFactor,
const Vec3<int> offset,
const PCCBox3<int> clamp,
const Box3<int> clamp,
const PCCPointSet3& src,
PCCPointSet3* dst)
{
......
......@@ -114,7 +114,7 @@ PCCTMC3Encoder3::compress(
PartitionSet partitions;
do {
PCCPointSet3 quantizedInputCloud;
PCCBox3<int32_t> clampBox{{0, 0, 0}, {INT32_MAX, INT32_MAX, INT32_MAX}};
Box3<int32_t> clampBox{{0, 0, 0}, {INT32_MAX, INT32_MAX, INT32_MAX}};
quantizePositions(
_sps->seq_source_geom_scale_factor, _sps->seq_bounding_box_xyz0,
clampBox, inputPointCloud, &quantizedInputCloud);
......@@ -410,12 +410,12 @@ PCCTMC3Encoder3::quantization(const PCCPointSet3& inputPointCloud)
// Clamp all points to [clampBox.min, clampBox.max] after translation
// and quantisation.
PCCBox3<int32_t> clampBox{{0, 0, 0}, {INT32_MAX, INT32_MAX, INT32_MAX}};
Box3<int32_t> clampBox{{0, 0, 0}, {INT32_MAX, INT32_MAX, INT32_MAX}};
if (_sps->seq_bounding_box_whd != Vec3<int>{0}) {
// todo(df): this is icky (not to mention rounding issues)
// NB: the sps seq_bounding_box_* uses unscaled co-ordinates => convert
// NB: minus 1 to convert to max x/y/z position
clampBox = PCCBox3<int32_t>{{0, 0, 0}, _sps->seq_bounding_box_whd};
clampBox = Box3<int32_t>{{0, 0, 0}, _sps->seq_bounding_box_whd};
for (int k = 0; k < 3; k++)
clampBox.max[k] =
int(ceil(clampBox.max[k] * _sps->seq_source_geom_scale_factor)) - 1;
......
......@@ -44,7 +44,7 @@ namespace pcc {
template<typename T>
static int
longestAxis(const PCCBox3<T>& curBox)
longestAxis(const Box3<T>& curBox)
{
int edgeAxis = 0;
......@@ -62,7 +62,7 @@ longestAxis(const PCCBox3<T>& curBox)
template<typename T>
static int
shortestAxis(const PCCBox3<T>& curBox)
shortestAxis(const Box3<T>& curBox)
{
int edgeAxis = 0;
......@@ -148,7 +148,7 @@ partitionByOctreeDepth(const PCCPointSet3& cloud, int depOctree)
// noting that there is a correspondence between point position
// and octree node, calculate the position mask and shift required
// to determine the node address for a point.
PCCBox3<double> bbox = cloud.computeBoundingBox();
Box3<double> bbox = cloud.computeBoundingBox();
int maxBb = (int)std::max({bbox.max[0], bbox.max[1], bbox.max[2]});
int cloudSizeLog2 = ceillog2(maxBb + 1);
......
Supports Markdown
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