Exemple #1
0
        /// <summary>
        /// 检查当前包围球是否包含指定点
        /// </summary>
        /// <param name="point">指定点</param>
        /// <param name="result">[输出属性] 表明关系的枚举类型</param>
        public void Contains(ref Vector3 point, out ClipStatus result)
        {
            float num;

            Vector3.DistanceSquared(ref point, ref this.Center, out num);
            result = (num < (this.Radius * this.Radius)) ? ClipStatus.Inside : ClipStatus.Outside;
        }
 /// <summary>
 /// 检测当前包围盒是否包含其他包围盒
 /// </summary>
 /// <param name="box">指定的包围盒</param>
 /// <param name="result">[OutAttribute] 表明两包围盒关系的枚举类型 </param>
 public void Contains(ref BoundingBox box, out ClipStatus result)
 {
     result = ClipStatus.Outside;
     if ((((this.Max.X >= box.Min.X) && (this.Min.X <= box.Max.X)) && ((this.Max.Y >= box.Min.Y) && (this.Min.Y <= box.Max.Y))) && ((this.Max.Z >= box.Min.Z) && (this.Min.Z <= box.Max.Z)))
     {
         result = ((((this.Min.X <= box.Min.X) && (box.Max.X <= this.Max.X)) && ((this.Min.Y <= box.Min.Y) && (box.Max.Y <= this.Max.Y))) && ((this.Min.Z <= box.Min.Z) && (box.Max.Z <= this.Max.Z))) ? ClipStatus.Inside : ClipStatus.Intersecting;
     }
 }
Exemple #3
0
        /// <summary>
        /// 检查当前包围球是否包含指定包围球
        /// </summary>
        /// <param name="sphere">指定包围球 </param>
        /// <param name="result">[输出属性] 表明关系的枚举类型 </param>
        public void Contains(ref BoundingSphere sphere, out ClipStatus result)
        {
            float num3;

            Vector3.Distance(ref this.Center, ref sphere.Center, out num3);
            float radius = this.Radius;
            float num    = sphere.Radius;

            result = ((radius + num) >= num3) ? (((radius - num) >= num3) ? ClipStatus.Inside : ClipStatus.Intersecting) : ClipStatus.Outside;
        }
Exemple #4
0
 private void FrmScreenPrint_MouseDown(object sender, MouseEventArgs e)
 {
     if (m_bDrawState == ClipStatus.None)
     {
         m_bDrawState = ClipStatus.Start;
         m_pStart     = e.Location;
     }
     else if (m_bDrawState == ClipStatus.Move)
     {
     }
 }
 /// <summary>
 /// 检测当前平截头体与点的包含关系
 /// </summary>
 /// <param name="point">要检测的点</param>
 /// <param name="result">[输出参数] 平截头体与点的包含关系</param>
 public void Contains(ref Vector3 point, out ClipStatus result)
 {
     foreach (Plane plane in this.planes)
     {
         float num2 = (((plane.Normal.X * point.X) + (plane.Normal.Y * point.Y)) + (plane.Normal.Z * point.Z)) + plane.D;
         if (num2 > 1E-05f)
         {
             result = ClipStatus.Outside;
             return;
         }
     }
     result = ClipStatus.Inside;
 }
