Geom::Path half_outline_old(Geom::Path const& input, double width, double miter, Inkscape::LineJoinType join = Inkscape::JOIN_BEVEL) { Geom::Path res; if (input.size() == 0) return res; Geom::Point tang1 = input[0].unitTangentAt(0); Geom::Point start = input.initialPoint() + tang1 * width; Geom::Path temp; Geom::Point tang[2]; res.setStitching(true); temp.setStitching(true); res.start(start); // Do two curves at a time for efficiency, since the join function needs to know the outgoing curve as well const size_t k = (input.back_closed().isDegenerate() && input.closed()) ?input.size_default()-1:input.size_default(); for (size_t u = 0; u < k; u += 2) { temp.clear(); offset_curve_old(temp, &input[u], width); // on the first run through, there isn't a join if (u == 0) { res.append(temp); } else { tangents_old(tang, input[u-1], input[u]); outline_join(res, temp, tang[0], tang[1], width, miter, join); } // odd number of paths if (u < k - 1) { temp.clear(); offset_curve_old(temp, &input[u+1], width); tangents_old(tang, input[u], input[u+1]); outline_join(res, temp, tang[0], tang[1], width, miter, join); } } if (input.closed()) { Geom::Curve const &c1 = res.back(); Geom::Curve const &c2 = res.front(); temp.clear(); temp.append(c1); Geom::Path temp2; temp2.append(c2); tangents_old(tang, input.back(), input.front()); outline_join(temp, temp2, tang[0], tang[1], width, miter, join); res.erase(res.begin()); res.erase_last(); // res.append(temp); res.close(); } return res; }
/* rectangular cutter. ctr "center" of rectangle (might not actually be in the center with respect to leading/trailing edges pos vector from center to leading edge neg vector from center to trailing edge width vector to side edge */ Geom::PathVector PrintMetafile::rect_cutter(Geom::Point ctr, Geom::Point pos, Geom::Point neg, Geom::Point width) { std::vector<Geom::Path> outres; Geom::Path cutter; cutter.start(ctr + pos - width); cutter.appendNew<Geom::LineSegment>(ctr + pos + width); cutter.appendNew<Geom::LineSegment>(ctr + neg + width); cutter.appendNew<Geom::LineSegment>(ctr + neg - width); cutter.close(); outres.push_back(cutter); return outres; }
void LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) { Geom::Path path; path.start( p ); double diameter = radius_helper_nodes; if(helper_size > 0 && Geom::distance(p,p2) > (diameter * 0.35)) { Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } path.appendNew<Geom::LineSegment>( p2 ); hp.push_back(path); }
Geom::Path Layout::baseline() const { iterator pos = this->begin(); Geom::Point left_pt = this->characterAnchorPoint(pos); pos.thisEndOfLine(); Geom::Point right_pt = this->characterAnchorPoint(pos); if (this->_blockProgression() == LEFT_TO_RIGHT || this->_blockProgression() == RIGHT_TO_LEFT) { left_pt = Geom::Point(left_pt[Geom::Y], left_pt[Geom::X]); right_pt = Geom::Point(right_pt[Geom::Y], right_pt[Geom::X]); } Geom::Path baseline; baseline.start(left_pt); baseline.appendNew<Geom::LineSegment>(right_pt); return baseline; }