Inheritance: Core.Geometry.AShapeE, IXmlSerializable, IPoint
        public RectangleE ScaleCloneBy(double val, PointE about)
        {
            RectangleE ans = new RectangleE(this);

            ans.ScaleSelfBy(val, about);
            return(ans);
        }
Example #2
0
        public double Dist(PointE point)
        {
            double x = X - point.X;
            double y = Y - point.Y;

            return(Math.Sqrt(x * x + y * y));
        }
 public RectangleE(PointE location, SizeE size)
 {
     m_X      = location.X;
     m_Width  = size.Width;
     m_Y      = location.Y;
     m_Height = size.Height;
 }
Example #4
0
        public static PointE operator -(PointE c)
        {
            PointE ans = new PointE();

            ans.X = -c.X;
            ans.Y = -c.Y;
            return(ans);
        }
Example #5
0
 public void UpdatePoint(PointE pointE)
 {
     if (pointE == null)
     {
         return;
     }
     m_X = pointE.m_X;
     m_Y = pointE.m_Y;
 }
Example #6
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() != this.GetType())
            {
                return(false);
            }
            PointE test = obj as PointE;

            return(test.X == X && test.Y == Y);
        }
Example #7
0
        public PointE TransformByRotationAbout(double rotation, PointE center)
        {
            PointE t = this - center;   // translate to origin
            // apply rotation matrix cos x  -sin x
            //                       sin x   cos x which rotates about origin
            double cos = Math.Cos(rotation);
            double sin = Math.Sin(rotation);

            t = new PointE(cos * t.X - sin * t.Y, sin * t.X + cos * t.Y);
            return(t + center);            // translate back
        }
        public RectangleE Union(PointE pt)
        {
            if (Contains(pt))
            {
                return(CloneRect());
            }
            IntervalE  xInt = XInterval.Union(pt.X);
            RectangleE ans  = new RectangleE(xInt, YInterval.Union(pt.Y));

            return(ans);
        }
Example #9
0
 public bool HasSamePoints(PointE nxtPt, double tol)
 {
     if (HasSamePoints(nxtPt))
     {
         return(true);
     }
     if (Math.Abs(nxtPt.X - X) > tol)
     {
         return(false);
     }
     if (Math.Abs(nxtPt.Y - Y) > tol)
     {
         return(false);
     }
     return(true);
     //return Calc.GetDist(this, nxtPt) < tol;
 }
Example #10
0
 public PointE(PointE pt)
     : this(pt.X, pt.Y)
 {
 }
Example #11
0
        public PointE TransformByRotationAbout(double rotation, PointE center)
        {
            var t = this - center; // translate to origin

            // apply rotation matrix cos x  -sin x
            // sin x   cos x which rotates about origin
            var cos = Math.Cos(rotation);
            var sin = Math.Sin(rotation);
            t = new PointE(cos*t.X - sin*t.Y, sin*t.X + cos*t.Y);
            return t + center; // translate back
        }
Example #12
0
 public SizeE(PointE pt)
     : this(pt.X, pt.Y)
 {
 }
Example #13
0
 public double Dist(PointE point)
 {
     var x = X - point.X;
     var y = Y - point.Y;
     return Math.Sqrt(x*x + y*y);
 }
Example #14
0
 public static PointE operator -(PointE c)
 {
     var ans = new PointE();
     ans.X = -c.X;
     ans.Y = -c.Y;
     return ans;
 }
Example #15
0
 public double Dist(PointE point) {
     double x = X - point.X;
     double y = Y - point.Y;
     return Math.Sqrt(x * x + y * y);
 }
Example #16
0
 public SizeE(PointE pt)
     : this(pt.X, pt.Y)
 {
 }
Example #17
0
 public PointE ShiftPt(PointE offset)
 {
     return(new PointE(X + offset.X, Y + offset.Y));
 }
 public override IShapeE Shift(PointE point)
 {
     return(ShiftRectangle(point));
 }
 public bool Contains(PointE pt)
 {
     return(XInterval.Contains(pt.X) && YInterval.Contains(pt.Y));
 }
