Skip to content

Commit

Permalink
Renamed private members to have underscore suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Mar 5, 2024
1 parent e8b49fe commit 774bc87
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/RenderStatistic.cc
Expand Up @@ -354,7 +354,7 @@ void StreamVisitor::visit(const PolySet& ps)
assert(ps.getDimension() == 3);
nlohmann::json geometryJson;
geometryJson["dimensions"] = 3;
geometryJson["convex"] = ps.is_convex();
geometryJson["convex"] = ps.isConvex();
geometryJson["facets"] = ps.numFacets();
if (is_enabled(RenderStatistic::BOUNDING_BOX)) {
geometryJson["bounding_box"] = getBoundingBox3(ps);
Expand Down
18 changes: 9 additions & 9 deletions src/geometry/PolySet.cc
Expand Up @@ -46,7 +46,7 @@
*/

PolySet::PolySet(unsigned int dim, boost::tribool convex) : dim(dim), convex(convex)
PolySet::PolySet(unsigned int dim, boost::tribool convex) : dim_(dim), convex_(convex)
{
}

Expand All @@ -58,7 +58,7 @@ std::string PolySet::dump() const
{
std::ostringstream out;
out << "PolySet:"
<< "\n dimensions:" << this->dim
<< "\n dimensions:" << dim_
<< "\n convexity:" << this->convexity
<< "\n num polygons: " << indices.size()
<< "\n polygons data:";
Expand All @@ -74,12 +74,12 @@ std::string PolySet::dump() const

BoundingBox PolySet::getBoundingBox() const
{
if (this->bbox.isNull()) {
if (bbox_.isNull()) {
for (const auto& v : vertices) {
this->bbox.extend(v);
bbox_.extend(v);
}
}
return this->bbox;
return bbox_;
}

size_t PolySet::memsize() const
Expand All @@ -102,12 +102,12 @@ void PolySet::transform(const Transform3d& mat)
for (auto& p : this->indices) {
std::reverse(p.begin(), p.end());
}
this->bbox.setNull();
bbox_.setNull();
}

bool PolySet::is_convex() const {
if (convex || this->isEmpty()) return true;
if (!convex) return false;
bool PolySet::isConvex() const {
if (convex_ || this->isEmpty()) return true;
if (!convex_) return false;
return PolySetUtils::is_approximately_convex(*this);
}

Expand Down
12 changes: 6 additions & 6 deletions src/geometry/PolySet.h
Expand Up @@ -23,7 +23,7 @@ class PolySet : public Geometry
size_t memsize() const override;
BoundingBox getBoundingBox() const override;
std::string dump() const override;
unsigned int getDimension() const override { return this->dim; }
unsigned int getDimension() const override { return dim_; }
bool isEmpty() const override { return indices.empty(); }
std::unique_ptr<Geometry> copy() const override;

Expand All @@ -32,14 +32,14 @@ class PolySet : public Geometry
void transform(const Transform3d& mat) override;
void resize(const Vector3d& newsize, const Eigen::Matrix<bool, 3, 1>& autosize) override;

bool is_convex() const;
boost::tribool convexValue() const { return this->convex; }
bool isConvex() const;
boost::tribool convexValue() const { return convex_; }
bool isTriangular = false;

static std::unique_ptr<PolySet> createEmpty() { return std::make_unique<PolySet>(3); }

private:
unsigned int dim;
mutable boost::tribool convex;
mutable BoundingBox bbox;
unsigned int dim_;
mutable boost::tribool convex_;
mutable BoundingBox bbox_;
};
2 changes: 1 addition & 1 deletion src/geometry/boolean_utils.cc
Expand Up @@ -137,7 +137,7 @@ std::shared_ptr<const Geometry> applyMinkowski(const Geometry::Geometries& child
else if (nef && nef->p3->is_simple()) CGALUtils::convertNefToPolyhedron(*nef->p3, poly);
else throw 0;

if ((ps && ps->is_convex()) ||
if ((ps && ps->isConvex()) ||
(!ps && CGALUtils::is_weakly_convex(poly))) {
PRINTDB("Minkowski: child %d is convex and %s", i % (ps?"PolySet":"Nef"));
P[i].push_back(poly);
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/cgal/cgalutils-applyops-hybrid-minkowski.cc
Expand Up @@ -66,7 +66,7 @@ std::shared_ptr<const Geometry> applyMinkowskiHybrid(const Geometry::Geometries&
else throw 0;
} else throw 0;

if ((ps && ps->is_convex()) ||
if ((ps && ps->isConvex()) ||
(!ps && CGALUtils::is_weakly_convex(*poly))) {
PRINTDB("Minkowski: child %d is convex and %s", i % (ps?"PolySet":"Hybrid"));
P[i].push_back(poly);
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/cgal/cgalutils-hybrid.cc
Expand Up @@ -49,7 +49,7 @@ std::shared_ptr<CGALHybridPolyhedron> createHybridPolyhedronFromPolySet(const Po
std::vector<Vector3d> points3d;
psq.quantizeVertices(&points3d);
auto ps_tri = PolySetUtils::tessellate_faces(psq);
if (ps_tri->is_convex()) {
if (ps_tri->isConvex()) {
using K = CGAL::Epick;
// Collect point cloud
std::vector<K::Point_3> points(points3d.size());
Expand All @@ -70,7 +70,7 @@ std::shared_ptr<CGALHybridPolyhedron> createHybridPolyhedronFromPolySet(const Po
if (createMeshFromPolySet(*ps_tri, *mesh)) {
assert(false && "Error from createMeshFromPolySet");
}
if (!ps_tri->is_convex()) {
if (!ps_tri->isConvex()) {
if (isClosed(*mesh)) {
// Note: PMP::orient can corrupt models and cause cataclysmic memory leaks
// (try testdata/scad/3D/issues/issue1105d.scad for instance), but
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/cgal/cgalutils.cc
Expand Up @@ -46,7 +46,7 @@ std::unique_ptr<CGAL_Nef_polyhedron> createNefPolyhedronFromPolySet(const PolySe
std::vector<Vector3d> points3d;
psq.quantizeVertices(&points3d);
auto ps_tri = PolySetUtils::tessellate_faces(psq);
if (ps_tri->is_convex()) {
if (ps_tri->isConvex()) {
using K = CGAL::Epick;
// Collect point cloud
std::vector<K::Point_3> points(points3d.size());
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/manifold/manifold-applyops-minkowski.cc
Expand Up @@ -31,7 +31,7 @@ std::shared_ptr<const Geometry> applyMinkowskiManifold(const Geometry::Geometrie
if (ps) {
auto poly = std::make_shared<Polyhedron>();
CGALUtils::createPolyhedronFromPolySet(*ps, *poly);
if (pIsConvexOut) *pIsConvexOut = ps->is_convex();
if (pIsConvexOut) *pIsConvexOut = ps->isConvex();
return poly;
} else {
if (auto mani = std::dynamic_pointer_cast<const ManifoldGeometry>(geom)) {
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/manifold/manifoldutils.cc
Expand Up @@ -116,7 +116,7 @@ std::shared_ptr<const ManifoldGeometry> createManifoldFromPolySet(const PolySet&

CGAL_DoubleMesh m;

if (ps_tri->is_convex()) {
if (ps_tri->isConvex()) {
using K = CGAL::Epick;
// Collect point cloud
std::vector<K::Point_3> points(points3d.size());
Expand All @@ -133,7 +133,7 @@ std::shared_ptr<const ManifoldGeometry> createManifoldFromPolySet(const PolySet&
CGALUtils::createMeshFromPolySet(*ps_tri, m);
}

if (!ps_tri->is_convex()) {
if (!ps_tri->isConvex()) {
if (CGALUtils::isClosed(m)) {
CGALUtils::orientToBoundAVolume(m);
} else {
Expand Down

0 comments on commit 774bc87

Please sign in to comment.