Skip to content

Commit

Permalink
apply clang-format15
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Oct 31, 2023
1 parent 8d8c629 commit 0d09943
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 50 deletions.
3 changes: 1 addition & 2 deletions src/Coordinate.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ class SFCGAL_API Coordinate {
toPoint_3() const;

// class for Empty coordinate
class Empty {
};
class Empty {};

private:
boost::variant<Empty, Kernel::Point_2, Kernel::Point_3> _storage;
Expand Down
3 changes: 1 addition & 2 deletions src/algorithm/intersects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ intersects(const PrimitiveHandle<Dim> &pa, const PrimitiveHandle<Dim> &pb)
return dispatch_intersects_sym(pa, pb);
}

struct found_an_intersection {
};
struct found_an_intersection {};

template <int Dim>
struct intersects_cb {
Expand Down
3 changes: 1 addition & 2 deletions src/algorithm/isValid.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ propagateValidityFlag(Geometry &g, bool valid);
* Tag used for variants of algorithm that do not do validity check
* @ingroup public_api
*/
struct NoValidityCheck {
};
struct NoValidityCheck {};

} // namespace algorithm
} // namespace SFCGAL
Expand Down
8 changes: 4 additions & 4 deletions src/algorithm/lineSubstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ lineSubstring(const LineString &ls, double start, double end)
bool on_end = false;
double len_to_end_idx = 0.0;
Point pend = find_position(
ls, N, len * end, len_to_start_idx, tol, false // Find end.
,
end_idx, end_frac, on_end, len_to_end_idx // This result is not used.
);
ls, N, len * end, len_to_start_idx, tol, false // Find end.
,
end_idx, end_frac, on_end, len_to_end_idx // This result is not used.
);

if (reverse && closed) {
// For closed lines we always want to follow the
Expand Down
41 changes: 20 additions & 21 deletions src/algorithm/partition_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ polygons_to_geometry(const std::list<TPolygon_2> &polys)
}

auto
partition_2(const Geometry &g, PartitionAlgorithm alg)
partition_2(const Geometry &g, PartitionAlgorithm alg)
-> std::unique_ptr<Geometry>
{
using CGAL::object_cast;
Expand All @@ -97,26 +97,25 @@ partition_2(const Geometry &g, PartitionAlgorithm alg)
const TPolygon_2 poly{toTPolygon_2(g.as<Polygon>())};

std::list<TPolygon_2> partition_polys;
switch(alg) {
case y_monotone:
y_monotone_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case optimal_convex:
optimal_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case greene_approx_convex:
greene_approx_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case approx_convex:
approx_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
default:
break;

switch (alg) {
case y_monotone:
y_monotone_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case optimal_convex:
optimal_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case greene_approx_convex:
greene_approx_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
case approx_convex:
approx_convex_partition_2(poly.vertices_begin(), poly.vertices_end(),
std::back_inserter(partition_polys));
break;
default:
break;
}
return polygons_to_geometry(partition_polys);
}
Expand Down
21 changes: 14 additions & 7 deletions src/algorithm/partition_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ namespace algorithm {
* @ingroup public_api
* @since 1.4.2
*/
enum PartitionAlgorithm { y_monotone, /*!< Y Monotone Partition: https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_monotone */
approx_convex, /*!< Simple approximation algorithm of Hertel and Mehlhorn https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex */
greene_approx_convex, /*!< Sweep-line approximation algorithm of Greene https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex */
optimal_convex /*!< Optimal convex partition https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex */
enum PartitionAlgorithm {
y_monotone, /*!< Y Monotone Partition:
https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_monotone
*/
approx_convex, /*!< Simple approximation algorithm of Hertel and Mehlhorn
https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex
*/
greene_approx_convex, /*!< Sweep-line approximation algorithm of Greene
https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex
*/
optimal_convex /*!< Optimal convex partition
https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex
*/
};

/**
Expand All @@ -30,12 +39,10 @@ enum PartitionAlgorithm { y_monotone, /*!< Y Monotone Partition: https://doc.cga
* @since 1.4.2
*/
SFCGAL_API auto
partition_2(const Geometry &g, PartitionAlgorithm alg = y_monotone )
partition_2(const Geometry &g, PartitionAlgorithm alg = y_monotone)
-> std::unique_ptr<Geometry>;


} // namespace algorithm
} // namespace SFCGAL


#endif
5 changes: 2 additions & 3 deletions src/algorithm/plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <boost/format.hpp>

//#include <SFCGAL/detail/ublas.h>
// #include <SFCGAL/detail/ublas.h>

#include <SFCGAL/Exception.h>
#include <SFCGAL/Polygon.h>
Expand Down Expand Up @@ -97,8 +97,7 @@ plane3D(const Polygon &polygon)
nrml);
}

struct Plane3DInexactUnsafe {
};
struct Plane3DInexactUnsafe {};

/**
* Returns the oriented 3D plane of a polygon (supposed to be planar) - inexact
Expand Down
6 changes: 2 additions & 4 deletions src/algorithm/union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ namespace SFCGAL {

namespace algorithm {

struct EmptyPrimitive {
};
struct EmptyPrimitive {};

enum PrimitiveType {
PrimitivePoint = 0,
Expand Down Expand Up @@ -93,8 +92,7 @@ struct Segment_d : detail::Segment_d<Dim>::Type {
};

template <int Dim>
struct Surface_d {
};
struct Surface_d {};

template <>
struct Surface_d<3> : Triangle_3 {
Expand Down
3 changes: 1 addition & 2 deletions src/detail/TypeForDimension.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ namespace detail {
/// TypeForKernel<K, 2>::Point is equivalent to CGAL::Point_2<K> for instance
/// TypeForDimension<2>::Bbox is equivalent to CGAL::Bbox_2

struct SFCGAL_API NoVolume {
};
struct SFCGAL_API NoVolume {};

///
/// Generic traits, default dimension is 2
Expand Down
6 changes: 3 additions & 3 deletions src/detail/io/WkbReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ WkbReader::readInnerGeometryCollection() -> GeometryCollection
const uint32_t numGeoms{read<uint32_t>()};
for (uint32_t i = 0; i < numGeoms; ++i) {
readWkb();
if(_geometry.get() != nullptr) {
if (_geometry.get() != nullptr) {
result.addGeometry(_geometry.release());
}
}
Expand All @@ -185,7 +185,7 @@ WkbReader::readInnerTriangulatedSurface() -> TriangulatedSurface
const uint32_t numGeoms{read<uint32_t>()};
for (uint32_t i = 0; i < numGeoms; ++i) {
readWkb();
if(_geometry.get() != nullptr) {
if (_geometry.get() != nullptr) {
SFCGAL::Triangle geom{_geometry->as<SFCGAL::Triangle>()};
result.addTriangle(geom);
}
Expand All @@ -208,7 +208,7 @@ WkbReader::readInnerPolyhedralSurface() -> PolyhedralSurface
const uint32_t numGeoms{read<uint32_t>()};
for (uint32_t i = 0; i < numGeoms; ++i) {
readWkb();
if(_geometry.get() != nullptr) {
if (_geometry.get() != nullptr) {
geoms.push_back(_geometry->as<SFCGAL::Polygon>());
}
}
Expand Down

0 comments on commit 0d09943

Please sign in to comment.