Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless const modifiers on return types #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/VHACD_Lib/inc/vhacdMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ class Mesh {
Vec3<double>& GetPoint(size_t index) { return m_points[index]; };
size_t GetNPoints() const { return m_points.Size(); };
double* GetPoints() { return (double*)m_points.Data(); } // ugly
const double* const GetPoints() const { return (double*)m_points.Data(); } // ugly
const Vec3<double>* const GetPointsBuffer() const { return m_points.Data(); } //
Vec3<double>* const GetPointsBuffer() { return m_points.Data(); } //
const double* GetPoints() const { return (double*)m_points.Data(); } // ugly
const Vec3<double>* GetPointsBuffer() const { return m_points.Data(); } //
Vec3<double>* GetPointsBuffer() { return m_points.Data(); } //
void AddTriangle(const Vec3<int32_t>& tri) { m_triangles.PushBack(tri); };
void SetTriangle(size_t index, const Vec3<int32_t>& tri) { m_triangles[index] = tri; };
const Vec3<int32_t>& GetTriangle(size_t index) const { return m_triangles[index]; };
Vec3<int32_t>& GetTriangle(size_t index) { return m_triangles[index]; };
size_t GetNTriangles() const { return m_triangles.Size(); };
int32_t* GetTriangles() { return (int32_t*)m_triangles.Data(); } // ugly
const int32_t* const GetTriangles() const { return (int32_t*)m_triangles.Data(); } // ugly
const Vec3<int32_t>* const GetTrianglesBuffer() const { return m_triangles.Data(); }
Vec3<int32_t>* const GetTrianglesBuffer() { return m_triangles.Data(); }
const int32_t* GetTriangles() const { return (int32_t*)m_triangles.Data(); } // ugly
const Vec3<int32_t>* GetTrianglesBuffer() const { return m_triangles.Data(); }
Vec3<int32_t>* GetTrianglesBuffer() { return m_triangles.Data(); }
const Vec3<double>& GetCenter() const { return m_center; }
const Vec3<double>& GetMinBB() const { return m_minBB; }
const Vec3<double>& GetMaxBB() const { return m_maxBB; }
Expand Down Expand Up @@ -127,4 +127,4 @@ class Mesh {
double m_diag;
};
}
#endif
#endif
6 changes: 3 additions & 3 deletions src/VHACD_Lib/inc/vhacdSArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class SArray {
{
return m_size;
}
T* const Data()
T* Data()
{
return (m_maxSize == N) ? m_data0 : m_data;
}
const T* const Data() const
const T* Data() const
{
return (m_maxSize == N) ? m_data0 : m_data;
}
Expand Down Expand Up @@ -155,4 +155,4 @@ class SArray {
size_t m_maxSize;
};
}
#endif
#endif
4 changes: 2 additions & 2 deletions src/VHACD_Lib/inc/vhacdVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ class Vec2 {
};

template <typename T>
const bool Colinear(const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c);
bool Colinear(const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c);
template <typename T>
const T ComputeVolume4(const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c, const Vec3<T>& d);
}
#include "vhacdVector.inl" // template implementation
#endif
#endif
6 changes: 3 additions & 3 deletions src/VHACD_Lib/inc/vhacdVector.inl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace VHACD
inline Vec3<T>::Vec3() {}

