Skip to content

Commit

Permalink
src/hole: add unsigned integral value support
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Aug 12, 2024
1 parent 8db5d92 commit bbc6b4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/hole-cut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ template<typename T> Cr<T> CutResult<T>::cutʹ(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h
return cut_rectangleʹ<T>(r0, r1, h0, h1, s);
}

template<typename T> Cr<T> CutResult<T>::cut(bbox input, bbox hole) { return cut_rectangle<T>(input, hole); }
template<typename T> Cr<T> CutResult<T>::cut(bbox input, bbox hole) requires std::is_signed_v<T> { return cut_rectangle<T>(input, hole); }
template<typename T> Cr<T> CutResult<T>::cut(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1) { return cut_rectangle<T>(r0, r1, h0, h1); }

template<typename T> bool CutResult<T>::found() const { return s != (uint8_t)-1; }

template struct CutResult<Int>;
template struct CutResult<uint32_t>;
template struct CutResult<int32_t>;
template struct CutResult<float>;

} // namespace floormat
2 changes: 1 addition & 1 deletion src/hole-cut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct CutResult
struct bbox { Vec2 position; Vector2ub bbox_size; };
struct rect { Vec2 min, max; };

static CutResult cut(bbox input, bbox hole);
static CutResult cut(bbox input, bbox hole) requires std::is_signed_v<T>;
static CutResult cut(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1);
static CutResult cutʹ(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1, uint8_t s);

Expand Down

0 comments on commit bbc6b4c

Please sign in to comment.