Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="d0"></param>
 /// <param name="d1"></param>
 /// <returns></returns>
 public static Domain3d Intersect(Domain3d d0, Domain3d d1)
 {
     d0.X = Domain1d.Intersect(d0.X, d1.X);
     d0.Y = Domain1d.Intersect(d0.Y, d1.Y);
     d0.Z = Domain1d.Intersect(d0.Z, d1.Z);
     return(d0);
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Domain3d Union(Domain3d a, Domain3d b)
 {
     a.X = Domain1d.Union(a.X, b.X);
     a.Y = Domain1d.Union(a.Y, b.Y);
     a.Z = Domain1d.Union(a.Z, b.Z);
     return(a);
 }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="point"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 public static Vec3d Remap(Vec3d point, Domain3d from, Domain3d to)
 {
     point.X = Domain1d.Remap(point.X, from.X, to.X);
     point.Y = Domain1d.Remap(point.Y, from.Y, to.Y);
     point.Y = Domain1d.Remap(point.Z, from.Z, to.Z);
     return(point);
 }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="t"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <returns></returns>
        public static double Remap(double t, Domain1d from, Domain1d to)
        {
            if (!from.IsValid)
            {
                throw new InvalidOperationException("Can't remap from an invalid domain");
            }

            return(SlurMath.Remap(t, from.T0, from.T1, to.T0, to.T1));
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="points"></param>
        public Domain2d(IEnumerable <Vec2d> points)
            : this()
        {
            var p = points.First();

            X = new Domain1d(p.X);
            Y = new Domain1d(p.Y);

            Include(points.Skip(1));
        }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="from"></param>
 /// <param name="to"></param>
 public Domain2d(Vec2d from, Vec2d to)
 {
     X = new Domain1d(from.X, to.X);
     Y = new Domain1d(from.Y, to.Y);
 }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="center"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public Domain2d(Vec2d center, double offsetX, double offsetY)
 {
     X = new Domain1d(center.X - offsetX, center.X + offsetX);
     Y = new Domain1d(center.Y - offsetY, center.Y + offsetY);
 }
Exemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="point"></param>
 public Domain2d(Vec2d point)
 {
     X = new Domain1d(point.X);
     Y = new Domain1d(point.Y);
 }
Exemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public Domain2d(Domain1d x, Domain1d y)
 {
     this.X = x;
     this.Y = y;
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="point"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 public static Vec2d Remap(Vec2d point, Domain2d from, Domain2d to)
 {
     point.X = Domain1d.Remap(point.X, from.X, to.X);
     point.Y = Domain1d.Remap(point.Y, from.Y, to.Y);
     return(point);
 }
Exemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Domain2d Union(Domain2d a, Domain2d b)
 {
     a.X = Domain1d.Union(a.X, b.X);
     a.Y = Domain1d.Union(a.Y, b.Y);
     return(a);
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <param name="tolerance"></param>
 /// <returns></returns>
 public bool ApproxEquals(Domain1d other, double tolerance)
 {
     return(Math.Abs(other.T0 - T0) < tolerance && Math.Abs(other.T1 - T1) < tolerance);
 }
Exemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="center"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 /// <param name="offsetZ"></param>
 public Domain3d(Vec3d center, double offsetX, double offsetY, double offsetZ)
 {
     X = new Domain1d(center.X - offsetX, center.X + offsetX);
     Y = new Domain1d(center.Y - offsetY, center.Y + offsetY);
     Z = new Domain1d(center.Z - offsetZ, center.Z + offsetZ);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Returns the region of a that is also in b.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Domain1d Intersect(Domain1d a, Domain1d b)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="point"></param>
 public Domain3d(Vec3d point)
 {
     X = new Domain1d(point.X);
     Y = new Domain1d(point.Y);
     Z = new Domain1d(point.Z);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Returns the union of a and b.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Domain1d Union(Domain1d a, Domain1d b)
 {
     a.Include(b.T0);
     a.Include(b.T1);
     return(a);
 }
Exemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 public Domain3d(Domain1d x, Domain1d y, Domain1d z)
 {
     this.X = x;
     this.Y = y;
     this.Z = z;
 }
Exemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x0"></param>
 /// <param name="x1"></param>
 /// <param name="y0"></param>
 /// <param name="y1"></param>
 /// <param name="z0"></param>
 /// <param name="z1"></param>
 public Domain3d(double x0, double x1, double y0, double y1, double z0, double z1)
 {
     X = new Domain1d(x0, x1);
     Y = new Domain1d(y0, y1);
     Z = new Domain1d(z0, z1);
 }
Exemplo n.º 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x0"></param>
 /// <param name="x1"></param>
 /// <param name="y0"></param>
 /// <param name="y1"></param>
 public Domain2d(double x0, double x1, double y0, double y1)
 {
     X = new Domain1d(x0, x1);
     Y = new Domain1d(y0, y1);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Expands this domain to include another
 /// </summary>
 /// <param name="other"></param>
 public void Include(Domain1d other)
 {
     Include(other.T0);
     Include(other.T1);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Returns the region of a that is not in b.
 /// </summary>
 /// <param name="d0"></param>
 /// <param name="d1"></param>
 /// <returns></returns>
 public static Domain1d Difference(Domain1d d0, Domain1d d1)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="from"></param>
 /// <param name="to"></param>
 public Domain3d(Vec3d from, Vec3d to)
 {
     X = new Domain1d(from.X, to.X);
     Y = new Domain1d(from.Y, to.Y);
     Z = new Domain1d(from.Z, to.Z);
 }