Example #20
0
 public double DotProduct(PointE vector)
 {
     return(this.X * vector.X + this.Y * vector.Y);
 }
Example #21
0
 public virtual bool ContainsPoint(PointE point)
 {
     return(false);
 }
Example #22
0
 public abstract IShapeE Shift(PointE point);
 public RectangleE ShiftRectangle(PointE point)
 {
     return(new RectangleE(Location.ShiftPt(point), Size));
 }
Example #24
0
 public static PointE PointBetween(PointE p1, PointE p2, double frac)
 {
     return(new PointE(p1.X + (p2.X - p1.X) * frac, p1.Y + (p2.Y - p1.Y) * frac));
 }
Example #25
0
 public override IShapeE Shift(PointE offset)
 {
     return(ShiftPt(offset));
 }
Example #26
0
 public static PointE operator +(PointE c) {
     PointE ans = new PointE();
     ans.X = +c.X;
     ans.Y = +c.Y;
     return ans;
 }
Example #27
0
 public bool HasSamePoints(PointE nxtPt)
 {
     return(nxtPt.X == X && nxtPt.Y == Y);
 }
Example #28
0
 public double DotProduct(PointE vector)
 {
     return this.X * vector.X + this.Y * vector.Y;
 }
Example #29
0
 public bool HasSamePoints(PointE nxtPt)
 {
     return nxtPt.X == X && nxtPt.Y == Y;
 }
Example #30
0
 public PointE AbsDifference(PointE point)
 {
     return new PointE(Math.Abs(X - point.X), Math.Abs(Y - point.Y));
 }
Example #31
0
 public override IShapeE Shift(PointE offset)
 {
     return ShiftPt(offset);
 }
Example #32
0
 public double DotProduct(PointE vector)
 {
     return X*vector.X + Y*vector.Y;
 }
 public static RectangleE FromMinMax(PointE minPt, PointE maxPt)
 {
     return(new RectangleE(minPt, (SizeE)(maxPt - minPt)));
 }
Example #34
0
        public bool HasSamePoints(PointE nxtPt, double tol)
        {
            if (HasSamePoints(nxtPt))
            {
                return true;
            }

            if (Math.Abs(nxtPt.X - X) > tol)
            {
                return false;
            }

            if (Math.Abs(nxtPt.Y - Y) > tol)
            {
                return false;
            }

            return true;

            // return Calc.GetDist(this, nxtPt) < tol;
        }
Example #35
0
 public abstract IShapeE Shift(PointE point);
Example #36
0
 public PointE ShiftPt(PointE offset)
 {
     return new PointE(X + offset.X, Y + offset.Y);
 }
Example #37
0
 public PointE AbsDifference(PointE point)
 {
     return(new PointE(Math.Abs(X - point.X), Math.Abs(Y - point.Y)));
 }
Example #38
0
        public void UpdatePoint(PointE pointE)
        {
            if (pointE == null)
            {
                return;
            }

            m_X = pointE.m_X;
            m_Y = pointE.m_Y;
        }
 public override bool ContainsPoint(PointE point)
 {
     return(Contains(point)); //--simple wrapper for IShapeE compatibility
 }
Example #40
0
 public static PointE PointBetween(PointE p1, PointE p2, double frac) {
     return new PointE(p1.X + (p2.X - p1.X) * frac, p1.Y + (p2.Y - p1.Y) * frac);
 }
 public void ScaleSelfBy(double val, PointE about)
 {
     m_Width  = m_Width * val;
     m_Height = m_Height * val;
     Location = Calc.PointBetween(about, Location, val);
 }
Example #42
0
 public virtual bool ContainsPoint(PointE point)
 {
     return false;
 }
Example #43
0
 public PointE(PointE pt)
     : this(pt.X, pt.Y)
 {
 }