Exemple #6
0
        private void FrmScreenPrint_MouseMove(object sender, MouseEventArgs e)
        {
            Point p = e.Location;

            if (m_bDrawState == ClipStatus.Start)
            {
                m_pEnd = p;
                Invalidate();
            }
            else if (m_rcCapture.Width > 0 && m_rcCapture.Height > 0)
            {
                if ((p.X > m_rcCapture.Left && p.X < m_rcCapture.Right) && (p.Y > m_rcCapture.Bottom && p.Y < m_rcCapture.Top))
                {
                    m_bDrawState = ClipStatus.Move;
                    this.Cursor  = Cursors.Hand;
                }
            }
        }
        /// <summary>
        /// 检测当前包围盒是否包含指定包围球
        /// </summary>
        /// <param name="sphere">指定包围球</param>
        /// <param name="result">[输出属性] 表明关系的枚举类型</param>
        public void Contains(ref BoundingSphere sphere, out ClipStatus result)
        {
            float   num2;
            Vector3 vector;

            Vector3.Clamp(ref sphere.Center, ref this.Min, ref this.Max, out vector);
            Vector3.DistanceSquared(ref sphere.Center, ref vector, out num2);
            float radius = sphere.Radius;

            if (num2 > (radius * radius))
            {
                result = ClipStatus.Outside;
            }
            else
            {
                result = (((((this.Min.X + radius) <= sphere.Center.X) && (sphere.Center.X <= (this.Max.X - radius))) && (((this.Max.X - this.Min.X) > radius) && ((this.Min.Y + radius) <= sphere.Center.Y))) && (((sphere.Center.Y <= (this.Max.Y - radius)) && ((this.Max.Y - this.Min.Y) > radius)) && ((((this.Min.Z + radius) <= sphere.Center.Z) && (sphere.Center.Z <= (this.Max.Z - radius))) && ((this.Max.X - this.Min.X) > radius)))) ? ClipStatus.Inside : ClipStatus.Intersecting;
            }
        }
        /// <summary>
        /// 检测当前平截头体与指定的包围盒的相交关系
        /// </summary>
        /// <param name="box">要检测的包围盒</param>
        /// <param name="result">[输出参数] 当前平截头体与包围盒的相交关系</param>
        public void Contains(ref BoundingBox box, out ClipStatus result)
        {
            bool flag = false;

            foreach (Plane plane in this.planes)
            {
                switch (box.Intersects(plane))
                {
                case PlaneIntersectionStatus.Front:
                    result = ClipStatus.Outside;
                    return;

                case PlaneIntersectionStatus.Intersecting:
                    flag = true;
                    break;
                }
            }
            result = flag ? ClipStatus.Intersecting : ClipStatus.Inside;
        }
        /// <summary>
        /// 检测当前平截头体与指定的平截头体的相交关系
        /// </summary>
        /// <param name="frustum">要检测的平截头体</param>
        /// <returns>相交关系</returns>
        public ClipStatus Contains(BoundingFrustum frustum)
        {
            if (frustum == null)
            {
                throw new ArgumentNullException("frustum");
            }
            ClipStatus disjoint = ClipStatus.Outside;

            if (this.Intersects(frustum))
            {
                disjoint = ClipStatus.Inside;
                for (int i = 0; i < this.cornerArray.Length; i++)
                {
                    if (this.Contains(frustum.cornerArray[i]) == ClipStatus.Outside)
                    {
                        return(ClipStatus.Intersecting);
                    }
                }
            }
            return(disjoint);
        }
Exemple #10
0
 private Result GetClipStatus(IntPtr devicePointer, out ClipStatus clipStatus)
 {
     try
     {
         this.Log.LogMethodSignatureTypesAndValues(devicePointer, "out");
         this.GetOrCreateDevice(devicePointer);
         clipStatus = this.Device.ClipStatus;
         return(Result.Ok);
     }
     catch (SharpDXException ex)
     {
         Log.Warn(ex);
         clipStatus = default(ClipStatus);
         return(ex.ResultCode);
     }
     catch (Exception ex)
     {
         this.Log.Fatal(ex);
         clipStatus = default(ClipStatus);
         return(Result.UnexpectedFailure);
     }
 }
        /// <summary>
        /// 检测当前平截头体与指定的包围球的相交关系
        /// </summary>
        /// <param name="box">要检测的包围球</param>
        /// <param name="result">[输出参数] 当前平截头体与包围球的相交关系</param>
        public void Contains(ref BoundingSphere sphere, out ClipStatus result)
        {
            Vector3 center = sphere.Center;
            float   radius = sphere.Radius;
            int     num2   = 0;

            foreach (Plane plane in this.planes)
            {
                float num5 = ((plane.Normal.X * center.X) + (plane.Normal.Y * center.Y)) + (plane.Normal.Z * center.Z);
                float num3 = num5 + plane.D;
                if (num3 > radius)
                {
                    result = ClipStatus.Outside;
                    return;
                }
                if (num3 < -radius)
                {
                    num2++;
                }
            }
            result = (num2 == 6) ? ClipStatus.Inside : ClipStatus.Intersecting;
        }
