curve()
Joins several curves and edges into one curve object — a composite curve — so a run made of different pieces can be used wherever one curve is expected (a sweep path, a loft guide, the source of an offset or a projected curve) and reused under one name.
It makes no new geometry: the result is a copy of the pieces, joined
end to end. It does not smooth anything — pieces that meet at a corner
still meet at a corner; bridge() makes smooth joins. It does not merge
the pieces into one spline. It does not use up solids: a sketch or a
curve given as a part is hidden and stays readable, an edge of a body
leaves the body as it is.
Pieces that connect form one curve; pieces that do not touch form one curve per connected run, and the tool that reads the object says whether several are acceptable. Ends that nearly meet are joined. An edge given twice counts once. Pieces that branch — three ends at one point, or an end on the middle of another piece — are refused, naming the point.
The order of the parts sets the walk: the curve starts at the free end
of the first part, so curve(b, a) starts with b. Where the first
part has no free end of its own — it is alone, in the middle of the
run, or the run closes into a loop — its own direction decides.
edges() lists the edges in that order, start() and end() read
the ends of the run.
Returns: CompositeCurve
See the guide for detailed usage examples.
Signatures
curve(...parts: (SceneObject | SceneObject[])[]): CompositeCurve
Joins several curves and edges into one curve object — a composite curve — so a run made of different pieces can be used wherever one curve is expected (a sweep path, a loft guide, the source of an offset or a projected curve) and reused under one name.
It makes no new geometry: the result is a copy of the pieces, joined
end to end. It does not smooth anything — pieces that meet at a corner
still meet at a corner; bridge() makes smooth joins. It does not merge
the pieces into one spline. It does not use up solids: a sketch or a
curve given as a part is hidden and stays readable, an edge of a body
leaves the body as it is.
Pieces that connect form one curve; pieces that do not touch form one curve per connected run, and the tool that reads the object says whether several are acceptable. Ends that nearly meet are joined. An edge given twice counts once. Pieces that branch — three ends at one point, or an end on the middle of another piece — are refused, naming the point.
The order of the parts sets the walk: the curve starts at the free end
of the first part, so curve(b, a) starts with b. Where the first
part has no free end of its own — it is alone, in the middle of the
run, or the run closes into a loop — its own direction decides.
edges() lists the edges in that order, start() and end() read
the ends of the run.
| Parameter | Type | Description |
|---|---|---|
...parts | (SceneObject | SceneObject[])[] | Curves: sketches, sketch statements, curve objects, selections of edges, or lists of those. At least one. (optional) |
Examples
// @screenshot hideGrid view top
import { sketch, line, bridge, curve } from 'fluidcad/core';
const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});
// A bridge across the gap between the two lines.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start());
// The first line, the bridge and the second line as one curve of three
// edges, walked from the free end of the first line.
const path = curve(rails.geometries.l1, br, rails.geometries.l2);