pub fn blend_faces(
model: &mut Model,
solid: &Shape,
a: &Shape,
b: &Shape,
radius: f64,
tol: Tolerances,
) -> OgeomResult<Built>Expand description
Blend two faces of one solid with a rolling ball of the given radius.
The two faces need not touch. What they must do is face each other across a corner, and the material must fill that corner (the ball rolls inside it and the blend takes the corner off) or leave it open (the ball rolls in the open and the blend fills it), which is asked of the solid rather than assumed from the normals, because normals cannot tell a step from a slot.
- Two planes: their meeting line must cross the stretch both faces
reach, and the blend is a cylinder of
radiusalong it. - A curved face and another face sharing edges of the solid: the corner
is those edges, and the blend is the edge blend of all of them at
once (
fillet_edges): a cylinder or torus where the seat has a closed form, a B-spline band fitted through the marched ball otherwise (B-spline, cone, sphere and torus hosts included). Where the shared edges stop short of closing round a loop because another face stands over the crease between them (a wedge fused into the corner), while the ball touches both faces all the way round a closed seat, the blend is that closed round, built as between faces sharing no edge: the other face is taken in whole where every ball clears it. - A curved face and another face sharing no edge, their surfaces
sharing a direction (planes and cylinders along it) or an axis (planes
square to it, cylinders, cones, spheres and tori about it): the ball
touches each face along a line or a circle, and the blend is a
cylinder or a torus of
radiusover the run both faces reach, or all the way round, ended in the ball’s section through the end of the solid’s edges along the crease where those end first. The corner it takes off or fills is the section between the ball’s arc and where the two surfaces cross, swept over the run; the faces are trimmed to their lines of contact by the boolean that applies it. Where the surfaces cross in more than one corner the ball rolls in (a drum’s flat and its wall), every such corner is blended. A strip between the faces (an older, smaller round) that lies wholly in the corner goes with it. - A curved face and another face sharing no edge whose surfaces share no direction or axis (a B-spline face, a cylinder at a slant to a plane): the ball is marched along where the two surfaces cross, the surfaces carried on past the faces for it (a plane’s or a cylinder’s window widened, a B-spline patch continued, each written back as the face’s own surface). The blend is a B-spline band fitted through the ball’s arcs, and the corner between the band and the crease, bounded by the two surfaces, is cut off or fused on as the edge blend’s is: all the way round where the ball touches both faces round a closed seat, and otherwise over the stretch where it touches both, capped at each end by a plane face in the ball’s section where its line of contact leaves a face (a crease running off the solid, or a face that holds part of the seat), or, where the solid’s edges along the crease end first (a crease running off a block’s side while the ball still rolls over its top), in the section through their end. Where both faces let the ball go round a closed seat, never at the same place, the round is a run over each stretch both hold it, each capped at both ends and applied in turn. The band rides both faces within a tenth of a degree. An older, smaller round between the faces that every ball clears goes with the corner.
§Errors
OgeomError::Construction, by
name, if the radius is not a usable length, and:
- for two planes, if they are parallel or the faces do not both reach the meeting line, or the ball touching both touches a face’s plane off the face at a station of the run (a face narrower than the ball’s setback), or another face of the solid reaches into its lune, the part of it between its centre and its arc, at a station of the run (a strip between them, such as a chamfer, that the ball crosses rather than takes off whole). A face reaching into the back of the ball only, behind its centre (the far side of a part thinner than the ball), is clear of the round;
- for a curved face, if the two are one face or either is not a face of the solid;
- for a curved face sharing edges with the other, as
fillet_edges, and, where the ball touches both faces all the way round a closed seat the shared edges do not close, if it reaches into another face of the solid at a station of the run; - for a curved face sharing no edge with the other, if their surfaces do not cross; and, for each side of the faces the ball could roll on, if no ball touches both faces there, its round would be a torus crossing its own axis, or the solid beside the middle of the round is not what that side needs (material behind the faces, open in front of them), or another face of the solid reaches into the ball’s lune at a station of the run (a chamfer or a wedge between them it crosses), other than a face the round runs off at the run’s ends or along the crease, or the corners the ball rolls in on a side stand close enough that their rounds could meet. It is also refused where a ball seats on both sides;
- for a marched seat, on a side, if no ball seats along where the surfaces cross, more than one crossing holds one touching both faces, its line of contact comes back to a face where it left it, or the march stops while the ball still touches both faces; and if a face is a trimmed or offset surface. A line of contact crossing a face more than once gives a capped run over each stretch both faces hold.
OgeomError::NotDone where whether
another face comes inside the ball between two stations cannot be told
within the halvings allowed.