Skip to content

Commit 36b6043

Browse files
committed
Minor fixes
Signed-off-by: Nick Avramoussis <[email protected]>
1 parent 6a43628 commit 36b6043

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

openvdb/openvdb/points/impl/PrincipalComponentAnalysisImpl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct WeightPosSumsTransfer
222222

223223
inline void rasterizePoints(const Coord&, const Index start, const Index end, const CoordBBox& bounds)
224224
{
225-
const Index step = std::max(1ul, ((end - start) / this->maxSourcePointsPerVoxel()));
225+
const Index step = std::max(Index(1), Index((end - start) / this->maxSourcePointsPerVoxel()));
226226

227227
const auto* const data = this->template buffer<0>();
228228
const auto& mask = *(this->template mask<0>());
@@ -275,7 +275,7 @@ struct WeightPosSumsTransfer
275275
const Index targetEnd = data[offset];
276276
const Index targetStart = (offset == 0) ? 0 : Index(data[offset - 1]);
277277
const Index targetStep =
278-
std::max(1ul, ((targetEnd - targetStart) / this->maxTargetPointsPerVoxel()));
278+
std::max(Index(1), Index((targetEnd - targetStart) / this->maxTargetPointsPerVoxel()));
279279

280280
/// @warning stepping in this way does not guarantee
281281
/// we get a self contribution, could guarantee this
@@ -319,7 +319,7 @@ struct WeightPosSumsTransfer
319319

320320
points::GroupWriteHandle group(leaf.groupWriteHandle(this->mIndices.mEllipsesGroupIndex));
321321

322-
const int32_t threshold = this->neighbourThreshold();
322+
const int32_t threshold = int32_t(this->neighbourThreshold());
323323
for (Index i = 0; i < this->mTargetPosition->size(); ++i)
324324
{
325325
// turn points OFF if they are ON and don't meet max neighbour requirements
@@ -379,7 +379,7 @@ struct CovarianceTransfer
379379

380380
inline void rasterizePoints(const Coord&, const Index start, const Index end, const CoordBBox& bounds)
381381
{
382-
const Index step = std::max(1ul, ((end - start) / this->maxSourcePointsPerVoxel()));
382+
const Index step = std::max(Index(1), Index((end - start) / this->maxSourcePointsPerVoxel()));
383383

384384
const auto* const data = this->template buffer<0>();
385385
const auto& mask = *(this->template mask<0>());
@@ -431,7 +431,7 @@ struct CovarianceTransfer
431431
const Index targetEnd = data[offset];
432432
const Index targetStart = (offset == 0) ? 0 : Index(data[offset - 1]);
433433
const Index targetStep =
434-
std::max(1ul, ((targetEnd - targetStart) / this->maxTargetPointsPerVoxel()));
434+
std::max(Index(1), Index((targetEnd - targetStart) / this->maxTargetPointsPerVoxel()));
435435

436436
for (Index tgtid = targetStart; tgtid < targetEnd; tgtid += targetStep)
437437
{

openvdb/openvdb/unittest/TestPCA.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ TEST_F(TestPCA, testPCA)
267267
points::PcaSettings s;
268268
s.searchRadius = std::numeric_limits<float>::max();
269269
s.averagePositions = 0.0f; // disable position smoothing
270-
s.neighbourThreshold = 3; // more than 2, points should end up as spheres
270+
s.neighbourThreshold = 4; // more than 3, points should end up as spheres
271271
s.nonAnisotropicStretch = 2.0f;
272272

273273
points::pca(*points, s, a);

openvdb/openvdb/unittest/TestPointRasterizeSDF.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,15 +1203,15 @@ TEST_F(TestPointRasterizeSDF, testRasterizeEllipsoids)
12031203
Ellipse ellipse(Vec3d(0), (stretch * (s.radiusScale/sdf->voxelSize()[0])), rot);
12041204

12051205
for (auto iter = sdf->cbeginValueOn(); iter; ++iter) {
1206-
const float distance = ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]);
1206+
const float distance = float(ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]));
12071207
EXPECT_NEAR(distance, *iter, 1e-6f);
12081208
}
12091209

12101210
// check off values (because we're also squashing the halfband we
12111211
// just compre the overal length to 0.0)
12121212
size_t interiorOff = 0, exteriorOff = 0;
12131213
for (auto iter = sdf->cbeginValueOff(); iter; ++iter) {
1214-
const float distance = ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]);
1214+
const float distance = float(ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]));
12151215
const bool interior = (distance <= 0.0);
12161216
if (interior) EXPECT_EQ(-sdf->background(), *iter);
12171217
else EXPECT_EQ(sdf->background(), *iter);
@@ -1262,8 +1262,6 @@ TEST_F(TestPointRasterizeSDF, testRasterizeEllipsoids)
12621262
c.setToRotation({0,0,1}, 66);
12631263
rot = a * b * c;
12641264

1265-
// The transform that defines how we go from each voxel back to the source point
1266-
const math::Mat3s inv = rot.timesDiagonal(1.0 / stretch) * rot.transpose();
12671265
//
12681266

12691267
/// 1) test with a single ellips with Y stretch/rotation
@@ -1289,15 +1287,15 @@ TEST_F(TestPointRasterizeSDF, testRasterizeEllipsoids)
12891287
const Ellipse ellipse(sdf->worldToIndex(center), stretch * (1/sdf->voxelSize()[0]), rot);
12901288

12911289
for (auto iter = sdf->cbeginValueOn(); iter; ++iter) {
1292-
const float distance = ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]);
1290+
const float distance = float(ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]));
12931291
EXPECT_NEAR(distance, *iter, 1e-6f);
12941292
}
12951293

12961294
// check off values (because we're also squashing the halfband we
12971295
// just compre the overal length to 0.0)
12981296
size_t interiorOff = 0, exteriorOff = 0;
12991297
for (auto iter = sdf->cbeginValueOff(); iter; ++iter) {
1300-
const float distance = ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]);
1298+
const float distance = float(ellipse.project(iter.getCoord().asVec3d()) * float(sdf->voxelSize()[0]));
13011299
const bool interior = (distance <= 0.0);
13021300
if (interior) EXPECT_EQ(-sdf->background(), *iter);
13031301
else EXPECT_EQ(sdf->background(), *iter);

0 commit comments

Comments
 (0)