示例#1
0
 /// <summary>Constructor with Min and Max values.</summary>
 /// <param name="min">The min value.</param>
 /// <param name="max">The max value.</param>
 public BoundingBox(Point2D min, Point2D max)
 {
     _minX = min.X;
     _minY = min.Y;
     _maxX = max.X;
     _maxY = max.Y;
 }
示例#2
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Translates the current geometry.</summary>
        /// <param name="offset">The point describing the translation to perform.</param>
        /// <returns>The current geometry.</returns>
        //=============================================================================================================================

        public Point2D Translate(Point2D offset)
        {
            _x += offset._x;
            _y += offset._y;
            return this;
        }
示例#3
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Subtracts a constant from the current point.</summary>
        /// <param name="value">The constant to subtract.</param>
        /// <returns>The current point.</returns>
        /// <remarks>The current point is changed.</remarks>
        //=============================================================================================================================

        public Point2D SelfSubtract(Point2D pt)
        {

            _x -= pt._x;
            _y -= pt._y;
            return this;
        }
示例#4
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Multiply the current point with another point.</summary>
        /// <param name="point">The point to Multiply with.</param>
        /// <returns>The result of the Multiplication.</returns>
        /// <remarks>The current point is changed.</remarks>
        //=============================================================================================================================

        public Point2D SelfMultiply(Point2D pt)
        {
            _x *= pt._x;
            _y *= pt._y;
            return this;
        }
示例#5
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Divides the current point by another point.</summary>
        /// <param name="point">The point to divide by.</param>
        /// <returns>The result of the division.</returns>
        /// <remarks>The current point is changed.</remarks>
        //=============================================================================================================================

        public Point2D SelfDivide(Point2D pt)
        {
            _x /= pt._x;
            _y /= pt._y;
            return this;
        }
示例#6
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Divides the current point by another point.</summary>
        /// <param name="point">The point to divide by.</param>
        /// <returns>The result of the division.</returns>
        /// <remarks>The current point remains unchanged.</remarks>
        //=============================================================================================================================

        public Point2D Divide(Point2D pt)
        {
            return new Point2D(_x / pt._x, _y / pt._y);
        }
示例#7
0
 /// <summary>Tests if a point lies strictly inside the box (does not touch the border).</summary>
 /// <param name="pt">The point to test.</param>
 /// <returns>true if the point is strictly in the box.</returns>
 public bool IsPointStrictlyInside(Point2D pt)
 {
     return pt.X > _minX &&
         pt.Y > _minY &&
         pt.X < _maxX &&
         pt.Y < _maxY;
 }
示例#8
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Rotates the current point object around a specific point.</summary>
        /// <param name="center">The center of the rotation.</param>
        /// <param name="angle">The angle in radians.</param>
        //=============================================================================================================================

        public void RotateRadians(Point2D center, double angle)
        {
            Point2D temp = this;
            temp -= center;
            temp.RotateRadians(angle);
            temp += center;
            _x = temp.X;
            _y = temp.Y;
        }
示例#9
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Subtracts a point from the current point.</summary>
        /// <param name="point">The point to subtract.</param>
        /// <returns>The result of the subtraction.</returns>
        /// <remarks>The current point remains unchanged.</remarks>
        //=============================================================================================================================

        public Point2D Subtract(Point2D point)
        {
            return new Point2D(_x - point._x, _y - point._y);
        }
示例#10
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Return the current point added with a constant. </summary>
        /// <param name="point">The Constant to add.</param>
        /// <returns>The result of the addition.</returns>
        /// <remarks>The current point is modificed.</remarks>
        //=============================================================================================================================

        public Point2D SelfAdd(Point2D point)
        {
            _x += point._x;
            _y += point._y;
            return this;
        }
示例#11
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Return a new point with the sum of a point and the current point. </summary>
        /// <param name="point">The point to add.</param>
        /// <returns>The result of the addition.</returns>
        /// <remarks>The current point remains unchanged.</remarks>
        //=============================================================================================================================

        public Point2D Add(Point2D point)
        {
            return new Point2D(_x + point._x, _y + point._y);
        }
示例#12
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Calculate the dot product of 2 points.</summary>
        /// <param name="point">The 2nd point.</param>
        /// <returns>The dot product.</returns>
        //=============================================================================================================================

        public double Dot(Point2D point)
        {
            return (_x * point._x) + (_y * point._y);
        }
示例#13
0
 /// <summary>Adjust the box to fit the point.</summary>
 /// <param name="pt">The point.</param>
 public void Adjust(Point2D pt)
 {
     if (pt.X < _minX) _minX = pt.X;
     if (pt.X > _maxX) _maxX = pt.X;
     if (pt.Y < _minY) _minY = pt.Y;
     if (pt.Y > _maxY) _maxY = pt.Y;
 }
示例#14
0
 /// <summary>Sets the min and max points of the box.</summary>
 /// <param name="min">The min point of the box.</param>
 /// <param name="max">The max point of the box.</param>
 public void Set(Point2D min, Point2D max)
 {
     _minX = min.X;
     _minY = min.Y;
     _maxX = max.X;
     _maxY = max.Y;
 }
示例#15
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Rotates the current point object around a specific point.</summary>
        /// <param name="center">The center of the rotation.</param>
        /// <param name="angle">The angle in degrees.</param>
        //=============================================================================================================================

        public void Rotate(Point2D center, double angle)
        {
            RotateRadians(center, Util.ToRadians(angle));
        }
示例#16
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Copy constructor.</summary>
        /// <param name="point">The source point.</param>
        //=============================================================================================================================

        public Point2D(Point2D point)
        {
            _x = point._x;
            _y = point._y;
        }
示例#17
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Rotates the current point object around the origin.</summary>
        /// <param name="angle">The angle in radians.</param>
        //=============================================================================================================================

        public void RotateRadians(double angle)
        {
            Point2D temp = new Point2D(this);

            _x = temp._x * Math.Cos(angle) - temp._y * Math.Sin(angle);
            _y = temp._x * Math.Sin(angle) + temp._y * Math.Cos(angle);
        }
示例#18
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=============================================================================================================================
        /// <summary>Multiplies the current point by another point.</summary>
        /// <param name="point">The point to multiply by.</param>
        /// <returns>The result of the multiplication.</returns>
        /// <remarks>The current point remains unchanged.</remarks>
        //=============================================================================================================================

        public Point2D Multiply(Point2D point)
        {
            return new Point2D(_x * point._x, _y * point._y);
        }
示例#19
0
文件: Point2D.cs 项目: netgrim/MapKit
        //=====================================================================
        /// 
        /// <summary>
        /// Scales the shape primitive to a base point.
        /// </summary>
        /// <param name="factor">The scale factor.</param>
        /// <param name="pt">The base point.</param>
        /// 
        //=====================================================================

        public void Scale(double factor, Point2D pt)
        {
            Point2D pt2 = this - pt;
            pt2 *= factor;
            this._x = pt2._x + pt._x;
            this._y = pt2._y + pt._y;
        }
示例#20
0
 /// <summary>Tests if a point lies inside the box.</summary>
 /// <param name="pt">The point to test.</param>
 /// <returns>true if the point is in the box.</returns>
 public bool Contains(Point2D pt)
 {
     return pt.X >= _minX &&
         pt.Y >= _minY &&
         pt.X <= _maxX &&
         pt.Y <= _maxY;
 }