Skip to content

Commit

Permalink
fix(clang-tidy): apply format
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Oct 3, 2024
1 parent 5737534 commit 4717121
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 59 deletions.
7 changes: 3 additions & 4 deletions src/Cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ namespace SFCGAL {
Cylinder::Cylinder(const Point_3 &base_center, const Vector_3 &axis,
const Kernel::FT &radius, const Kernel::FT &height,
int num_radial)
: m_base_center(base_center), m_axis(axis),
m_radius(radius), m_height(height),
m_num_radial(num_radial)
: m_base_center(base_center), m_axis(axis), m_radius(radius),
m_height(height), m_num_radial(num_radial)
{
}

Expand Down Expand Up @@ -74,7 +73,7 @@ Cylinder::normalize(const Vector_3 &v) -> Cylinder::Vector_3
double length = std::sqrt(CGAL::to_double(v.squared_length()));
if (length < 1e-8) {
return v;
}
}
return v / length;
}

Expand Down
1 change: 0 additions & 1 deletion src/Envelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Envelope::operator=(const Envelope &other) -> Envelope &
///
///


///
///
///
Expand Down
5 changes: 4 additions & 1 deletion src/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ namespace SFCGAL {

Exception::Exception() noexcept : _message("unknown exception") {}

Exception::Exception(std::string const &message) noexcept : _message(std::move(message)) {}
Exception::Exception(std::string const &message) noexcept
: _message(std::move(message))
{
}

Exception::~Exception() noexcept = default;

Expand Down
2 changes: 1 addition & 1 deletion src/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Geometry::geometryN(size_t const &n) -> Geometry &
///
///
///
Geometry::Geometry() = default;
Geometry::Geometry() = default;

auto
Geometry::hasValidityFlag() const -> bool
Expand Down
11 changes: 6 additions & 5 deletions src/Sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ template <class HDS>
class Sphere_builder : public CGAL::Modifier_base<HDS> {
public:
Sphere_builder(double radius, int num_vertical, int num_horizontal,
Point_3 center, const Kernel::Vector_3& direction)
Point_3 center, const Kernel::Vector_3 &direction)
: radius(radius), num_vertical(num_vertical),
num_horizontal(num_horizontal), center(std::move(center)),
direction(normalizeVector(direction))
Expand Down Expand Up @@ -51,8 +51,8 @@ class Sphere_builder : public CGAL::Modifier_base<HDS> {
{
if (vec.x() != 0 || vec.y() != 0) {
return Kernel::Vector_3(-vec.y(), vec.x(), 0);
} return Kernel::Vector_3(0, -vec.z(), vec.y());

}
return Kernel::Vector_3(0, -vec.z(), vec.y());
}

void
Expand Down Expand Up @@ -142,8 +142,9 @@ class Sphere_builder : public CGAL::Modifier_base<HDS> {
Sphere::Sphere(const Kernel::FT &radius, const Kernel::Point_3 &center,
int num_vertical, int num_horizontal,
const Kernel::Vector_3 &direction)
: m_radius(std::move(radius)), m_center(std::move(center)), m_num_vertical(num_vertical),
m_num_horizontal(num_horizontal), m_direction(normalizeVector(direction))
: m_radius(std::move(radius)), m_center(std::move(center)),
m_num_vertical(num_vertical), m_num_horizontal(num_horizontal),
m_direction(normalizeVector(direction))
{
}

Expand Down
17 changes: 8 additions & 9 deletions src/algorithm/buffer3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ Buffer3D::computeRoundBuffer() const -> std::unique_ptr<PolyhedralSurface>
SFCGAL::detail::MarkedPolyhedron out;
result.convert_to_polyhedron(out);
return std::make_unique<PolyhedralSurface>(out);
} // If _inputPoints is empty, return an empty PolyhedralSurface
return std::make_unique<PolyhedralSurface>();

} // If _inputPoints is empty, return an empty PolyhedralSurface
return std::make_unique<PolyhedralSurface>();
}

