InDesign团花插件 📅 2026/8/10 8:21:40 团花的算法很简单就是笛卡尔坐标转一个极坐标做一下sin和cos运算。整个转换函数还不到余弦线贝塞尔曲线算法的一半。PMPathPointList ToolsUtils::ConvertSineWaveToCircle(const PMPathPointList inPointsori, bool closePath, bool startAtTop) { const double kTwoPi 6.283185307179586476925286766559; PMPathPointList outPoints; int32 n inPointsori.size(); if (n 2) { return outPoints; } PMPathPointList inPoints inPointsori; PMReal circumference abs(inPoints[0].GetAnchorPoint().X() - inPoints[n - 1].GetAnchorPoint().X()); if (circumference 0.0) { return outPoints; } PMReal R circumference / kTwoPi; PMReal angleOffset startAtTop ? (kTwoPi / 4.0) : 0.0; auto mapPoint [](const PMPoint p) - PMPoint { PMReal x p.X(); PMReal y p.Y(); PMReal theta (x / R) - angleOffset; PMReal r R y; PMReal newX r * std::cos(ToDouble(theta)); PMReal newY r * std::sin(ToDouble(theta)); return PMPoint(newX, newY); }; bool mergeEndpoints closePath (inPoints[n - 1].GetAnchorPoint().X() inPoints[0].GetAnchorPoint().X() || n - 1 0); int32 count closePath ? (n - 1) : n; outPoints.reserve(count); for (int32 i 0; i count; i) { const PMPathPoint src inPoints[i]; PMPoint newAnchor mapPoint(src.GetAnchorPoint()); PMPoint newLeft mapPoint(src.GetLeftDirPoint()); PMPoint newRight mapPoint(src.GetRightDirPoint()); outPoints.push_back(PMPathPoint(newLeft, newAnchor, newRight)); } if (closePath n 2) { const PMPathPoint lastSrc inPoints[n - 1]; PMPoint mappedLeftOfLast mapPoint(lastSrc.GetLeftDirPoint()); PMPathPoint newFirst outPoints[0]; newFirst.SetLeftDirPoint(mappedLeftOfLast); outPoints[0] newFirst; } PMPoint dtpt inPoints[0].GetAnchorPoint() - outPoints[0].GetAnchorPoint(); for (auto pt : outPoints) { pt.SetAnchorPoint(pt.GetAnchorPoint() dtpt); pt.SetRightDirPoint(pt.GetRightDirPoint() dtpt); pt.SetLeftDirPoint(pt.GetLeftDirPoint() dtpt); } return outPoints; }这是把周期曲线点转极坐标的c函数。这个功能可以自定义线条去做团花图案纯贝塞尔曲线不是点线。团花自定义线条需要开放线条且首尾点纵坐标相同下载地址链接: https://pan.baidu.com/s/17ih5cdLGloJhwiAGyaaWyw 提取码: a5pv