/// <summary>
 /// Determines if the specified point is contained within this RCNumRectangle.
 /// </summary>
 /// <param name="x">The horizontal coordinate of the point to test.</param>
 /// <param name="y">The vertical coordinate of the point to test.</param>
 /// <returns>Returns true if the point is contained within this RCNumRectangle, false otherwise.</returns>
 public bool Contains(RCNumber x, RCNumber y)
 {
     if (!this.isDefined)
     {
         throw new InvalidOperationException("Illegal use of undefined RCNumRectangle!");
     }
     return(x >= this.x && y >= this.y && x < this.Right && y < this.Bottom);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new RCNumVector with the specified coordinates.
 /// </summary>
 /// <param name="x">The horizontal coordinate of the RCNumVector.</param>
 /// <param name="y">The vertical coordinate of the RCNumVector.</param>
 public RCNumVector(RCNumber x, RCNumber y)
 {
     this.isDefined          = true;
     this.x                  = x;
     this.y                  = y;
     this.lengthCache        = default(CachedValue <RCNumber>);
     this.lengthCacheCreated = false;
 }
Beispiel #3
0
        /// <summary>
        /// Creates an RCMatrix with the given components.
        /// </summary>
        /// <param name="item00">The first item in the first row.</param>
        /// <param name="item01">The second item in the first row.</param>
        /// <param name="item10">The first item in the second row.</param>
        /// <param name="item11">The second item in the second row.</param>
        public RCMatrix(RCNumber item00, RCNumber item01, RCNumber item10, RCNumber item11)
        {
            this.item00 = item00;
            this.item01 = item01;
            this.item10 = item10;
            this.item11 = item11;

            this.determinantCache        = default(CachedValue <RCNumber>);
            this.determinantCacheCreated = false;
            this.inverseCache            = default(CachedValue <RCMatrixInternal>);
            this.inverseCacheCreated     = false;
        }
        /// <summary>
        /// Initializes a new RCNumRectangle with the specified location and size.
        /// </summary>
        /// <param name="x">The horizontal coordinate of the top-left corner of the RCNumRectangle.</param>
        /// <param name="y">The vertical coordinate of the top-left corner of the RCNumRectangle.</param>
        /// <param name="width">The width of the RCNumRectangle.</param>
        /// <param name="height">The height of the RCNumRectangle.</param>
        public RCNumRectangle(RCNumber x, RCNumber y, RCNumber width, RCNumber height)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException("Width has to be greater than 0!", "width");
            }
            if (height <= 0)
            {
                throw new ArgumentOutOfRangeException("Height has to be greater than 0!", "height");
            }

            this.isDefined = true;
            this.x         = x;
            this.y         = y;
            this.width     = width;
            this.height    = height;
        }
 /// <summary>
 /// Internal helper function for computing intersections.
 /// </summary>
 private static bool IntersectVertical(ref RCNumRectangle lRect, ref RCNumRectangle rRect, out RCNumber intersectTop, out RCNumber intersectBottom)
 {
     if (lRect.Top <= rRect.Top && rRect.Top < lRect.Bottom && lRect.Bottom <= rRect.Bottom)
     {
         intersectTop    = rRect.Top;
         intersectBottom = lRect.Bottom;
         return(true);
     }
     else if (rRect.Top <= lRect.Top && lRect.Top < lRect.Bottom && lRect.Bottom <= rRect.Bottom)
     {
         intersectTop    = lRect.Top;
         intersectBottom = lRect.Bottom;
         return(true);
     }
     else if (rRect.Top <= lRect.Top && lRect.Top < rRect.Bottom && rRect.Bottom <= lRect.Bottom)
     {
         intersectTop    = lRect.Top;
         intersectBottom = rRect.Bottom;
         return(true);
     }
     else
     {
         intersectTop    = 0;
         intersectBottom = 0;
         return(false);
     }
 }
 /// <summary>
 /// Internal helper function for computing intersections.
 /// </summary>
 private static bool IntersectHorizontal(ref RCNumRectangle lRect, ref RCNumRectangle rRect, out RCNumber intersectLeft, out RCNumber intersectRight)
 {
     if ((lRect.Left <= rRect.Left && rRect.Left < lRect.Right && lRect.Right <= rRect.Right))
     {
         intersectLeft  = rRect.Left;
         intersectRight = lRect.Right;
         return(true);
     }
     else if (rRect.Left <= lRect.Left && lRect.Left < lRect.Right && lRect.Right <= rRect.Right)
     {
         intersectLeft  = lRect.Left;
         intersectRight = lRect.Right;
         return(true);
     }
     else if (rRect.Left <= lRect.Left && lRect.Left < rRect.Right && rRect.Right <= lRect.Right)
     {
         intersectLeft  = lRect.Left;
         intersectRight = rRect.Right;
         return(true);
     }
     else
     {
         intersectLeft  = 0;
         intersectRight = 0;
         return(false);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Checks whether this RCNumber contains the same value as the specified RCNumber.
 /// </summary>
 /// <param name="other">The RCNumber to test.</param>
 /// <returns>True if other RCNumber has the same value as this RCNumber.</returns>
 public bool Equals(RCNumber other)
 {
     return(this.rawValue == other.rawValue);
 }