mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 15:44:12 -06:00
Fix for incorrect inside check of fixed items.
libnest2d: Add dispatched overloads for offsetting different shapes.
This commit is contained in:
parent
6ae50a710a
commit
72ed8c034e
3 changed files with 53 additions and 15 deletions
|
@ -71,7 +71,8 @@ template<> inline ClipperLib::cInt& y(PointImpl& p)
|
|||
|
||||
namespace shapelike {
|
||||
|
||||
template<> inline void offset(PolygonImpl& sh, TCoord<PointImpl> distance)
|
||||
template<>
|
||||
inline void offset(PolygonImpl& sh, TCoord<PointImpl> distance, const PolygonTag&)
|
||||
{
|
||||
#define DISABLE_BOOST_OFFSET
|
||||
|
||||
|
@ -123,6 +124,14 @@ template<> inline void offset(PolygonImpl& sh, TCoord<PointImpl> distance)
|
|||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void offset(PathImpl& sh, TCoord<PointImpl> distance, const PathTag&)
|
||||
{
|
||||
PolygonImpl p(std::move(sh));
|
||||
offset(p, distance, PolygonTag());
|
||||
sh = p.Contour;
|
||||
}
|
||||
|
||||
// Tell libnest2d how to make string out of a ClipperPolygon object
|
||||
template<> inline std::string toString(const PolygonImpl& sh)
|
||||
{
|
||||
|
|
|
@ -507,15 +507,13 @@ enum class Formats {
|
|||
namespace shapelike {
|
||||
|
||||
template<class S>
|
||||
inline S create(const TContour<S>& contour,
|
||||
const THolesContainer<S>& holes)
|
||||
inline S create(const TContour<S>& contour, const THolesContainer<S>& holes)
|
||||
{
|
||||
return S(contour, holes);
|
||||
}
|
||||
|
||||
template<class S>
|
||||
inline S create(TContour<S>&& contour,
|
||||
THolesContainer<S>&& holes)
|
||||
inline S create(TContour<S>&& contour, THolesContainer<S>&& holes)
|
||||
{
|
||||
return S(contour, holes);
|
||||
}
|
||||
|
@ -727,11 +725,18 @@ inline void translate(S& /*sh*/, const P& /*offs*/)
|
|||
}
|
||||
|
||||
template<class S>
|
||||
inline void offset(S& /*sh*/, TCoord<TPoint<S>> /*distance*/)
|
||||
inline void offset(S& /*sh*/, TCoord<S> /*distance*/, const PathTag&)
|
||||
{
|
||||
dout() << "The current geometry backend does not support offsetting!\n";
|
||||
}
|
||||
|
||||
template<class S>
|
||||
inline void offset(S& sh, TCoord<S> distance, const PolygonTag&)
|
||||
{
|
||||
offset(contour(sh), distance);
|
||||
for(auto &h : holes(sh)) offset(h, -distance);
|
||||
}
|
||||
|
||||
template<class S>
|
||||
inline std::pair<bool, std::string> isValid(const S& /*sh*/)
|
||||
{
|
||||
|
@ -1228,6 +1233,23 @@ template<class S> inline bool isConvex(const S& sh) // dispatch
|
|||
return isConvex(sh, Tag<S>());
|
||||
}
|
||||
|
||||
template<class Box> inline void offset(Box& bb, TCoord<Box> d, const BoxTag&)
|
||||
{
|
||||
TPoint<Box> md{d, d};
|
||||
bb.minCorner() -= md;
|
||||
bb.maxCorner() += md;
|
||||
}
|
||||
|
||||
template<class C> inline void offset(C& circ, TCoord<C> d, const CircleTag&)
|
||||
{
|
||||
circ.radius(circ.radius() + double(d));
|
||||
}
|
||||
|
||||
// Dispatch function
|
||||
template<class S> inline void offset(S& sh, TCoord<S> d) {
|
||||
offset(sh, d, Tag<S>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define DECLARE_MAIN_TYPES(T) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue