https://issues.apache.org/ooo/show_bug.cgi?id=115917
--- Comment #6 from Armin Le Grand <[email protected]> --- ALG: And again: For C1, mediating direction weighted by length may be even better, this gives vector addition to get the common direction. This leads to unification of calculating the common direction for C1 and C2 cases for correction. Proposed code: // extract the point and vectors const basegfx::B2DPoint aPoint(roPolygon.getB2DPoint(nIndex)); const basegfx::B2DVector aNext(roPolygon.getNextControlPoint(nIndex) - aPoint); const basegfx::B2DVector aPrev(aPoint - roPolygon.getPrevControlPoint(nIndex)); // calculate common direction vector, normalize basegfx::B2DVector aDirection(aNext + aPrev); aDirection.normalize(); if(POLY_SMOOTH == nCFlag) { // C1: use common direction vector, preserve individual lengths roPolygon.setNextControlPoint(nIndex, basegfx::B2DPoint(aPoint + (aDirection * aNext.getLength()))); roPolygon.setPrevControlPoint(nIndex, basegfx::B2DPoint(aPoint - (aDirection * aPrev.getLength()))); } else // POLY_SYMMTR { // C2: get mediated length. Taking half of the unnormalized direction would be // an approximation, but not correct. Create common vector in direction next. const double fMedLength((aNext.getLength() + aPrev.getLength()) * 0.5); const basegfx::B2DVector aCommonNext(aDirection * fMedLength); // use common vector roPolygon.setNextControlPoint(nIndex, basegfx::B2DPoint(aPoint + aCommonNext)); roPolygon.setPrevControlPoint(nIndex, basegfx::B2DPoint(aPoint - aCommonNext)); } -- You are receiving this mail because: You are on the CC list for the bug.