auto
Expand Down Expand Up @@ -200,7 +199,7 @@ Buffer3D::computeFlatBuffer() const -> std::unique_ptr<PolyhedralSurface>
{
std::vector<Kernel::Point_3> line_points;
line_points.reserve(_inputPoints.size());
for (const auto &p : _inputPoints) {
for (const auto &p : _inputPoints) {
line_points.emplace_back(p.x(), p.y(), p.z());
}

Expand Down Expand Up @@ -258,7 +257,7 @@ for (const auto &p : _inputPoints) {
rings.push_back(start_ring);
if (i == line_points.size() - 2) {
rings.push_back(end_ring);
}
}
}

// Add caps
Expand Down Expand Up @@ -286,7 +285,7 @@ for (const auto &p : _inputPoints) {

auto
Buffer3D::extend_point(const Kernel::Point_3 &point,
const Kernel::Vector_3 &direction, double distance) const
const Kernel::Vector_3 &direction, double distance) const
-> Kernel::Point_3
{
return point + direction * distance;
Expand All @@ -295,7 +294,7 @@ Buffer3D::extend_point(const Kernel::Point_3 &point,
auto
Buffer3D::create_circle_points(const Kernel::Point_3 &center,
const Kernel::Vector_3 &axis, double radius,
int segments) const
int segments) const
-> std::vector<Kernel::Point_3>
{
std::vector<Kernel::Point_3> points;
Expand All @@ -320,7 +319,7 @@ Buffer3D::create_circle_points(const Kernel::Point_3 &center,
auto
Buffer3D::compute_bisector_plane(const Kernel::Point_3 &p1,
const Kernel::Point_3 &p2,
const Kernel::Point_3 &p3) const
const Kernel::Point_3 &p3) const
-> Kernel::Plane_3
{
Kernel::Vector_3 v1 = normalizeVector(p2 - p1);
Expand All @@ -332,7 +331,7 @@ Buffer3D::compute_bisector_plane(const Kernel::Point_3 &p1,
auto
Buffer3D::intersect_segment_plane(const Kernel::Point_3 &p1,
const Kernel::Point_3 &p2,
const Kernel::Plane_3 &plane) const
const Kernel::Plane_3 &plane) const
-> Kernel::Point_3
{
Kernel::Vector_3 v = p2 - p1;
Expand Down
3 changes: 2 additions & 1 deletion src/algorithm/difference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ post_difference(const GeometrySet<2> &input, GeometrySet<2> &output)
}
}

output.surfaces().emplace_back(PolygonWH_2(outer, rings.begin(), rings.end()));
output.surfaces().emplace_back(
PolygonWH_2(outer, rings.begin(), rings.end()));
}

output.points() = input.points();
Expand Down
3 changes: 2 additions & 1 deletion src/algorithm/intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ post_intersection(const GeometrySet<2> &input, GeometrySet<2> &output)
}
}

output.surfaces().emplace_back(CGAL::Polygon_with_holes_2<Kernel>(outer, rings.begin(), rings.end()));
output.surfaces().emplace_back(
CGAL::Polygon_with_holes_2<Kernel>(outer, rings.begin(), rings.end()));
}

output.points() = input.points();
Expand Down
8 changes: 4 additions & 4 deletions src/algorithm/minkowskiSum3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ perpendicular_vector(const Kernel::Vector_3 &v) -> Kernel::Vector_3
{
if (v.x() != 0 || v.y() != 0) {
return Kernel::Vector_3(-v.y(), v.x(), 0);
} return Kernel::Vector_3(0, -v.z(), v.y());

}
return Kernel::Vector_3(0, -v.z(), v.y());
}

// Helper function to convert SFCGAL::Geometry to Nef_polyhedron_3
Expand Down Expand Up @@ -166,8 +166,8 @@ nefToGeometry(const Nef_polyhedron_3 &nef) -> std::unique_ptr<Geometry>
}

auto
minkowskiSum3D(const Geometry &gA, const Geometry &gB, NoValidityCheck /*unused*/)
-> std::unique_ptr<Geometry>
minkowskiSum3D(const Geometry &gA, const Geometry &gB,
NoValidityCheck /*unused*/) -> std::unique_ptr<Geometry>
{
if (gA.isEmpty() || gB.isEmpty()) {
return std::unique_ptr<Geometry>(new GeometryCollection());
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/straightSkeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ straightSkeletonPartition(const Polygon &g, bool /*autoOrientation*/)
// Skip the faces that correspond to holes
if (is_hole_face(face)) {
continue;
}
}

result->addGeometry(create_polygon_from_face(face));
}
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ class Handle {
}

void
swap(Handle &other)
noexcept {
swap(Handle &other) noexcept
{
(*_p)->_observers.erase(_p);
(*other._p)->_observers.erase(other._p);
std::swap(_p, other._p);
Expand Down
10 changes: 6 additions & 4 deletions src/detail/GeometrySet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ _decompose_polygon(const Polygon &poly,
for (size_t i = 0; i < surf.numTriangles(); ++i) {
const Triangle &tri = surf.triangleN(i);
surfaces.emplace_back(CGAL::Triangle_3<Kernel>(tri.vertex(0).toPoint_3(),
tri.vertex(1).toPoint_3(),
tri.vertex(2).toPoint_3()));
tri.vertex(1).toPoint_3(),
tri.vertex(2).toPoint_3()));
}
}

Expand Down Expand Up @@ -205,7 +205,8 @@ GeometrySet<2>::addPrimitive(const PrimitiveHandle<2> &p)
break;

case PrimitiveSurface:
_surfaces.emplace_back(*boost::get<const TypeForDimension<2>::Surface *>(p.handle));
_surfaces.emplace_back(
*boost::get<const TypeForDimension<2>::Surface *>(p.handle));
break;

default:
Expand All @@ -228,7 +229,8 @@ GeometrySet<3>::addPrimitive(const PrimitiveHandle<3> &p)
break;

case PrimitiveSurface:
_surfaces.emplace_back(*boost::get<const TypeForDimension<3>::Surface *>(p.handle));
_surfaces.emplace_back(
*boost::get<const TypeForDimension<3>::Surface *>(p.handle));
break;

