public virtual void Update() { base.begin_update(); int start_timestamp = this.CurrentInputTimestamp; if (MeshSource == null) { throw new Exception("GenerateClosedMeshOp: must set valid MeshSource to compute!"); } try { DMesh3 inputmesh = MeshSource.GetDMeshUnsafe(); ISpatial inputSpatial = MeshSource.HasSpatial ? MeshSource.GetSpatial() : null; DMeshAABBTree3 spatial = (inputSpatial != null && inputSpatial is DMeshAABBTree3) ? inputSpatial as DMeshAABBTree3 : get_cached_spatial(inputmesh); DMesh3 meshIn = new DMesh3(inputmesh); MeshRepairOrientation repair = new MeshRepairOrientation(meshIn, spatial); repair.OrientComponents(); repair.SolveGlobalOrientation(); if (invert_result) { meshIn.ReverseOrientation(true); } ResultMesh = meshIn; base.complete_update(); } catch (Exception e) { PostOnOperatorException(e); ResultMesh = base.make_failure_output(MeshSource.GetDMeshUnsafe()); base.complete_update(); } }
void repair_orientation(bool bGlobal) { MeshRepairOrientation orient = new MeshRepairOrientation(Mesh); orient.OrientComponents(); if (Cancelled()) { return; } if (bGlobal) { orient.SolveGlobalOrientation(); } }