コード例 #1
0
ファイル: Interval3d.cs プロジェクト: GitZHCODE/zCode
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Interval3d Union(Interval3d a, Interval3d b)
 {
     a.X = Intervald.Union(a.X, b.X);
     a.Y = Intervald.Union(a.Y, b.Y);
     a.Z = Intervald.Union(a.Z, b.Z);
     return(a);
 }
コード例 #2
0
ファイル: Interval3d.cs プロジェクト: GitZHCODE/zCode
 /// <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 = 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);
 }
コード例 #3
0
ファイル: Interval3d.cs プロジェクト: GitZHCODE/zCode
 /// <summary>
 ///
 /// </summary>
 /// <param name="d0"></param>
 /// <param name="d1"></param>
 /// <returns></returns>
 public static Interval3d Intersect(Interval3d d0, Interval3d d1)
 {
     d0.X = Intervald.Intersect(d0.X, d1.X);
     d0.Y = Intervald.Intersect(d0.Y, d1.Y);
     d0.Z = Intervald.Intersect(d0.Z, d1.Z);
     return(d0);
 }
コード例 #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())));
 }