// test for intersection with the fiber and a tip-tang line // if there is an intersection in tip-tang, calculate the cc-point and update the interval //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: bool cone_CC(const Point& tang, const Point& tip, const Point& base, const Point& p1, const Point& p2, const Fiber& f, Interval& i) const protected bool cone_CC(Point tang, Point tip, Point @base, Point p1, Point p2, Fiber f, Interval i) { double u = 0; double t = 0; if (GlobalMembers.xy_line_line_intersection(f.p1, f.p2, ref u, tang, tip, ref t)) { if ((t >= 0.0) && (t <= 1.0)) { CCPoint cc_tmp = new CCPoint(@base + t * (tip - @base)); cc_tmp.z_projectOntoEdge(p1, p2); cc_tmp.type = CCType.EDGE_CONE; return(i.update_ifCCinEdgeAndTrue(u, cc_tmp, p1, p2, (true))); } } return(false); }
/// push-cutter horizontal edge case /// horizontal are much simpler than the general case. /// we can consider the cutter circular with an effective radius of this->width(h) // this is the horizontal edge case //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: bool horizEdgePush(const Fiber& f, Interval& i, const Point& p1, const Point& p2) const protected bool horizEdgePush(Fiber f, Interval i, Point p1, Point p2) { bool result = false; double h = p1.z - f.p1.z; // height of edge above fiber if ((h > 0.0)) { if (GlobalMembers.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 = 0; // fiber is f.p1 + qt*(f.p2-f.p1) double qv = 0; // line is p1 + qv*(p2-p1) if (GlobalMembers.xy_line_line_intersection(p1, p2, ref qv, f.p1, f.p2, ref 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 = 0; double clt = 0; 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 (GlobalMembers.xy_line_line_intersection(q1, q2, ref ccv, f.p1, f.p2, ref clt)) { double t_cl1 = clt; double t_cl2 = qt + (qt - clt); if (calcCCandUpdateInterval(t_cl1, ccv, q, p1, p2, f, i, f.p1.z, CCType.EDGE_HORIZ)) { result = true; } if (calcCCandUpdateInterval(t_cl2, -ccv, q, p1, p2, f, i, f.p1.z, CCType.EDGE_HORIZ)) { result = true; } } } } } //std::cout << " horizEdgePush = " << result << "\n"; return(result); }
/// push-cutter cylindrical shaft case. /// This is called when the contact is above the sphere/toroid/cone shaped lower part of the cutter // this is used for the cylindrical shaft of Cyl, Ball, Bull, Cone //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: bool shaftEdgePush(const Fiber& f, Interval& i, const Point& p1, const Point& p2) const protected bool shaftEdgePush(Fiber f, Interval i, Point p1, Point p2) { // push cutter along Fiber f in contact with edge p1-p2 // contact with cylindrical cutter shaft double u = 0; double v = 0; bool result = false; if (GlobalMembers.xy_line_line_intersection(p1, p2, ref u, f.p1, f.p2, ref 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 = 0; double t_cl = 0; if (GlobalMembers.xy_line_line_intersection(q1, q2, ref u_cc, f.p1, f.p2, ref 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, CCType.EDGE_SHAFT)) { result = true; } if (calcCCandUpdateInterval(t_cl2, -u_cc, q, p1, p2, f, i, f.p1.z + center_height, CCType.EDGE_SHAFT)) { result = true; } } } //std::cout << " shaftEdgePush = " << result << "\n"; return(result); }