/// <summary> /// /// </summary> public static void RemapColumns(ReadOnlyArrayView <Vector3d> matrix, Interval3d from, Interval3d to, ArrayView <Vector3d> result) { for (int i = 0; i < matrix.Count; i++) { result[i] = Interval3d.Remap(matrix[i], from, to); } }
/// <summary> /// /// </summary> public static void EvaluateColumns(ReadOnlyArrayView <Vector3d> matrix, Interval3d interval, ArrayView <Vector3d> result) { for (int i = 0; i < matrix.Count; i++) { result[i] = interval.Evaluate(matrix[i]); } }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <param name="epsilon"></param> /// <returns></returns> public bool ApproxEquals(Interval3d other, double epsilon = D.ZeroTolerance) { return (X.ApproxEquals(other.X, epsilon) && Y.ApproxEquals(other.Y, epsilon) && Z.ApproxEquals(other.Z, epsilon)); }
/// <summary> /// /// </summary> /// <param name="point"></param> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public static Vector3d Remap(Vector3d point, Interval3d from, Interval3d to) { point.X = Intervald.Remap(point.X, from.X, to.X); point.Y = Intervald.Remap(point.Y, from.Y, to.Y); point.Y = Intervald.Remap(point.Z, from.Z, to.Z); return(point); }
/// <summary> /// Returns a random vector which has components within the given interval. /// </summary> /// <param name="random"></param> /// <param name="interval"></param> /// <returns></returns> public static Vector3d NextVector3d(this Random random, Interval3d interval) { return(new Vector3d( interval.X.Evaluate(random.NextDouble()), interval.Y.Evaluate(random.NextDouble()), interval.Z.Evaluate(random.NextDouble()))); }
/// <summary> /// /// </summary> public static void RemapColumns(ReadOnlyArrayView <Vector3d> matrix, Interval3d from, Interval3d to, ArrayView <Vector3d> result) { ForEach(new UniformPartitioner(0, matrix.Count), p => { for (int i = p.From; i < p.To; i++) { result[i] = Interval3d.Remap(matrix[i], from, to); } }); }
/// <summary> /// /// </summary> public static void EvaluateColumns(ReadOnlyArrayView <Vector3d> matrix, Interval3d interval, ArrayView <Vector3d> result) { ForEach(new UniformPartitioner(0, matrix.Count), p => { for (int i = p.From; i < p.To; i++) { result[i] = interval.Evaluate(matrix[i]); } }); }
/// <summary> /// /// </summary> /// <param name="other"></param> public void Include(Interval3d other) { X.Include(other.X); Y.Include(other.Y); Z.Include(other.Z); }