Exemple #12
0
        /// <summary>
        /// 检查当前包围球是否包含指定包围盒
        /// </summary>
        /// <param name="box">指定包围盒 </param>
        /// <param name="result">[输出属性] 表明关系的枚举类型</param>
        public void Contains(ref BoundingBox box, out ClipStatus result)
        {
            bool flag;

            box.Intersects(ref this, out flag);
            if (!flag)
            {
                result = ClipStatus.Outside;
            }
            else
            {
                Vector3 vector;
                float   num = this.Radius * this.Radius;
                result   = ClipStatus.Intersecting;
                vector.X = this.Center.X - box.Min.X;
                vector.Y = this.Center.Y - box.Max.Y;
                vector.Z = this.Center.Z - box.Max.Z;
                if (vector.LengthSquared() <= num)
                {
                    vector.X = this.Center.X - box.Max.X;
                    vector.Y = this.Center.Y - box.Max.Y;
                    vector.Z = this.Center.Z - box.Max.Z;
                    if (vector.LengthSquared() <= num)
                    {
                        vector.X = this.Center.X - box.Max.X;
                        vector.Y = this.Center.Y - box.Min.Y;
                        vector.Z = this.Center.Z - box.Max.Z;
                        if (vector.LengthSquared() <= num)
                        {
                            vector.X = this.Center.X - box.Min.X;
                            vector.Y = this.Center.Y - box.Min.Y;
                            vector.Z = this.Center.Z - box.Max.Z;
                            if (vector.LengthSquared() <= num)
                            {
                                vector.X = this.Center.X - box.Min.X;
                                vector.Y = this.Center.Y - box.Max.Y;
                                vector.Z = this.Center.Z - box.Min.Z;
                                if (vector.LengthSquared() <= num)
                                {
                                    vector.X = this.Center.X - box.Max.X;
                                    vector.Y = this.Center.Y - box.Max.Y;
                                    vector.Z = this.Center.Z - box.Min.Z;
                                    if (vector.LengthSquared() <= num)
                                    {
                                        vector.X = this.Center.X - box.Max.X;
                                        vector.Y = this.Center.Y - box.Min.Y;
                                        vector.Z = this.Center.Z - box.Min.Z;
                                        if (vector.LengthSquared() <= num)
                                        {
                                            vector.X = this.Center.X - box.Min.X;
                                            vector.Y = this.Center.Y - box.Min.Y;
                                            vector.Z = this.Center.Z - box.Min.Z;
                                            if (vector.LengthSquared() <= num)
                                            {
                                                result = ClipStatus.Inside;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #13
0
 private void FrmScreenPrint_MouseUp(object sender, MouseEventArgs e)
 {
     m_bDrawState = ClipStatus.Compelete;
     m_pEnd       = e.Location;
 }
 /// <summary>
 /// 检测当前包围盒是否包含指定点
 /// </summary>
 /// <param name="point">指定点 </param>
 /// <param name="result">[输出属性] 表明关系的枚举类型</param>
 public void Contains(ref Vector3 point, out ClipStatus result)
 {
     result = ((((this.Min.X <= point.X) && (point.X <= this.Max.X)) && ((this.Min.Y <= point.Y) && (point.Y <= this.Max.Y))) && ((this.Min.Z <= point.Z) && (point.Z <= this.Max.Z))) ? ClipStatus.Inside : ClipStatus.Outside;
 }