-
Notifications
You must be signed in to change notification settings - Fork 395
Open
Description
when iterating over NSVGpath and reading path->pts, I only get linear points approximating the curves. How can I access the actual Bezier curves or get curved path data instead of just linearized points?"
// Iterate over shapes
for (NSVGshape* shape = image->shapes; shape; shape = shape->next) {
// Separate tessellator for each shape to avoid connecting them
TESStesselator* tessellator = tessNewTess(nullptr);
if (!tessellator) {
qWarning() << "Failed to create tessellator";
return;
}
std::vector <std::vector<float>> tempVector;
// Iterate over paths in the shape
for (NSVGpath* path = shape->paths; path; path = path->next) {
std::vector<float> vecPoints;
for (int i = 0; i < path->npts; ++i) {
// Push x and y coordinates into outlinePoints
vecPoints.push_back(path->pts[i * 2]); // x-coordinate
vecPoints.push_back(path->pts[i * 2 + 1]); // y-coordinate
vecPoints.push_back(0.0);
}
tempVector.push_back(vecPoints);
tessellatePath(tessellator, path);
}
Metadata
Metadata
Assignees
Labels
No labels