/// <summary> /// Find best intersection of eye-rays and reference planes. /// </summary> /// <remarks>Best is defined as the the plane with the shortest distance</remarks> /// <param name="eye_rays">Eye-rays</param> /// <param name="planes">Calibrated reference planes</param> /// <param name="isect_t">Parametric ray intersection distance</param> /// <param name="isect_p">Intersection points (optional).</param> public static void FindEyeRayPlaneIntersections(Ray[] eye_rays, Plane[] planes, out double[] isect_t, out Vector[] isect_p, out int[] isect_plane_ids) { isect_t = new double[eye_rays.Length]; isect_p = new Vector[eye_rays.Length]; isect_plane_ids = new int[eye_rays.Length]; for (int i = 0; i < eye_rays.Length; ++i) { Ray r = eye_rays[i]; double t = Double.MaxValue; int id = -1; for (int p = 0; p < planes.Length; ++p) { double this_t; Intersection.RayPlane(r, planes[p], out this_t); if (this_t < t) { t = this_t; id = p; } } isect_t[i] = t; isect_p[i] = r.At(t); isect_plane_ids[i] = id; } }
/// <summary> /// Passes the mean 3d point to the calling function. /// (evaluation of the ray-equation) /// </summary> /// <returns></returns> public Vector Mean() { return(_r.At(_tmean)); }
public void At() { Ray r = new Ray(MakeVector(1, 0, 0)); Assert.AreEqual(0, (MakeVector(1, 0, 0) - r.At(1)).Norm(), 0.00001); Assert.AreEqual(0, (MakeVector(5, 0, 0) - r.At(5)).Norm(), 0.00001); }
public Vector Median() { double t = _ts[_ts.Count / 2]; return(_r.At(t)); }