Exemple #1
0
        /// <summary>
        /// 在foldup后更lookuptable
        /// </summary>
        /// <param name="participatedGroup">参与折叠的面</param>
        /// <param name="movedFaceGroup">所有移动的面</param>
        /// <param name="fixedFaceGroup">所有不动的面</param>
        /// <param name="IsFacingUser">是否组的法线面向用户</param>
        /// <returns></returns>
        public bool UpdateTableAfterFoldUp( List<Face> participatedFaces, List<Face> movedFaces, List<Face> fixedFaces, bool IsFacingUser = true )
        {
            if (movedFaces.Count == 0)
                return false;

            RemoveRedundantFaceGroup();
            FaceGroup participatedGroup = GetGroup( participatedFaces[ 0 ] );
            FaceGroup movedFaceGroup = new FaceGroup( movedFaces[ 0 ] );
            FaceGroup fixedFaceGroup = new FaceGroup( fixedFaces[ 0 ] );

            foreach ( Face f in movedFaces )
            {
                if ( !movedFaceGroup.HasFace( f ) )
                {
                    movedFaceGroup.AddFace( f );
                }
            }

            foreach ( Face f in fixedFaces )
            {
                if ( !fixedFaceGroup.HasFace( f ) )
                {
                    fixedFaceGroup.AddFace( f );
                }
            }

            foreach ( Face fp in participatedGroup.GetFaceList() )
            {
                if ( fp.LeftChild == null && fp.RightChild == null )
                {
                    if ( !movedFaceGroup.HasFace( fp ) && !fixedFaceGroup.HasFace( fp ) )
                    {
                        fixedFaceGroup.AddFace( fp );
                    }
                }
            }

            fixedFaceGroup.SortFace();
            fixedFaceGroup.Normal = participatedGroup.Normal;

            return participatedGroup.UpdateGroupAfterFoldUp( participatedGroup, movedFaceGroup, fixedFaceGroup, IsFacingUser );
        }
Exemple #2
0
        /// <summary>
        /// 在bend前调用
        /// </summary>
        /// <param name="faces">要bend的所有面</param>
        /// <param name="angle">bend的角度,角度</param>
        public bool BeforeBending(List<Face> faces)
        {
            if ( faces == null )
            {
                return false;
            }
            if ( faces.Count == 0)
            {
                return false;
            }
            if (bendingParticipateGroup != null)
            {
                return false;
            }

            // 建立bending的临时组
            bendingParticipateGroup = new FaceGroup( faces[ 0 ] );

            for ( int i = 1; i < faces.Count; i++ )
            {
                bendingParticipateGroup.AddFace( faces[ i ] );
            }
            bendingParticipateGroup.SortFace();

            bendingParticipateGroup.Normal = bendingParticipateGroup.GetFaceList()[ 0 ].Normal;

            if ( CloverMath.IsTwoVectorTheSameDir( bendingParticipateGroup.Normal, GetGroup( bendingParticipateGroup.GetFaceList()[ 0 ] ).Normal, true ) )
            {
                IsBasicBendedFaceTheSameNormalWithItsGroup = true;
            }
            for ( int i = 0; i < faces.Count; i++ )
            {
                RemoveFace( faces[ i ] );
            }
            UpdateGroup();
            // 判断折叠样式
            return true;
        }