List <object> calcOuterBoundary(CContour ccontour) { if (ccontour.isClosed) { return(null); } int loopCount = 0; List <object> resultBoundary = new List <object>(); CPoint startp = ccontour.StartP; CBoundary cb = startp.Boundary; CContour ccontour2 = ccontour; while (loopCount++ > 10) { CPoint greaterCPoint = cb.getGreaterCPoint(startp); if (greaterCPoint == null) { return(null); } resultBoundary.Add(ccontour2); resultBoundary.Add(startp); resultBoundary.Add(greaterCPoint); if (greaterCPoint == ccontour.endP) { return(resultBoundary); } ccontour2 = greaterCPoint.contour; if (ccontour2.StartP == greaterCPoint) { startp = ccontour2.endP; } else if (ccontour2.endP == greaterCPoint) { startp = ccontour2.StartP; } else { throw new System.Exception("ContourColorize 116"); } cb = startp.Boundary; } return(null); }
public void calcIntersection() { ObjectId[] boundary = Selection.getBoundarys(); List <CBoundary> cbs = new List <CBoundary>(); Database db = HostApplicationServices.WorkingDatabase; using (Transaction trans = db.TransactionManager.StartTransaction()){ for (int n = 0; n < boundary.Length; n++) { Polyline3d pl = trans.GetObject(boundary[n], OpenMode.ForRead) as Polyline3d; if (pl == null) { continue; } CBoundary cb = new CBoundary(pl); } for (int i = 0; i < this.ccontours.Count; i++) { CContour cc = this.ccontours[i]; if (cc.isClosed) { continue; } for (int j = 0; j < cbs.Count; j++) { CBoundary cb = cbs[j]; Polyline3d pl = cb.pl3d; double p = pl.GetParameterAtPoint(cc.StartP.point); if (p >= 0) { cc.StartP.param = p; cc.StartP.Boundary = cb; } p = pl.GetParameterAtPoint(cc.endP.point); if (p >= 0) { cc.endP.param = p; cc.endP.Boundary = cb; } } } } }