Oops, was always writing SVG or EPS arcs counter-clockwise; which

breaks with the new path stuff, since circular holes really do have
to go ccw. So fix that.

[git-p4: depot-paths = "//depot/solvespace/": change = 2062]
solver
Jonathan Westhues 2009-10-30 03:18:54 -08:00
parent 3515748334
commit daeb0e8430
2 changed files with 9 additions and 14 deletions

View File

@ -231,16 +231,13 @@ void EpsFileWriter::Bezier(SBezier *sb) {
double theta0 = atan2(p0.y - c.y, p0.x - c.x), double theta0 = atan2(p0.y - c.y, p0.x - c.x),
theta1 = atan2(p1.y - c.y, p1.x - c.x), theta1 = atan2(p1.y - c.y, p1.x - c.x),
dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI); dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI);
if(dtheta < 0) {
SWAP(double, theta0, theta1);
SWAP(Vector, p0, p1);
}
MaybeMoveTo(p0, p1); MaybeMoveTo(p0, p1);
fprintf(f, fprintf(f,
" %.3f %.3f %.3f %.3f %.3f arc\r\n", " %.3f %.3f %.3f %.3f %.3f %s\r\n",
MmToPts(c.x - ptMin.x), MmToPts(c.y - ptMin.y), MmToPts(c.x - ptMin.x), MmToPts(c.y - ptMin.y),
MmToPts(r), MmToPts(r),
theta0*180/PI, theta1*180/PI); theta0*180/PI, theta1*180/PI,
dtheta < 0 ? "arcn" : "arc");
} else if(sb->deg == 3 && !sb->IsRational()) { } else if(sb->deg == 3 && !sb->IsRational()) {
MaybeMoveTo(sb->ctrl[0], sb->ctrl[3]); MaybeMoveTo(sb->ctrl[0], sb->ctrl[3]);
fprintf(f, fprintf(f,
@ -535,15 +532,14 @@ void SvgFileWriter::Bezier(SBezier *sb) {
theta1 = atan2(p1.y - c.y, p1.x - c.x), theta1 = atan2(p1.y - c.y, p1.x - c.x),
dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI); dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI);
// The arc must be less than 180 degrees, or else it couldn't have // The arc must be less than 180 degrees, or else it couldn't have
// been represented as a single rational Bezier. And arrange it // been represented as a single rational Bezier. So large-arc-flag
// to run counter-clockwise, which corresponds to clockwise in // must be false. sweep-flag is determined by the sign of dtheta.
// SVG's mirrored coordinate system. // Note that clockwise and counter-clockwise are backwards in SVG's
if(dtheta < 0) { // mirrored csys.
SWAP(Vector, p0, p1);
}
MaybeMoveTo(p0, p1); MaybeMoveTo(p0, p1);
fprintf(f, "A%.3f,%.3f 0 0,0 %.3f,%.3f ", fprintf(f, "A%.3f,%.3f 0 0,%d %.3f,%.3f ",
r, r, r, r,
(dtheta < 0) ? 1 : 0,
p1.x - ptMin.x, ptMax.y - p1.y); p1.x - ptMin.x, ptMax.y - p1.y);
} else if(!sb->IsRational()) { } else if(!sb->IsRational()) {
if(sb->deg == 2) { if(sb->deg == 2) {

View File

@ -2,7 +2,6 @@
multi-drag multi-drag
select loop, all in group, others select loop, all in group, others
copy and paste copy and paste
filled contours for export
background image background image
associative entities from solid model, as a special group associative entities from solid model, as a special group