//----------------------------------------------------------------------- Shape CatmullRomSpline2::realizeShape() { Shape shape; unsigned int numPoints = mClosed ? mPoints.size() : (mPoints.size() - 1); for (unsigned int i = 0; i < numPoints; ++i) { const Vector2& P1 = safeGetPoint(i-1); const Vector2& P2 = safeGetPoint(i); const Vector2& P3 = safeGetPoint(i+1); const Vector2& P4 = safeGetPoint(i+2); computeCatmullRomPoints(P1, P2, P3, P4, mNumSeg, shape.getPointsReference()); if (i == mPoints.size() - 2 && !mClosed) { shape.addPoint(P3); } } if (mClosed) shape.close(); shape.setOutSide(mOutSide); return shape; }
void realizeCatMul(vector<CircleShape>&points,int segments, VertexArray&lines){ if(segments<1) { cons->put("segment<1"); return; } unsigned int numPoints = points.size(); if(numPoints<4) return; // console.put("---"); for (unsigned int i=0; i < numPoints; ++i) { const Vec2& P1 = points[(i )%points.size()].getPosition(); const Vec2& P2 = points[(i+1)%points.size()].getPosition(); const Vec2& P3 = points[(i+2)%points.size()].getPosition(); const Vec2& P4 = points[(i+3)%points.size()].getPosition(); computeCatmullRomPoints(P1, P2, P3, P4, segments, lines); } }