case PrimitiveVolume: {
Expand Down
5 changes: 1 addition & 4 deletions src/detail/tools/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ Logger::setLogLevel(const Level &logLevel)
///
///
///
Logger::Logger(std::ostream &str)
: _out(str.rdbuf())
{
}
Logger::Logger(std::ostream &str) : _out(str.rdbuf()) {}

///
///
Expand Down
6 changes: 3 additions & 3 deletions src/io/wkt.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ namespace io {
* Read a WKT geometry from an input stream
*/
SFCGAL_API auto
readWkt(std::istream &s) -> std::unique_ptr<Geometry>;
readWkt(std::istream &s) -> std::unique_ptr<Geometry>;
/**
* Read a WKT geometry from a string
*/
SFCGAL_API auto
readWkt(const std::string &s) -> std::unique_ptr<Geometry>;
readWkt(const std::string &s) -> std::unique_ptr<Geometry>;
/**
* Read a WKT geometry from a char*
*/
SFCGAL_API auto
readWkt(const char *, size_t) -> std::unique_ptr<Geometry>;
readWkt(const char *, size_t) -> std::unique_ptr<Geometry>;
} // namespace io
} // namespace SFCGAL

Expand Down
9 changes: 3 additions & 6 deletions test/regress/convex_hull/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ main(int argc, char *argv[]) -> int
std::cout.width(12);
boost::chrono::duration<double> const elapsed =
boost::chrono::system_clock::now() - start;
std::cout << std::left << lineNumber << "(" << elapsed << " s)"
<< '\n';
std::cout << std::left << lineNumber << "(" << elapsed << " s)" << '\n';
}

std::vector<std::string> tokens;
Expand Down Expand Up @@ -176,8 +175,7 @@ main(int argc, char *argv[]) -> int
hull3D = algorithm::convexHull3D(*g);
failed = false;
} catch (Exception &e) {
std::cerr << "[Exception]" << id << "|" << e.what() << "|" << wkt
<< '\n';
std::cerr << "[Exception]" << id << "|" << e.what() << "|" << wkt << '\n';
} catch (std::exception &e) {
std::cerr << "[std::exception]" << id << "|" << e.what() << "|" << wkt
<< '\n';
Expand All @@ -202,8 +200,7 @@ main(int argc, char *argv[]) -> int
boost::chrono::duration<double> const elapsed =
boost::chrono::system_clock::now() - start;
std::cout << filename << " complete (" << elapsed << " s)---" << '\n';
std::cout << numFailed << " failed /" << (numFailed + numSuccess)
<< '\n';
std::cout << numFailed << " failed /" << (numFailed + numSuccess) << '\n';

if (numFailed == 0) {
// delete empty error file
Expand Down
6 changes: 2 additions & 4 deletions test/regress/polygon_triangulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ main(int argc, char *argv[]) -> int
std::cout.width(12);
boost::chrono::duration<double> const elapsed =
boost::chrono::system_clock::now() - start;
std::cout << std::left << lineNumber << "(" << elapsed << " s)"
<< '\n';
std::cout << std::left << lineNumber << "(" << elapsed << " s)" << '\n';
}

std::vector<std::string> tokens;
Expand Down Expand Up @@ -254,8 +253,7 @@ main(int argc, char *argv[]) -> int
}

std::cout << filename << " complete (" << elapsed << " s)---" << '\n';
std::cout << numFailed << " failed /" << (numFailed + numSuccess)
<< '\n';
std::cout << numFailed << " failed /" << (numFailed + numSuccess) << '\n';

if (numFailed == 0) {
// delete empty error file
Expand Down
6 changes: 2 additions & 4 deletions test/unit/SFCGAL/algorithm/Buffer3DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ BOOST_AUTO_TEST_CASE(testBuffer3D_Point)

// Check if the expected file exists
if (!fs::exists(expectedFile)) {
std::cout << "Expected file does not exist: " << expectedFile
<< '\n';
std::cout << "Expected file does not exist: " << expectedFile << '\n';
continue;
}

Expand Down Expand Up @@ -186,8 +185,7 @@ BOOST_AUTO_TEST_CASE(testBuffer3D_LineString)

// Check if the expected file exists
if (!fs::exists(expectedFile)) {
std::cout << "Expected file does not exist: " << expectedFile
<< '\n';
std::cout << "Expected file does not exist: " << expectedFile << '\n';
continue;
}

Expand Down
3 changes: 1 addition & 2 deletions test/unit/SFCGAL/io/OBJTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ BOOST_AUTO_TEST_CASE(test_all_geometries)

// Check if the expected file exists
if (!fs::exists(expectedFile)) {
std::cout << "Expected file does not exist: " << expectedFile
<< '\n';
std::cout << "Expected file does not exist: " << expectedFile << '\n';
continue;
}

Expand Down
3 changes: 1 addition & 2 deletions test/unit/SFCGAL/io/VTKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ BOOST_AUTO_TEST_CASE(test_all_geometries)

// Check if the expected file exists
if (!fs::exists(expectedFile)) {
std::cout << "Expected file does not exist: " << expectedFile
<< '\n';
std::cout << "Expected file does not exist: " << expectedFile << '\n';
// continue;
}

Expand Down

0 comments on commit 4717121

Please sign in to comment.