Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Interval3d Union(Interval3d a, Interval3d b)
 {
     a.X = Interval1d.Union(a.X, b.X);
     a.Y = Interval1d.Union(a.Y, b.Y);
     a.Z = Interval1d.Union(a.Z, b.Z);
     return(a);
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="d0"></param>
 /// <param name="d1"></param>
 /// <returns></returns>
 public static Interval3d Intersect(Interval3d d0, Interval3d d1)
 {
     d0.X = Interval1d.Intersect(d0.X, d1.X);
     d0.Y = Interval1d.Intersect(d0.Y, d1.Y);
     d0.Z = Interval1d.Intersect(d0.Z, d1.Z);
     return(d0);
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="point"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 public static Vec3d Remap(Vec3d point, Interval3d from, Interval3d to)
 {
     point.X = Interval1d.Remap(point.X, from.X, to.X);
     point.Y = Interval1d.Remap(point.Y, from.Y, to.Y);
     point.Y = Interval1d.Remap(point.Z, from.Z, to.Z);
     return(point);
 }
Exemple #4
0
 /// <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 Vec3d NextVec3d(this Random random, Interval3d interval)
 {
     return(new Vec3d(
                interval.X.Evaluate(random.NextDouble()),
                interval.Y.Evaluate(random.NextDouble()),
                interval.Z.Evaluate(random.NextDouble())));
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 public void Include(Interval3d other)
 {
     X.Include(other.X);
     Y.Include(other.Y);
     Z.Include(other.Z);
 }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <param name="tolerance"></param>
 /// <returns></returns>
 public bool ApproxEquals(Interval3d other, double tolerance)
 {
     return(X.ApproxEquals(other.X, tolerance) && Y.ApproxEquals(other.Y, tolerance) && Z.ApproxEquals(other.Z, tolerance));
 }