Esempio n. 1
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // NOTE: Geometry3D hit testing takes the rayParams in the outer space of the
        //       Geometry3D.  That is, RayHitTest() will apply this geometry's
        //       transform to the ray for the caller.
        //
        //       This is different than Visual hit testing which does not transform
        //       the hit testing parameters by the Visual's transform.
        internal void RayHitTest(RayHitTestParameters rayParams, FaceType facesToHit)
        {
            Debug.Assert(facesToHit != FaceType.None,
                         "Caller should make sure we're trying to hit something");

            Rect3D bounds = Bounds;

            if (bounds.IsEmpty)
            {
                return;
            }

            //



            Point3D  origin;
            Vector3D direction;

            rayParams.GetLocalLine(out origin, out direction);

            if (LineUtil.ComputeLineBoxIntersection(ref origin, ref direction, ref bounds, rayParams.IsRay))
            {
                RayHitTestCore(rayParams, facesToHit);
            }

            //
        }
Esempio n. 2
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // NOTE: Geometry3D hit testing takes the rayParams in the outer space of the
        //       Geometry3D.  That is, RayHitTest() will apply this geometry's
        //       transform to the ray for the caller.
        //
        //       This is different than Visual hit testing which does not transform
        //       the hit testing parameters by the Visual's transform.
        internal void RayHitTest(RayHitTestParameters rayParams, FaceType facesToHit)
        {
            Debug.Assert(facesToHit != FaceType.None,
                         "Caller should make sure we're trying to hit something");

            Rect3D bounds = Bounds;

            if (bounds.IsEmpty)
            {
                return;
            }

            // Geometry3D's do not yet support a Transform property
            //
            // Transform3D transform = Transform;
            // rayParams.PushTransform(transform);


            Point3D  origin;
            Vector3D direction;

            rayParams.GetLocalLine(out origin, out direction);

            if (LineUtil.ComputeLineBoxIntersection(ref origin, ref direction, ref bounds, rayParams.IsRay))
            {
                RayHitTestCore(rayParams, facesToHit);
            }

            // Geometry3D's do not yet support a Transform property
            //
            // rayParams.PopTransform(transform);
        }