11#ifndef JAU_GAMP_GRAPH_TESS_IMPL_CDTesselator2D_HPP_
12#define JAU_GAMP_GRAPH_TESS_IMPL_CDTesselator2D_HPP_
50 size_t m_addedVerticeCount;
57 : complexShape(false) {
reset(); }
61 constexpr void reset() noexcept {
63 m_addedVerticeCount = 0;
87 if (innerPoly->graphPoints().size() >= 3) {
90 loops.push_back(loop);
125 loop->addConstraintCurveHole(innerPoly);
130 size_t loopsSize = loops.size();
133 for (
size_t i = 0; i < loopsSize; i++) {
136 size = loop->computeLoopSize();
138 while (!loop->isSimplex()) {
141 if (numTries > size) {
142 tri = loop->cut(
false);
145 tri = loop->cut(
true);
151 tri->id() = m_maxTriID++;
159 if (numTries > size * 2) {
169 tri->id() = m_maxTriID++;
182 size_t size = outVertices.size();
184 for (
size_t i = 0; i < size; i++) {
189 if (!gv1->vertex().onCurve()) {
190 Vertex v0 = gv0->vertex().clone();
192 Vertex v1 = gv1->vertex().clone();
193 m_addedVerticeCount += 3;
195 boundaryVertices.
put(0,
true);
196 boundaryVertices.
put(1,
true);
197 boundaryVertices.
put(2,
true);
199 gv0->setBoundaryContained(
true);
200 gv1->setBoundaryContained(
true);
201 gv2->setBoundaryContained(
true);
204 if (hole || holeLike) {
208 innerOutline->addVertex(gv1);
220 t->id() = m_maxTriID++;
226 if( !gv2->vertex().onCurve() || !gv0->vertex().onCurve() ) {
227 gv1->setBoundaryContained(
true);
229 innerOutline->addVertex(gv1);
238 impl::LoopRef getContainerLoop(
const Outline& polyline)
const noexcept {
239 size_t count = loops.size();
241 const VertexList &vertices = polyline.vertices();
243 for (
size_t j = 0;
j < vertices.
size(); ++
j) {
244 if (loop->checkInside(vertices[j])) {
Define a single continuous stroke by control vertices.
void setWinding(Winding enforce)
Sets Winding to this outline.
Winding getWinding() const noexcept
Returns the cached or computed winding of this Outlines polyline using VectorUtil#area(ArrayList).
static TriangleRef create(const Vertex &v1, const Vertex &v2, const Vertex &v3, const tribit_t &boundaryVertices) noexcept
jau::bitfield_t< uint8_t, 3 > tribit_t
constexpr Vertex clone() const noexcept
constexpr const Vec3f & texCoord() const noexcept
constexpr const Vec3f & coord() const noexcept
void addCurve(TriangleRefList &sink, Outline &polyline, float sharpness)
constexpr void reset() noexcept
void generate(TriangleRefList &sink)
constexpr CDTriangulator2D() noexcept
Constructor for a new Delaunay triangulator.
constexpr void setComplexShape(bool complex) noexcept
constexpr size_t getAddedVerticeCount() const noexcept
static constexpr bool FixedWindingRule
static GraphOutlineRef create()
static constexpr bool FixedWindingRule
static LoopRef createBoundary(const GraphOutlineRef &polyline, bool isConvex)
constexpr bool put(size_type bitpos, bool v) noexcept
Writes the bit value v to position bitpos into this storage.
constexpr size_type size() const noexcept
Like std::vector::size().
constexpr void push_back(const value_type &x)
Like std::vector::push_back(), copy.
#define WARN_PRINT(...)
Use for unconditional warning messages, prefix '[elapsed_time] Warning @ FILE:LINE FUNC: '.
std::shared_ptr< Loop > LoopRef
std::shared_ptr< GraphOutline > GraphOutlineRef
std::vector< GraphVertexRef > GraphVertexRefList
std::shared_ptr< GraphVertex > GraphVertexRef
std::vector< LoopRef > LoopRefList
jau::darray< Vertex, uint32_t > VertexList
std::shared_ptr< Triangle > TriangleRef
jau::darray< TriangleRef, uint32_t > TriangleRefList
constexpr bool is2DCCW(const Vec3f &a, const Vec3f &b, const Vec3f &c) noexcept
Check if points are in ccw order.
std::string to_string(const math_error_t v) noexcept
Returns std::string representation of math_error_t.
void PLAIN_PRINT(const bool printPrefix, const char *format,...) noexcept
Use for unconditional plain messages, prefix '[elapsed_time] ' if printPrefix == true.
void print_backtrace(const bool skip_anon_frames, const jau::snsize_t max_frames=-1, const jau::snsize_t skip_frames=2) noexcept
Prints the de-mangled backtrace string separated by newline excluding this function to stderr,...