private bool ComputeRegistration() { bool result; Vector3[] targetCoords = new Vector3[placedTargets.Length]; for (int i = 0; i < placedTargets.Length; i++) { targetCoords[i] = placedTargets[i].transform.position; } Alignment3D modelAlign = new Alignment3D(targetCoords); (tfModelToWorld, result) = modelAlign.computeRegistration(); return(result); }
// Start is called before the first frame update void Start() { statusmsg = status.GetComponent <TextMesh>(); rand = new System.Random(); //testPoints = new Vector3[] { new Vector3(0, 0, 0), new Vector3(0.215f, 0, 0), new Vector3(0.215f, 0.279f, 0), new Vector3(0, 0.279f, 0) }; //testPoints = new Vector3[] { new Vector3(0, 0, 0), new Vector3(0, -0.215f, 0), new Vector3(0.279f, -0.215f, 0), new Vector3(0.279f, 0 , 0) }; testPoints = new Vector3[] { new Vector3(1, 1, 0), new Vector3(-1, 1, 0), new Vector3(-1, -1, 0), new Vector3(1, -1, 0), new Vector3(1, -1, 0), new Vector3(1, -1, 0) }; for (int i = 0; i < testPoints.Length; i++) { //shift points by 1 testPoints[i].x = testPoints[i].x + 2.0f + 0.15f * map((float)rand.NextDouble()); // + 2.0f; testPoints[i].y = testPoints[i].y + 0.15f * map((float)rand.NextDouble()); // + 2.0f; testPoints[i].z = testPoints[i].z + 0.15f * map((float)rand.NextDouble()); // + 1.0f; } align = new Alignment3D(testPoints); statusmsg.text = align.computeRegistration().ToString(); }