Example #1
0
        public void SelectFirstDegeneratedUVTri()
        {
            using (IBitArray selectionSet = this.m_hashDegUVTris.SelectionFirstFromHashSet(this.NumTris))
                this.SetFaceSelection(selectionSet);

            this.m_iDegUVTriIndex = 0;
        }
Example #2
0
        public void SelectFirstBadSMGTris()
        {
            using (IBitArray selectionSet = this.m_hashBadSMGTris.SelectionFirstFromHashSet(this.NumTris))
                this.SetFaceSelection(selectionSet);

            this.m_iBadSMGTriIndex = 0;
        }
Example #3
0
        /// <summary>
        /// create a bitarray for a face selection
        /// </summary>
        /// <param name="selectionIndices"></param>
        /// <param name="numTris"></param>
        /// <returns></returns>
        public static IBitArray SelectionFirstFromHashSet(this HashSet <int> selectionIndices, int numTris)
        {
            // create a bitarray via global interface from max sdk
            // on initialize all bits are false
            IBitArray faceSelection = AssemblyFunctions.GlobalInterface.BitArray.Create(numTris);

            // set the bit for the first face index in the error list
            faceSelection.Set(selectionIndices.FirstOrDefault());

            return(faceSelection);
        }
Example #4
0
        /// <summary>
        /// create a bitarray for a face selection
        /// </summary>
        /// <param name="selectionIndices"></param>
        /// <param name="index"></param>
        /// <param name="numTris"></param>
        /// <returns></returns>
        public static IBitArray SelectionNextFromHashSet(this HashSet <int> selectionIndices, int index, int numTris)
        {
            // create a bitarray via global interface from max sdk
            // on initialize all bits are false
            IBitArray faceSelection = AssemblyFunctions.GlobalInterface.BitArray.Create(numTris);

            // set the bit for a specific face index in the error list
            faceSelection.Set(selectionIndices.ElementAt(index));

            return(faceSelection);
        }
Example #5
0
        public void SelectNextBadSMGTris()
        {
            this.m_iBadSMGTriIndex++;

            if (this.m_iBadSMGTriIndex >= this.m_hashBadSMGTris.Count)
            {
                this.m_iBadSMGTriIndex = 0;
            }

            using (IBitArray selectionSet = this.m_hashBadSMGTris.SelectionNextFromHashSet(this.m_iBadSMGTriIndex, this.NumTris))
                this.SetFaceSelection(selectionSet);
        }
Example #6
0
        public void SelectNextDegeneratedUVTri()
        {
            this.m_iDegUVTriIndex++;

            if (this.m_iDegUVTriIndex >= this.m_hashDegUVTris.Count)
            {
                this.m_iDegUVTriIndex = 0;
            }

            using (IBitArray selectionSet = this.m_hashDegUVTris.SelectionNextFromHashSet(this.m_iDegUVTriIndex, this.NumTris))
                this.SetFaceSelection(selectionSet);
        }
Example #7
0
        public void And(IBitArray bitArray)
        {
            var longBackedBitArray = (LongBackedBitArray)bitArray;

            if (Size != longBackedBitArray.Size)
            {
                throw new ArgumentException();
            }

            for (var i = 0; i < Data.Length; ++i)
            {
                Data[i] &= longBackedBitArray.Data[i];
            }
        }
Example #8
0
        /// <summary>
        /// create a bitarray for a face selection
        /// </summary>
        /// <param name="selectionIndices"></param>
        /// <param name="numTris"></param>
        /// <returns></returns>
        public static IBitArray SelectionAllFromHashSet(this HashSet <int> selectionIndices, int numTris)
        {
            // create a bitarray via global interface from max sdk
            // on initialize all bits are false
            IBitArray faceSelection = AssemblyFunctions.GlobalInterface.BitArray.Create(numTris);

            int[] arrErrorFaces = selectionIndices.ToArray();

            // cycle trough all error face indices
            // set the bit for the specific face index
            for (int i = 0; i < arrErrorFaces.Length; i++)
            {
                faceSelection.Set(arrErrorFaces[i]);
            }

            return(faceSelection);
        }
Example #9
0
        /// <summary>
        /// clear the current face selection
        /// </summary>
        public void ClearSelection()
        {
            // create a new bitarray size of the tri faces
            // since they all are initialized as notset its an empty selection
            using (IBitArray faceSelection = AssemblyFunctions.GlobalInterface.BitArray.Create(this.NumTris))
            {
                // set subobjlevel to object
                // if you keep the current level, the new selection will not be visible
                // maybe a missing notifiy command in max.net or my side
                AssemblyFunctions.Core.SetSubObjectLevel(Globals.MESH_SUBLEVEL_OBJECT, true);

                // set the face selection to the empty bitarray
                this.m_triMesh.FaceSel = faceSelection;

                // notify all node dependents that there was a change
                this.m_node.NotifyDependents(Globals.FOREVER, Globals.PART_ALL, RefMessage.Change);
            }
        }
        private IBitArray GetOriginalSolution(IBitArray w)
        {
            var v = (IBitArray)Activator.CreateInstance(typeof(TArray), colsOrig);

            for (int i = 0; i < w.Length; i++)
            {
                if (w[i])
                {
                    for (var ancestor = ancestors[i]; ancestor != null; ancestor = ancestor.Next)
                    {
                        v[ancestor.Column] = !v[ancestor.Column];
                    }
                }
            }
#if DEBUG
            Debug.Assert(GaussianElimination <TArray> .IsSolutionValid(matrixOrig, v));
#endif
            return(v);
        }
