示例#1
0
 protected PointSet(PointSet p)
     : this(p.Size)
 {
     for (int i = 0; i < Size; i++)
     {
         Ponderance[i] = p.Ponderance[i];
     }
 }
示例#2
0
 public Point(PointSet p)
     : base(p)
 {
 }
示例#3
0
 public Point(PointSet p) : base(p)
 {
 }
示例#4
0
 /// <summary>
 /// Adds a point and a vector to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> + <paramref name="b"/>.</returns>
 public static Point Add(PointSet a, Vector b)
 {
     return(Vector.Add(a.ToVector(), b).ToPoint());
 }
示例#5
0
 /// <summary>
 /// Subtracts a vector from a point to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> - <paramref name="b"/>.</returns>
 public static Point Subtract(PointSet a, Vector b)
 {
     return(Subtract(a, b.ToPoint()).ToPoint());
 }
示例#6
0
 /// <summary>
 /// The geometry distance between this two points.
 /// </summary>
 /// <param name="a">The first point.</param>
 /// <param name="b">The second point.</param>
 /// <returns>The distance between them.</returns>
 public static double Distance(PointSet a, PointSet b)
 {
     return(Subtract(a, b).Length);
 }
示例#7
0
        /// <summary>
        /// Subtracts a point from a point to produce a vector.
        /// </summary>
        /// <param name="a">The first point.</param>
        /// <param name="b">The second point.</param>
        /// <returns>The vector <paramref name="a"/> - <paramref name="b"/>.</returns>
        public static Vector Subtract(PointSet a, PointSet b)
        {
            if (!a.isRegular || !b.isRegular)
            {
                throw (new PointNotRegularException());
            }

            if (a.Dimension != b.Dimension)
            {
                throw (new DimensionsNotEqualException());
            }

            double[] d = new double[a.Dimension];

            for (int i = 0; i < a.Dimension; i++)
            {
                d[i] = a[i] - b[i];
            }

            return new Vector(d);
        }
示例#8
0
 /// <summary>
 /// Subtracts a vector from a point to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> - <paramref name="b"/>.</returns>		
 public static Point Subtract(PointSet a, Vector b)
 {
     return Subtract(a, b.ToPoint()).ToPoint();
 }
示例#9
0
        /// <summary>
        /// Multiplies a point by a scalar to produce a new point.
        /// </summary>
        /// <param name="a">A scalar.</param>
        /// <param name="b">A point.</param>
        /// <returns>The image of <paramref name="b"/> in the scaling centered at the 
        /// origin with ratio <paramref name="a"/>.</returns>
        public static Point Multiply(double a, PointSet b)
        {
            if (!b.isRegular)
            {
                throw (new PointNotRegularException());
            }

            double[] d = new double[b.Dimension];

            for (int i = 0; i < b.Dimension; i++)
            {
                d[i] = a * b[i];
            }

            return new Point(d);
        }
示例#10
0
        /// <summary>
        /// Returns the point midway between two points.
        /// </summary>
        /// <param name="a">The first point.</param>
        /// <param name="b">The second point.</param>
        /// <returns>The point (<paramref name="a"/> + <paramref name="b"/>)/2.</returns>
        public static Point MidPoint(PointSet a, PointSet b)
        {
            if (!a.isRegular || !b.isRegular)
            {
                throw (new PointNotRegularException());
            }

            return ((a.ToVector() + b.ToVector()) / 2).ToPoint();
        }
示例#11
0
 /// <summary>
 /// The geometry distance between this two points.
 /// </summary>
 /// <param name="a">The first point.</param>
 /// <param name="b">The second point.</param>
 /// <returns>The distance between them.</returns>
 public static double Distance(PointSet a, PointSet b)
 {
     return Subtract(a, b).Length;
 }
示例#12
0
 /// <summary>
 /// Determines whether two pionts are exactly equal.
 /// </summary>
 /// <param name="a">The first vector.</param>
 /// <param name="b">The second vector.</param>
 /// <returns><c>true</c> if the two vectors are equal; otherwise, <c>false</c>.</returns>
 public static bool Compare(PointSet a, PointSet b)
 {
     if ((object)a == null && (object)b == null)
     {
         return true;
     }
     else if ((object)a == null && (object)b != null)
     {
         return false;
     }
     else
     {
         return a.Equals(b);
     }
 }
示例#13
0
 /// <summary>
 /// Adds a point and a vector to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> + <paramref name="b"/>.</returns>
 public static Point Add(PointSet a, Vector b)
 {
     return Vector.Add(a.ToVector(), b).ToPoint();
 }