Share via


Stroke.FindIntersections Method

Finds the points where this Stroke object intersects other Stroke objects within a given Strokes collection.

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

Syntax

'Declaration
Public Function FindIntersections ( _
    strokes As Strokes _
) As Single()
'Usage
Dim instance As Stroke 
Dim strokes As Strokes 
Dim returnValue As Single()

returnValue = instance.FindIntersections(strokes)
public float[] FindIntersections(
    Strokes strokes
)
public:
array<float>^ FindIntersections(
    Strokes^ strokes
)
public function FindIntersections(
    strokes : Strokes
) : float[]

Parameters

  • strokes
    Type: Microsoft.Ink.Strokes

    The Strokes collection used to test for intersections with this Stroke object. If nulla null reference (Nothing in Visual Basic) (Nothing in Microsoft Visual Basic .NET), uses all Strokes collections in the Ink object.

Return Value

Type: array<System.Single[]
This method returns an array of floating point index values that indicate the locations where the intersections occur.
A floating point index is a float value that represents a location somewhere between two points in the Stroke object. 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 second points. Similarly, a floating point index value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.

Remarks

Note

The Strokes collection in the strokes parameter must come from the same Ink object as the Stroke object you are testing for intersection.

This method can determine only the points of intersection.

Examples

In this example, each selected Stroke object of an InkOverlay is examined. If the Stroke has at least one intersection with the rest of the Strokes collection in the Ink object, the Stroke is split at the first point of intersection.

' Access to the Strokes property returns a copy of the Strokes object. 
' This copy must be implicitly (via using statement) or explicitly 
' disposed of in order to avoid a memory leak. 
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
    For Each S As Stroke In mInkOverlay.Selection
        ' find the intersections 
        Dim intersections() As Single = S.FindIntersections(allStrokes)
        ' if we have at least 1 intersection, split the stroke 
        If intersections.Length > 0 Then
            S.Split(intersections(0))
        End If 
    Next 
End Using
// Access to the Strokes property returns a copy of the Strokes object. 
// This copy must be implicitly (via using statement) or explicitly 
// disposed of in order to avoid a memory leak. 
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
    foreach (Stroke S in mInkOverlay.Selection)
    {
        // find the intersections 
        float[] intersections = S.FindIntersections(allStrokes);
        // if we have at least 1 intersection, split the stroke 
        if (intersections.Length > 0)
        {
            S.Split(intersections[0]);
        }
    }
}

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

See Also

Reference

Stroke Class

Stroke Members

Microsoft.Ink Namespace

Stroke.GetRectangleIntersections

Strokes