Exemplo n.º 1
0
        internal static bool HitTest(Vector3D srcPoint, Rectangle3D srcRectangle, SpatialTransform3D transform)
        {
            // Semi principal axes
            var a = srcRectangle.Width / 2;
            var b = srcRectangle.Height / 2;
            var c = srcRectangle.Depth / 2;

            // Center of ellipse
            var x1 = srcRectangle.Left + a;
            var y1 = srcRectangle.Top + b;
            var z1 = srcRectangle.Front + c;

            return(Math.Abs(ComputePointEllipsoidAltitude(a, b, c, new Vector3D(x1, y1, z1), srcPoint)) - 1 <= HitTestDistance / transform.CumulativeScale);
        }
        /// <summary>
        /// Cloning constructor.
        /// </summary>
        /// <param name="source">The source object from which to clone.</param>
        /// <param name="context">The cloning context object.</param>
        protected SpatialTransform3D(SpatialTransform3D source, ICloningContext context)
        {
            context.CloneFields(source, this);

            _centerOfRotation = source._centerOfRotation ?? Vector3D.Null;

            if (source._rotation != null)
            {
                _rotation = source._rotation.Clone();
            }

            if (source._cumulativeTransform != null)
            {
                _cumulativeTransform = source._cumulativeTransform.Clone();
            }

            if (source._transform != null)
            {
                _transform = source._transform.Clone();
            }
        }