This document is archived and information here might be outdated.  Recommended version.


IAffineTransformation2D3GEN.GetControlPointError Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IA > IAffineTransformation2D3GEN Interface > IAffineTransformation2D3GEN.GetControlPointError Method
ArcGIS Developer Help

IAffineTransformation2D3GEN.GetControlPointError Method

Returns the errors involved in moving control point i from the 'from' to 'to' system. These error terms are valid after using DefineFromControlPoints/Ex to define the transformation.

[Visual Basic .NET]
Public Sub GetControlPointError ( _
    ByVal i As Integer, _
    ByRef fromError As Double, _
    ByRef toError As Double _
)
[C#]
public void GetControlPointError (
    int i,
    ref double fromError,
    ref double toError
);
[C++]
HRESULT GetControlPointError(
  long i,
  System.Double* fromError,
  System.Double* toError
);
[C++]
Parameters
i [in]

i is a parameter of type long fromError [in, out]
fromError is a parameter of type double* toError [in, out]
toError is a parameter of type double*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
[C#]

/// This example demonstrates how to get the GetControlPointError
///for an AffineTransformation
public void GetControlPointError_Example()
{
    try
    {
        //From point
        IPoint[] fromPoints = new IPoint[4];
        fromPoints[0] = CreatePoint(0, 0);
        fromPoints[1] = CreatePoint(0, 1);
        fromPoints[2] = CreatePoint(1, 0);
        fromPoints[3] = CreatePoint(1, 1);
        //To point
        IPoint[] toPoints = new IPoint[4];
        toPoints[0] = CreatePoint(5, 5);
        toPoints[1] = CreatePoint(5, 6);
        toPoints[2] = CreatePoint(6, 5);
        toPoints[3] = CreatePoint(6, 6);

        //Create an AffineTransformation2D object
        IAffineTransformation2D3GEN affineTransformation2D = new AffineTransformation2DClass();
        affineTransformation2D.DefineFromControlPoints(ref fromPoints, ref toPoints);

        double fromError = 0;
        double toError = 0;
        for (int i = 0; i < 4; i++)
        {
            affineTransformation2D.GetControlPointError(i, ref fromError, ref toError);
            System.Windows.Forms.MessageBox.Show("The fromError value is 0 because the control points define a perfect fit : " + fromError);
            System.Windows.Forms.MessageBox.Show("The toError value is 0 because the control points define a perfect fit : " + toError);
        }
        //Now lets introduce some error by modifying one control point to break the perfect fit
        toPoints[3] = CreatePoint(5.9, 5.9);
        //Redefine the affine transformation
        affineTransformation2D.DefineFromControlPoints(ref fromPoints, ref toPoints);
        affineTransformation2D.GetRMSError(ref fromError, ref toError);
        System.Windows.Forms.MessageBox.Show("The fromError value is 0.039 because the control points do not define a perfect fit : " + fromError);
        System.Windows.Forms.MessageBox.Show("The toError value is 0.035 because the control points do not define a perfect fit : " + toError);
    }
    catch (Exception e)
    {
        System.Windows.Forms.MessageBox.Show(e.Message);
    }
}
public IPoint CreatePoint(double x, double y)
{
    IPoint point = new ESRI.ArcGIS.Geometry.Point();
    point.X = x;
    point.Y = y;
    return point;
}

[Visual Basic .NET]

    'This example demonstrates how to get the RMS error
    'for all the control points of an AffineTransformation
    Private Sub GetControlPointError_example()
        On Error GoTo ErrorHandler
        'Create an AffineTransformation2D object
        Dim pA2D As IAffineTransformation2D3GEN
        pA2D = New AffineTransformation2D
        Dim pArrFromPts(3) As IPoint
        pArrFromPts(0) = New Point
        pArrFromPts(1) = New Point
        pArrFromPts(2) = New Point
        pArrFromPts(3) = New Point

        Dim pArrToPts(3) As IPoint
        pArrToPts(0) = New Point
        pArrToPts(1) = New Point
        pArrToPts(2) = New Point
        pArrToPts(3) = New Point
        'Define the Affine using control points
        'forming a perfect fit
        pArrFromPts(0).PutCoords(0, 0)
        pArrFromPts(1).PutCoords(0, 1)
        pArrFromPts(2).PutCoords(1, 0)
        pArrFromPts(3).PutCoords(1, 1)
        pArrToPts(0).PutCoords(5, 5)
        pArrToPts(1).PutCoords(5, 6)
        pArrToPts(2).PutCoords(6, 5)
        pArrToPts(3).PutCoords(6, 6)

        pA2D.DefineFromControlPoints(pArrFromPts, pArrToPts)

        Dim dFromErr As Double, dToErr As Double
        Dim i As Long
        Debug.Print("**** Control point errors - Perfect fit ****")
        For i = 0 To 3
            pA2D.GetControlPointError(i, dFromErr, dToErr)
            Debug.Print("FromErr on control point" & i & " = " & dFromErr)
            Debug.Print("ToErr on control point" & i & " = " & dToErr)
        Next
        'Now lets introduce some error by modifying one control point to break the perfect fit
        pArrToPts(3).PutCoords(5.9, 5.9)
        pA2D.DefineFromControlPoints(pArrFromPts, pArrToPts)
        Debug.Print("**** Control point errors - With error ****")
        For i = 0 To 3
            pA2D.GetControlPointError(i, dFromErr, dToErr)
            Debug.Print("FromErr on control point" & i & " = " & dFromErr)
            Debug.Print("ToErr on control point" & i & " = " & dToErr)
        Next

        Exit Sub
ErrorHandler:
        Debug.Print(Err.Description)
    End Sub

See Also

IAffineTransformation2D3GEN Interface