Skip to content

Commit

Permalink
Minor tweak to CMakeLists.txt (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusJohnson committed Dec 21, 2023
1 parent 348e9c4 commit 76fa070
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CPP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ endif ()

include(GNUInstallDirs)
set(CLIPPER2_INC_FOLDER ${PROJECT_SOURCE_DIR}/Clipper2Lib/include/clipper2)
configure_file(clipper.version.in ${CLIPPER2_INC_FOLDER}/clipper.version.h)
configure_file(clipper.version.in
${CLIPPER2_INC_FOLDER}/clipper.version.h NEWLINE_STYLE UNIX)

set(CLIPPER2_INC
${CLIPPER2_INC_FOLDER}/clipper.h
Expand Down
10 changes: 5 additions & 5 deletions CPP/Clipper2Lib/include/clipper2/clipper.core.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ namespace Clipper2Lib
return Area<T>(poly) >= 0;
}

#if CLIPPER2_HI_PRECISION
#if CLIPPER2_HI_PRECISION
// caution: this will compromise performance
// https://github.com/AngusJohnson/Clipper2/issues/317#issuecomment-1314023253
// See also CPP/BenchMark/GetIntersectPtBenchmark.cpp
Expand All @@ -756,9 +756,9 @@ namespace Clipper2Lib
T bb1maxy = CC_MAX(ln2a.y, ln2b.y);
T originx = (CC_MIN(bb0maxx, bb1maxx) + CC_MAX(bb0minx, bb1minx)) >> 1;
T originy = (CC_MIN(bb0maxy, bb1maxy) + CC_MAX(bb0miny, bb1miny)) >> 1;
double ln0c = (ln1dy * static_cast<double>(ln1a.x - originx)) +
double ln0c = (ln1dy * static_cast<double>(ln1a.x - originx)) +
(ln1dx * static_cast<double>(ln1a.y - originy));
double ln1c = (ln2dy * static_cast<double>(ln2a.x - originx)) +
double ln1c = (ln2dy * static_cast<double>(ln2a.x - originx)) +
(ln2dx * static_cast<double>(ln2a.y - originy));
double hitx = ((ln1dx * ln1c) - (ln2dx * ln0c)) / det;
double hity = ((ln2dy * ln0c) - (ln1dy * ln1c)) / det;
Expand All @@ -774,7 +774,7 @@ namespace Clipper2Lib
}
return true;
}
#else
#else
template<typename T>
inline bool GetIntersectPoint(const Point<T>& ln1a, const Point<T>& ln1b,
const Point<T>& ln2a, const Point<T>& ln2b, Point<T>& ip)
Expand All @@ -788,7 +788,7 @@ namespace Clipper2Lib
double det = dy1 * dx2 - dy2 * dx1;
if (det == 0.0) return false;
double t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det;
if (t <= 0.0) ip = ln1a;
if (t <= 0.0) ip = ln1a;
else if (t >= 1.0) ip = ln1b;
else
{
Expand Down
10 changes: 5 additions & 5 deletions CPP/Clipper2Lib/include/clipper2/clipper.engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Clipper2Lib {

//Note: all clipping operations except for Difference are commutative.
enum class ClipType { None, Intersection, Union, Difference, Xor };

enum class PathType { Subject, Clip };
enum class JoinWith { None, Left, Right };

Expand Down Expand Up @@ -106,7 +106,7 @@ namespace Clipper2Lib {
//Important: UP and DOWN here are premised on Y-axis positive down
//displays, which is the orientation used in Clipper's development.
///////////////////////////////////////////////////////////////////

struct Active {
Point64 bot;
Point64 top;
Expand Down Expand Up @@ -251,7 +251,7 @@ namespace Clipper2Lib {
void JoinOutrecPaths(Active &e1, Active &e2);
void FixSelfIntersects(OutRec* outrec);
void DoSplitOp(OutRec* outRec, OutPt* splitOp);

inline void AddTrialHorzJoin(OutPt* op);
void ConvertHorzSegsToJoins();
void ProcessHorzJoins();
Expand Down Expand Up @@ -331,7 +331,7 @@ namespace Clipper2Lib {
unsigned lvl = Level();
//Even levels except level 0
return lvl && !(lvl & 1);
}
}
};

typedef typename std::vector<std::unique_ptr<PolyPath64>> PolyPath64List;
Expand Down Expand Up @@ -420,7 +420,7 @@ namespace Clipper2Lib {

void SetScale(double value) { scale_ = value; }
double Scale() const { return scale_; }

PolyPathD* AddChild(const Path64& path) override
{
int error_code = 0;
Expand Down
12 changes: 6 additions & 6 deletions CPP/Clipper2Lib/src/clipper.offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int GetLowestClosedPathIdx(std::vector<Rect64>& boundsList)
int i = -1, result = -1;
Point64 botPt = Point64(INT64_MAX, INT64_MIN);
for (const Rect64& r : boundsList)
{
{
++i;
if (!r.IsValid()) continue; // ignore invalid paths
else if (r.bottom > botPt.y || (r.bottom == botPt.y && r.left < botPt.x))
Expand Down Expand Up @@ -103,7 +103,7 @@ inline double Hypot(double x, double y)
}

inline PointD NormalizeVector(const PointD& vec)
{
{
double h = Hypot(vec.x, vec.y);
if (AlmostZero(h)) return PointD(0,0);
double inverseHypot = 1 / h;
Expand Down Expand Up @@ -358,7 +358,7 @@ void ClipperOffset::OffsetPoint(Group& group, const Path64& path, size_t j, size
// is concave
path_out.push_back(GetPerpendic(path[j], norms[k], group_delta_));
// this extra point is the only (simple) way to ensure that
// path reversals are fully cleaned with the trailing clipper
// path reversals are fully cleaned with the trailing clipper
path_out.push_back(path[j]); // (#405)
path_out.push_back(GetPerpendic(path[j], norms[j], group_delta_));
}
Expand Down Expand Up @@ -394,7 +394,7 @@ void ClipperOffset::OffsetOpenJoined(Group& group, const Path64& path)
OffsetPolygon(group, path);
Path64 reverse_path(path);
std::reverse(reverse_path.begin(), reverse_path.end());

//rebuild normals // BuildNormals(path);
std::reverse(norms.begin(), norms.end());
norms.push_back(norms[0]);
Expand All @@ -408,7 +408,7 @@ void ClipperOffset::OffsetOpenPath(Group& group, const Path64& path)
{
// do the line start cap
if (deltaCallback64_) group_delta_ = deltaCallback64_(path, norms, 0, 0);

if (std::fabs(group_delta_) <= floating_point_tolerance)
path_out.push_back(path[0]);
else
Expand All @@ -426,7 +426,7 @@ void ClipperOffset::OffsetOpenPath(Group& group, const Path64& path)
break;
}
}

size_t highI = path.size() - 1;
// offset the left side going forward
for (Path64::size_type j = 1, k = 0; j < highI; k = j, ++j)
Expand Down

0 comments on commit 76fa070

Please sign in to comment.