template<typename T>
inline const bool Colinear(const Vec3<T> & a, const Vec3<T> & b, const Vec3<T> & c)
inline bool Colinear(const Vec3<T> & a, const Vec3<T> & b, const Vec3<T> & c)
{
return ((c.Z() - a.Z()) * (b.Y() - a.Y()) - (b.Z() - a.Z()) * (c.Y() - a.Y()) == 0.0 /*EPS*/) &&
((b.Z() - a.Z()) * (c.X() - a.X()) - (b.X() - a.X()) * (c.Z() - a.Z()) == 0.0 /*EPS*/) &&
Expand Down Expand Up @@ -343,7 +343,7 @@ namespace VHACD
defined by A, B, C.
*/
template<typename T>
inline const bool InsideTriangle(const Vec2<T> & a, const Vec2<T> & b, const Vec2<T> & c, const Vec2<T> & p)
inline bool InsideTriangle(const Vec2<T> & a, const Vec2<T> & b, const Vec2<T> & c, const Vec2<T> & p)
{
T ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
T cCROSSap, bCROSScp, aCROSSbp;
Expand All @@ -359,4 +359,4 @@ namespace VHACD
return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0));
}
}
#endif //VHACD_VECTOR_INL
#endif //VHACD_VECTOR_INL
46 changes: 23 additions & 23 deletions src/VHACD_Lib/inc/vhacdVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class PrimitiveSet {
public:
virtual ~PrimitiveSet(){};
virtual PrimitiveSet* Create() const = 0;
virtual const size_t GetNPrimitives() const = 0;
virtual const size_t GetNPrimitivesOnSurf() const = 0;
virtual const size_t GetNPrimitivesInsideSurf() const = 0;
virtual const double GetEigenValue(AXIS axis) const = 0;
virtual const double ComputeMaxVolumeError() const = 0;
virtual const double ComputeVolume() const = 0;
virtual size_t GetNPrimitives() const = 0;
virtual size_t GetNPrimitivesOnSurf() const = 0;
virtual size_t GetNPrimitivesInsideSurf() const = 0;
virtual double GetEigenValue(AXIS axis) const = 0;
virtual double ComputeMaxVolumeError() const = 0;
virtual double ComputeVolume() const = 0;
virtual void Clip(const Plane& plane, PrimitiveSet* const positivePart,
PrimitiveSet* const negativePart) const = 0;
virtual void Intersect(const Plane& plane, SArray<Vec3<double> >* const positivePts,
Expand Down Expand Up @@ -80,12 +80,12 @@ class VoxelSet : public PrimitiveSet {
//! Constructor.
VoxelSet();

const size_t GetNPrimitives() const { return m_voxels.Size(); }
const size_t GetNPrimitivesOnSurf() const { return m_numVoxelsOnSurface; }
const size_t GetNPrimitivesInsideSurf() const { return m_numVoxelsInsideSurface; }
const double GetEigenValue(AXIS axis) const { return m_D[axis][axis]; }
const double ComputeVolume() const { return m_unitVolume * m_voxels.Size(); }
const double ComputeMaxVolumeError() const { return m_unitVolume * m_numVoxelsOnSurface; }
size_t GetNPrimitives() const { return m_voxels.Size(); }
size_t GetNPrimitivesOnSurf() const { return m_numVoxelsOnSurface; }
size_t GetNPrimitivesInsideSurf() const { return m_numVoxelsInsideSurface; }
double GetEigenValue(AXIS axis) const { return m_D[axis][axis]; }
double ComputeVolume() const { return m_unitVolume * m_voxels.Size(); }
double ComputeMaxVolumeError() const { return m_unitVolume * m_numVoxelsOnSurface; }
const Vec3<short>& GetMinBBVoxels() const { return m_minBBVoxels; }
const Vec3<short>& GetMaxBBVoxels() const { return m_maxBBVoxels; }
const Vec3<double>& GetMinBB() const { return m_minBB; }
Expand Down Expand Up @@ -127,8 +127,8 @@ class VoxelSet : public PrimitiveSet {
}
void AlignToPrincipalAxes(){};
void RevertAlignToPrincipalAxes(){};
Voxel* const GetVoxels() { return m_voxels.Data(); }
const Voxel* const GetVoxels() const { return m_voxels.Data(); }
Voxel* GetVoxels() { return m_voxels.Data(); }
const Voxel* GetVoxels() const { return m_voxels.Data(); }

private:
size_t m_numVoxelsOnSurface;
Expand Down Expand Up @@ -163,16 +163,16 @@ class TetrahedronSet : public PrimitiveSet {
//! Constructor.
TetrahedronSet();

const size_t GetNPrimitives() const { return m_tetrahedra.Size(); }
const size_t GetNPrimitivesOnSurf() const { return m_numTetrahedraOnSurface; }
const size_t GetNPrimitivesInsideSurf() const { return m_numTetrahedraInsideSurface; }
size_t GetNPrimitives() const { return m_tetrahedra.Size(); }
size_t GetNPrimitivesOnSurf() const { return m_numTetrahedraOnSurface; }
size_t GetNPrimitivesInsideSurf() const { return m_numTetrahedraInsideSurface; }
const Vec3<double>& GetMinBB() const { return m_minBB; }
const Vec3<double>& GetMaxBB() const { return m_maxBB; }
const Vec3<double>& GetBarycenter() const { return m_barycenter; }
const double GetEigenValue(AXIS axis) const { return m_D[axis][axis]; }
const double GetSacle() const { return m_scale; }
const double ComputeVolume() const;
const double ComputeMaxVolumeError() const;
double GetEigenValue(AXIS axis) const { return m_D[axis][axis]; }
double GetSacle() const { return m_scale; }
double ComputeVolume() const;
double ComputeMaxVolumeError() const;
void ComputeConvexHull(Mesh& meshCH, const size_t sampling = 1) const;
void ComputePrincipalAxes();
void AlignToPrincipalAxes();
Expand Down Expand Up @@ -235,8 +235,8 @@ class Volume {
assert(k < m_dim[0] || k >= 0);
return m_data[i + j * m_dim[0] + k * m_dim[0] * m_dim[1]];
}
const size_t GetNPrimitivesOnSurf() const { return m_numVoxelsOnSurface; }
const size_t GetNPrimitivesInsideSurf() const { return m_numVoxelsInsideSurface; }
size_t GetNPrimitivesOnSurf() const { return m_numVoxelsOnSurface; }
size_t GetNPrimitivesInsideSurf() const { return m_numVoxelsInsideSurface; }
void Convert(Mesh& mesh, const VOXEL_VALUE value) const;
void Convert(VoxelSet& vset) const;
void Convert(TetrahedronSet& tset) const;
Expand Down
4 changes: 2 additions & 2 deletions src/VHACD_Lib/src/vhacdVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ void TetrahedronSet::Convert(Mesh& mesh, const VOXEL_VALUE value) const
}
}
}
const double TetrahedronSet::ComputeVolume() const
double TetrahedronSet::ComputeVolume() const
{
const size_t nTetrahedra = m_tetrahedra.Size();
if (nTetrahedra == 0)
Expand All @@ -1536,7 +1536,7 @@ const double TetrahedronSet::ComputeVolume() const
}
return volume / 6.0;
}
const double TetrahedronSet::ComputeMaxVolumeError() const
double TetrahedronSet::ComputeMaxVolumeError() const
{
const size_t nTetrahedra = m_tetrahedra.Size();
if (nTetrahedra == 0)
Expand Down