Skip to content

Commit

Permalink
[共通] fix #1114
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Nov 13, 2023
1 parent 7239925 commit d0deedb
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 113 deletions.
27 changes: 18 additions & 9 deletions Siv3D/include/Siv3D/Subdivision2D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,32 @@ namespace s3d
constexpr bool isfree() const noexcept;
};

Array<Vertex> m_vertices;
struct Internal
{
Array<Vertex> vertices;

Array<QuadEdge> qEdges;

size_t addedPoints = 0;

size_t m_addedPoints = 0;
int32 freeQEdge = 0;

Array<QuadEdge> m_qEdges;
int32 freePoint = 0;

int32 m_freeQEdge = 0;
bool validGeometry = false;

int32 m_freePoint = 0;
int32 recentEdge = 0;

bool m_validGeometry = false;
RectF rect = RectF::Empty();

int32 m_recentEdge = 0;
Vec2 bottomRight = Vec2::Zero();

[[nodiscard]]
constexpr bool isEmpty() const noexcept;

RectF m_rect = RectF{ 0, 0 };
void clear() noexcept;

Vec2 m_bottomRight = Vec2{ 0, 0 };
} m_internal;

Subdivision2DPointLocation locate(const Vec2& pt, int32& _edge, int32& _vertex);

Expand Down
9 changes: 7 additions & 2 deletions Siv3D/include/Siv3D/detail/Subdivision2D.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ namespace s3d
{
inline bool Subdivision2D::isEmpty() const noexcept
{
return (m_addedPoints == 0);
return m_internal.isEmpty();
}

inline Subdivision2D::operator bool() const noexcept
{
return (m_addedPoints != 0);
return (not m_internal.isEmpty());
}

inline constexpr Subdivision2D::Vertex::Vertex(const Vec2& _pt, const bool _isvirtual, const int32 _firstEdge)
Expand Down Expand Up @@ -51,4 +51,9 @@ namespace s3d
{
return (next[0] <= 0);
}

inline constexpr bool Subdivision2D::Internal::isEmpty() const noexcept
{
return (addedPoints == 0);
}
}
Loading

0 comments on commit d0deedb

Please sign in to comment.