Example #1
0
        bool remove_interior(out int nRemoved)
        {
            RemoveOccludedTriangles remove = new RemoveOccludedTriangles(Mesh);

            remove.PerVertex  = true;
            remove.InsideMode = RemoveOccludedTriangles.CalculationMode.FastWindingNumber;
            remove.Apply();
            nRemoved = remove.RemovedT.Count();
            return(true);
        }
Example #2
0
        bool remove_occluded(out int nRemoved)
        {
            RemoveOccludedTriangles remove = new RemoveOccludedTriangles(Mesh);

            remove.PerVertex  = true;
            remove.InsideMode = RemoveOccludedTriangles.CalculationMode.SimpleOcclusionTest;
            remove.Apply();
            nRemoved = remove.RemovedT.Count();
            return(true);
        }
        public virtual void Update()
        {
            base.begin_update();
            int start_timestamp = this.CurrentInputTimestamp;

            if (MeshSource == null)
            {
                throw new Exception("RemoveHiddenFacesOp: must set valid MeshSource to compute!");
            }

            try {
                DMesh3 meshIn = MeshSource.GetDMeshUnsafe();
                if (cachedSpatial == null || spatial_cache_timstamp != meshIn.ShapeTimestamp)
                {
                    cachedSpatial = new DMeshAABBTreePro(meshIn, true);
                    cachedSpatial.FastWindingNumber(Vector3d.Zero);
                    spatial_cache_timstamp = meshIn.ShapeTimestamp;
                }
                DMesh3 editMesh = new DMesh3(meshIn);

                RemoveOccludedTriangles remove = new RemoveOccludedTriangles(editMesh, cachedSpatial)
                {
                    InsideMode = (RemoveOccludedTriangles.CalculationMode)(int) inside_mode,
                    PerVertex  = all_hidden_vertices
                };
                remove.Progress = new ProgressCancel(is_invalidated);

                if (remove.Apply() == false)
                {
                    ResultMesh     = null;
                    RemovedTris    = null;
                    RemovedSubmesh = null;
                }
                else
                {
                    ResultMesh     = editMesh;
                    RemovedTris    = remove.RemovedT;
                    RemovedSubmesh = new DSubmesh3(MeshSource.GetDMeshUnsafe(), RemovedTris);
                }

                base.complete_update();
            } catch (Exception e) {
                PostOnOperatorException(e);
                ResultMesh = base.make_failure_output(MeshSource.GetDMeshUnsafe());
                base.complete_update();
            }
        }