This how-to guide will recap various methods to split curves at intersection events and how to get the remaining segments. The how-to Divide curves is focusing on a segmentation with a regular or pattern-based logic. To select the curves behind or before the intersecting shape and how to remove them, see Trim curves.

For the general purpose splitting of curves, we can use the component ShatterInputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains **C** takes the curves to split and input **t** is asking
for the curve parameter to split at. The parameter **t** is therefore no point,
but relates the *distance* from the curve’s start to the desired mark.
Therefore, before we can do any splitting, we have to compute the necessary
values for **t**.

In simple cases, there is no need to calculate the parameter to split at,
because we can directly set it. For example, if we would like to split a line or
regular curve in the middle, we can *reparameterize* the curve and set **t** to
`0.5`

. ^{}*0.5*.^{}Note that for complex curves, like Nurbs curves, the
midpoint might not be at parameter *0.5*.

If you need to split polylines at the kinks, you can use the component ExplodeInputs Curve (C) Curve to explode Recursive (R) Recursive decomposition until all segments are atomic Outputs Segments (S) Exploded segments that make up the base curve Vertices (V) Vertices of the exploded segments

## Calculate curve parameters for splitting

As said, before we can do the actual splitting, we have to compute the
parameters to split at. The ribbon tab *Intersect* contains components for
different intersection events. Some components will directly output the
sought-for curve parameters **t**, while others just emit the intersection point
**P** and we have to retrieve the splitting parameter **t** with an extra step.

### Find parameters to split at a component’s output (two distinct sets of curves)

Given are two sets of curves: Set *A* contains vertical curves and set *B*
consists of one horizontal curve. We can solve the intersection of the two sets
with the component Curve | CurveInputs Curve A (A) First curve Curve B (B) Second curve Outputs Points (P) Intersection events Params A (tA) Parameters on first curve Params B (tB) Parameters on second curve **P**, we also get the curve parameters for each set, **tA** for set *A*
and **tB** for set *B*. Now, we connect the curves from set *A* and the curve
parameters **tA** to a ShatterInputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains *graft*
to adjust the data structure**C**.

This procedure will split the curves in Set *A*. If we wish to also split set
*B*, we have to use another ShatterInputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains

Next, let us assume that there is another horizontal curve in set *B* (the wire
has now switched to two parallel lines). To ensure that every curve from one
set is compared with each curve from the other set, we have to adjust the data
structure and *graft* either of the two input grips of Curve | CurveInputs Curve A (A) First curve Curve B (B) Second curve Outputs Points (P) Intersection events Params A (tA) Parameters on first curve Params B (tB) Parameters on second curve Inputs Tree (T) Data tree to flatten Depth (D) Number of outermost branches to merge Outputs Tree (T) Trimmed data tree Inputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains

A similar procedure can be used with the components Line | LineInputs Line 1 (A) First line for intersection Line 2 (B) Second line for intersection Outputs Param A (tA) Parameter on line A Param B (tB) Parameter on line B Point A (pA) Point on line A Point B (pB) Point on line B Inputs Curve (C) Curve to intersect Line (L) Line to intersect with Outputs Points (P) Intersection events Params (t) Parameters on curve Count (N) Number of intersection events Inputs Curve (C) Curve for self-intersections Outputs Points (P) Intersection events Params (t) Parameters on curve *Intersect*.

### Find parameters to split at a component’s output (unsorted bundle of curves)

If all curves are bundled in a single list and there is no distinct set to solve
the intersection event for, we can use Multiple CurvesInputs Curves (C) Curves to intersect Outputs Points (P) Intersection events Index A (iA) Index of first intersection curve Index B (iB) Index of second intersection curve Param A (tA) Parameter on first curve Param B (tB) Parameter on second curve **tA** and **tB**) there is no simple output that gives us the
corresponding curves: The outputs **iA** and **iB** state the indices of the
curves that each intersection events belongs to, but we have to manually sort
the curves and group all intersections that each curve is subject to.

To proceed, we will first bundle our outputs with MergeInputs Data 1 (D1) Data stream 1 Data 2 (D2) Data stream 2 Outputs Result (R) Result of merge Inputs List (L) List of data. Outputs Set (S) A set of all the distincts values in L Map (M) An index map from original indices to set indices Inputs Set (S) Set to operate on. Member (M) Member to search for. Outputs Index (I) Indices of member. Count (N) Number of occurences of the member. ^{}^{}See Filter lists for more information
about this strategy. Then we can use List ItemInputs List (L) Base list Index (i) Item index Wrap (W) Wrap index to list bounds Outputs Item (i) Item at {i'} **S** of *Create Set*. We
also need another List ItemInputs List (L) Base list Index (i) Item index Wrap (W) Wrap index to list bounds Outputs Item (i) Item at {i'} Inputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains

Do note that curves which did not have an intersection event are
not part of the output. The component Combine DataInputs Input 0 (0) Data to combine Input 1 (1) Data to combine Outputs Result (R) Resulting data with as few nulls as possible Index (I) Index of input that was copied into result

### Compute parameters to split with intersection points

For this example, we take the unsorted bundle of curves from the previous chapter
and again, we use Multiple CurvesInputs Curves (C) Curves to intersect Outputs Points (P) Intersection events Index A (iA) Index of first intersection curve Index B (iB) Index of second intersection curve Param A (tA) Parameter on first curve Param B (tB) Parameter on second curve **P**. In order to use ShatterInputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains Inputs Point (P) Point to project onto curve Curve (C) Curve to project onto Outputs Point (P) Point on the curve closest to the base point Parameter (t) Parameter on curve domain of closest point Distance (D) Distance between base point and curve

After *grafting* input **C** of Curve Closest PointInputs Point (P) Point to project onto curve Curve (C) Curve to project onto Outputs Point (P) Point on the curve closest to the base point Parameter (t) Parameter on curve domain of closest point Distance (D) Distance between base point and curve Inputs First Number (A) Number to test Second Number (B) Number to test against Outputs Smaller than (<) True if A < B … or Equal to (<=) True if A <= B Inputs List (L) List to filter Dispatch pattern (P) Dispatch pattern Outputs List A (A) Dispatch target for True values List B (B) Dispatch target for False values **t** for points that have no distance **D** to the curve. Instead of
*0* we use `1e-10`

to account for software-related inaccuracies.

ShatterInputs Curve (C) Curve to trim Parameters (t) Parameters to split at Outputs Segments (S) Shattered remains Inputs Input 0 (0) Data to combine Input 1 (1) Data to combine Outputs Result (R) Resulting data with as few nulls as possible Index (I) Index of input that was copied into result

A similar procedure can be used with the components Brep | CurveInputs Brep (B) Base Brep Curve (C) Intersection curve Outputs Curves (C) Intersection overlap curves Points (P) Intersection points Inputs Surface (S) Base surface Curve (C) Intersection curve Outputs Curves (C) Intersection overlap curves Points (P) Intersection points UV Points (uv) Surface {uv} coordinates at intersection events Normals (N) Surface normal vector at intersection events Parameters (t) Curve parameter at intersection events Tangents (T) Curve tangent vector at intersection events Inputs Curve (C) Base curve Plane (P) Intersection plane Outputs Points (P) Intersection events Params C (t) Parameters {t} on curve Params P (uv) Parameters {uv} on plane Inputs Mesh (M) Mesh to intersect Curve (C) Curve to intersect with Outputs Points (X) Intersection points Faces (F) Intersection face index for each point *Intersect*, which do not emit a curve
parameter **t** but intersection points.