Example #11
0
    private static void TestBitArray(IBitArray bits) {
      Assert.AreEqual(false, bits.Get(0));
      Assert.AreEqual(false, bits.Get(10000));
      Assert.AreEqual(0, bits.Count);

      bits.Set(100, false);
      Assert.AreEqual(false, bits.Get(100));
      Assert.AreEqual(0, bits.Count);

      bits.Set(100, true);
      Assert.AreEqual(true, bits.Get(100));
      Assert.AreEqual(1, bits.Count);

      bits.Set(100, false);
      Assert.AreEqual(false, bits.Get(100));
      Assert.AreEqual(0, bits.Count);

      bits.Set(63, true);
      Assert.AreEqual(true, bits.Get(63));
      Assert.AreEqual(1, bits.Count);
    }
Example #12
0
        private static void TestBitArray(IBitArray bits)
        {
            Assert.AreEqual(false, bits.Get(0));
            Assert.AreEqual(false, bits.Get(10000));
            Assert.AreEqual(0, bits.Count);

            bits.Set(100, false);
            Assert.AreEqual(false, bits.Get(100));
            Assert.AreEqual(0, bits.Count);

            bits.Set(100, true);
            Assert.AreEqual(true, bits.Get(100));
            Assert.AreEqual(1, bits.Count);

            bits.Set(100, false);
            Assert.AreEqual(false, bits.Get(100));
            Assert.AreEqual(0, bits.Count);

            bits.Set(63, true);
            Assert.AreEqual(true, bits.Get(63));
            Assert.AreEqual(1, bits.Count);
        }
Example #13
0
        /// <summary>
        /// set a face selection on the current node
        /// </summary>
        /// <param name="selection"></param>
        private void SetFaceSelection(IBitArray selection)
        {
            // disbale scene redraw but dont turn on expert mode
            using (new StopSceneRedraw(false))
            {
                if (!this.IsValidWorkingNode)
                {
                    return;
                }

                // switch the main max mode to modify
                if (AssemblyFunctions.Core.CommandPanelTaskMode != Globals.TASK_MODE_MODIFY)
                {
                    AssemblyFunctions.Core.CommandPanelTaskMode = Globals.TASK_MODE_MODIFY;
                }

                // select the node
                this.SetNodeSelection();

                // clear the current active selection
                this.ClearSelection();

                // set the current subobjlevel to face
                AssemblyFunctions.Core.SetSubObjectLevel(Globals.MESH_SUBLEVEL_FACE, true);
                this.m_triMesh.FaceSel = selection;

                // notify all node dependents that there was a change
                this.m_node.NotifyDependents(Globals.FOREVER, Globals.PART_ALL, RefMessage.Change);

                // zoom to selection
                if (Settings.Default.ErrorZoomExtends)
                {
                    AssemblyFunctions.Core.ViewportZoomExtents(true, false);
                }
            }
        }
Example #14
0
 public void SelectAllBadSMGTris()
 {
     using (IBitArray selectionSet = this.m_hashBadSMGTris.SelectionAllFromHashSet(this.NumTris))
         this.SetFaceSelection(selectionSet);
 }
Example #15
0
        private static bool IsSolutionValid(IBitMatrix matrix, int rowMin, int rowMax, IBitArray solution)
        {
            int cols = matrix.Cols;

            for (int i = rowMin; i < rowMax; i++)
            {
                bool row = false;
                for (int j = 0; j < cols; j++)
                {
                    row ^= solution[j] & matrix[i, j];
                }
                if (row)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #16
0
 public BitVector64(IBitArray bits)
     : this(bits.GetUInt(0) | ((ulong)bits.GetUInt(1) << 32))
 {
 }
Example #17
0
 public void SelectAllDegeneratedUVTris()
 {
     using (IBitArray selectionSet = this.m_hashDegUVTris.SelectionAllFromHashSet(this.NumTris))
         this.SetFaceSelection(selectionSet);
 }
 public int RenderPresetsPreSave(IITargetedIO root, IBitArray saveCategories)
 {
     throw new NotImplementedException();
 }
 public int RenderPresetsPostLoad(IITargetedIO root, IBitArray loadCategories)
 {
     throw new NotImplementedException();
 }
Example #20
0
 public static bool IsSolutionValid(IBitMatrix matrix, IBitArray solution)
 {
     return(IsSolutionValid(matrix, 0, matrix.Rows, solution));
 }
Example #21
0
 public BitVector16(IBitArray bits) : this(bits.GetUInt(0))
 {
 }
 public int GetKeySelState(IBitArray sel, IInterval range, uint flags)
 {
     throw new NotImplementedException();
 }