// this is used for the cylindrical shaft of Cyl, Ball, Bull, Cone bool MillingCutter::shaftEdgePush(const Fiber& f, Interval& i, const Point& p1, const Point& p2) const { // push cutter along Fiber f in contact with edge p1-p2 // contact with cylindrical cutter shaft double u,v; bool result = false; if ( xy_line_line_intersection(p1, p2, u, f.p1, f.p2, v ) ) { // find XY-intersection btw fiber and edge Point q = p1 + u*(p2-p1); // edge/fiber intersection point, on edge // Point q = f.p1 + v*(f.p2-f.p1); // q on fiber // from q, go v_cc*xy_tangent, then r*xy_normal, and end up on fiber: // q + v_cc*tangent + r*xy_normal = p1 + t_cl*(p2-p1) Point xy_tang=p2-p1; xy_tang.z=0; xy_tang.xyNormalize(); Point xy_normal = xy_tang.xyPerp(); Point q1 = q + radius*xy_normal; Point q2 = q1 + (p2-p1); double u_cc, t_cl; if ( xy_line_line_intersection( q1 , q2, u_cc, f.p1, f.p2, t_cl ) ) { double t_cl1 = t_cl; // cc_tmp1 = q +/- u_cc*(p2-p1); double t_cl2 = v + (v-t_cl); if ( calcCCandUpdateInterval(t_cl1, u_cc, q, p1, p2, f, i, f.p1.z+center_height, EDGE_SHAFT) ) result = true; if ( calcCCandUpdateInterval(t_cl2, -u_cc, q, p1, p2, f, i, f.p1.z+center_height, EDGE_SHAFT) ) result = true; } } //std::cout << " shaftEdgePush = " << result << "\n"; return result; }
// this is the horizontal edge case bool MillingCutter::horizEdgePush(const Fiber& f, Interval& i, const Point& p1, const Point& p2) const { bool result=false; double h = p1.z - f.p1.z; // height of edge above fiber if ( (h > 0.0) ) { if ( isZero_tol( p2.z-p1.z ) ) { // this is the horizontal-edge special case double eff_radius = this->width( h ); // the cutter acts as a cylinder with eff_radius // contact this cylinder/circle against edge in xy-plane double qt; // fiber is f.p1 + qt*(f.p2-f.p1) double qv; // line is p1 + qv*(p2-p1) if (xy_line_line_intersection( p1 , p2, qv, f.p1, f.p2, qt ) ) { Point q = p1 + qv*(p2-p1); // the intersection point // from q, go v-units along tangent, then eff_r*normal, and end up on fiber: // q + ccv*tangent + r*normal = p1 + clt*(p2-p1) double ccv, clt; Point xy_tang=p2-p1; xy_tang.z=0; xy_tang.xyNormalize(); Point xy_normal = xy_tang.xyPerp(); Point q1 = q+eff_radius*xy_normal; Point q2 = q1+(p2-p1); if ( xy_line_line_intersection( q1 , q2, ccv, f.p1, f.p2, clt ) ) { double t_cl1 = clt; double t_cl2 = qt + (qt - clt ); if ( calcCCandUpdateInterval(t_cl1, ccv, q, p1, p2, f, i, f.p1.z, EDGE_HORIZ) ) result = true; if ( calcCCandUpdateInterval(t_cl2, -ccv, q, p1, p2, f, i, f.p1.z, EDGE_HORIZ) ) result = true; } } } } //std::cout << " horizEdgePush = " << result << "\n"; return result; }