public IterativeClosestPointTransform()//:base(PointerUtils.GetIntPtr(new double[3]), true, true) { this.PSource = null; this.PTarget = null; this.LandmarkTransform = new LandmarkTransform(); this.MaximumMeanDistance = 1.0E-3; this.NumberOfIterations = 0; this.MeanDistance = 0.0; }
/// <summary> /// Finds the transform that should be applied to the model points to /// reduce the sum of squard distances error. /// </summary> /// <returns>The transform.</returns> /// <param name="correspondences">Correspondences.</param> protected override Matrix4x4 FindTransformImplementation(CorrespondenceCollection correspondences) { List <Vector3d> modelPoints = new List <Vector3d>(); List <Vector3d> staticPoints = new List <Vector3d>(); CorrespondecesToVector3Lists(correspondences, ref modelPoints, ref staticPoints); LandmarkTransform transformComputer = new LandmarkTransform(modelPoints, staticPoints); bool computationSucceed = transformComputer.ComputeTransform(); if (!computationSucceed) { Debug.LogError( "Could not compute the transform, should not happen, since " + "ValidateCorrespondences should extract these issues"); } return(transformComputer.TransformMatrix.ToUnityMatrix()); }