This document is archived and information here might be outdated. Recommended version. |
RMS (Root Mean Square) error expressed relative to the 'from' and 'to' points defining the transformation. These error terms are valid after using DefineFromControlPoints/Ex to define the transformation.
[Visual Basic .NET]
Public Sub GetRMSError ( _
ByRef fromError As Double, _
ByRef toError As Double _
)
[C#]
public void GetRMSError (
ref double fromError,
ref double toError
);
[C++]
HRESULT GetRMSError(
System.Double* fromError,
System.Double* toError
);
[C++] Parameters fromError [in, out]
fromError is a parameter of type double* toError [in, out]
toError is a parameter of type double*
/// This example demonstrates how to get the RMS error
///for an AffineTransformation
public void GetRMSError_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;
affineTransformation2D.GetRMSError(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;
}
'This example demonstrates how to get the RMS error
'for an AffineTransformation
Private Sub GetRMSError_Example()
On Error GoTo ErrorHandler
'Create an IAffineTransformation2D3Gen 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
pA2D.GetRMSError(dFromErr, dToErr)
Debug.Print("The dFromErr value is 0 because the control points define a perfect fit : " & dFromErr)
Debug.Print("The dToErr value is 0 because the control points define a perfect fit : " & dToErr)
'Now lets introduce some error by modifying one control point to break the perfect fit
pArrToPts(3).PutCoords(5.9, 5.9)
'Redefine the affine transformation
pA2D.DefineFromControlPoints(pArrFromPts, pArrToPts)
pA2D.GetRMSError(dFromErr, dToErr)
Debug.Print("The dFromErr value is 0.039 because the control points do not define a perfect fit : " & dFromErr)
Debug.Print("The dToErr value is 0.035 because the control points do not define a perfect fit : " & dToErr)
Exit Sub
ErrorHandler:
Debug.Print(Err.Description)
End Sub