This documentation is archived and is not being maintained.

# StrokeIntersection Structure

Visual Studio 2008

Represents the floating point index values where an intersection begins and ends on a stroke.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

## Syntax

```public struct StrokeIntersection
```

## Remarks

A floating point index is a float value that represents a location somewhere between two points in the stroke. As examples, if 0.0 is the first point in the stroke and 1.0 is the second point in the stroke, 0.5 is halfway between the first and the second points. Similarly, a value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.

Use an array of StrokeIntersection structures to indicate multiple intersections along a Stroke object.

## Examples

In this example, all segments of a passed Stroke object that are inside the specified Rectangle structure are deleted. This is acomplished by examining the StrokeIntersection structures to determine where to split the passed Stroke object, and which segments to delete.

```private void DeleteInsideRectangle(Stroke S, Rectangle R)
{
// get the StrokeIntersection array
StrokeIntersection[] SI = S.GetRectangleIntersections(R);

// examine each StrokeIntersection
// must work backwards through the array so that when splitting,
// the remaining intersections are still valid for S
for (int k = SI.Length - 1; k >= 0; k--)
{
float enterRect = SI[k].BeginIndex;
float exitRect = SI[k].EndIndex;

// check if the whole stroke is inside the rectangle
// if so, delete the stroke
if (enterRect == -1 && exitRect == -1)
{
S.Ink.DeleteStroke(S);
continue;
}

// check if a segment enters and exits the rectangle
// if so, split and delete the segment inside the rectangle
if (enterRect > 0 && exitRect > 0)
{
// the stroke resulting from split() is outside, keep it
S.Split(exitRect);
// the stroke from this split() is inside, delete it
Stroke temp = S.Split(enterRect);
temp.Ink.DeleteStroke(temp);
continue;
}

// check if stroke starts inside the rectangle and goes outside
// if so, split and delete the segment inside the rectangle
if (enterRect == -1 && exitRect > 0)
{
// the stroke resulting from split() is outside, keep it
S.Split(exitRect);
// delete the remaining segment of the stroke
S.Ink.DeleteStroke(S);
continue;
}

// check if stroke starts outside the rectangle and ends inside
// if so, split and delete the segment inside the rectangle
if (enterRect > 0 && exitRect == -1)
{
Stroke temp2 = S.Split(enterRect);
temp2.Ink.DeleteStroke(temp2);
}
}
}
```

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

## Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

## Version Information

#### .NET Framework

Supported in: 3.0