コード例 #1
0
        internal GeneralTransform2DTo3D(GeneralTransform transform2D,
                                        Viewport2DVisual3D containingVisual3D,
                                        GeneralTransform3D transform3D)
        {
            Visual child = containingVisual3D.Visual;

            Debug.Assert(child != null, "Going from 2D to 3D containingVisual3D.Visual should not be null");

            _transform3D = (GeneralTransform3D)transform3D.GetCurrentValueAsFrozen();

            // we also need to go one more level up to handle a transform being placed
            // on the Viewport2DVisual3D's child
            GeneralTransformGroup transformGroup = new GeneralTransformGroup();

            transformGroup.Children.Add((GeneralTransform)transform2D.GetCurrentValueAsFrozen());
            transformGroup.Children.Add((GeneralTransform)child.TransformToOuterSpace().GetCurrentValueAsFrozen());
            transformGroup.Freeze();
            _transform2D = transformGroup;

            _positions     = containingVisual3D.InternalPositionsCache;
            _textureCoords = containingVisual3D.InternalTextureCoordinatesCache;
            _triIndices    = containingVisual3D.InternalTriangleIndicesCache;

            _childBounds = child.CalculateSubgraphRenderBoundsOuterSpace();
        }
コード例 #2
0
        internal GeneralTransform2DTo3D(GeneralTransform transform2D, 
                                        Viewport2DVisual3D containingVisual3D, 
                                        GeneralTransform3D transform3D)
        {            
            Visual child = containingVisual3D.Visual;

            Debug.Assert(child != null, "Going from 2D to 3D containingVisual3D.Visual should not be null");
            
            _transform3D = (GeneralTransform3D)transform3D.GetCurrentValueAsFrozen();

            // we also need to go one more level up to handle a transform being placed
            // on the Viewport2DVisual3D's child
            GeneralTransformGroup transformGroup = new GeneralTransformGroup();
            transformGroup.Children.Add((GeneralTransform)transform2D.GetCurrentValueAsFrozen());
            transformGroup.Children.Add((GeneralTransform)child.TransformToOuterSpace().GetCurrentValueAsFrozen());
            transformGroup.Freeze();
            _transform2D = transformGroup;

            _positions = containingVisual3D.InternalPositionsCache;
            _textureCoords = containingVisual3D.InternalTextureCoordinatesCache;
            _triIndices = containingVisual3D.InternalTriangleIndicesCache;

            _childBounds = child.CalculateSubgraphRenderBoundsOuterSpace();
        }
コード例 #3
0
ファイル: CuttingPlaneGroup.cs プロジェクト: ondrej11/o106
        /// <summary>
        /// Intersects the specified source mesh geometry with the specified plane.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="inverseTransform">The inverse transform of the source.</param>
        /// <param name="plane">The plane.</param>
        /// <param name="complement">Cut with the complement set if set to <c>true</c>.</param>
        /// <returns>The intersected geometry.</returns>
        private MeshGeometry3D Intersect(MeshGeometry3D source, GeneralTransform3D inverseTransform, Plane3D plane, bool complement)
        {
            var p = inverseTransform.Transform(plane.Position);
            var p2 = inverseTransform.Transform(plane.Position + plane.Normal);
            var n = p2 - p;

            if (complement)
            {
                n *= -1;
            }

            return MeshGeometryHelper.Cut(source, p, n);
        }