/// <summary> /// Resolves overlap between this and another CHull by moving on the minimum penetration depth vector /// </summary> /// <param name="other"></param> /// <returns></returns> public double Project(IHull other) { var v = other as CvxHull; var vc = v as ClusterConvexHull; var c = this as ClusterConvexHull; if (c != null && c.Contains(v)) { return(0); } if (vc != null && vc.Contains(this)) { return(0); } Debug.Assert(v != null); Point pd = PenetrationDepth.PenetrationDepthForPolylines(TranslatedBoundary(), v.TranslatedBoundary()); if (pd.Length > 0) { Point wpd = pd / (Weight + v.Weight); MoveCenter(v.Weight * wpd); v.MoveCenter(-Weight * wpd); } return(pd.Length); }
public ECORehabilitation(GEAContext.ECOClassification ecoclassification) : base(ecoclassification) { db = new ORTContext(); this.date = DateTime.Now; int mk = 0; { PenetrationDepth x = null; if (PenetrationDepth.GetByDepth(db, this.groundblur.depth, out x)) { this.penetrationdepth = x; } else { this.penetrationdepth = PenetrationDepth.defaulttype; } } { EmergencyClass x = null; if (EmergencyClass.GetByMass(db, this.groundblur.totalmass, out x)) { this.emergencyclass = x; } else { this.emergencyclass = EmergencyClass.defaulttype; } } this.waterprotectionarea = getWaterProtectionArea(db); List <RehabilitationMethod> source = new List <RehabilitationMethod>(); if (Helper.GetListRehabilitationMethod(db, ref source)) { foreach (RehabilitationMethod rm in source) { bool r1 = (this.isriskobjecttype && this.riskobjecttype.type_code > 0 && this.riskobjecttype.type_code == rm.riskobjecttype.type_code); bool r2 = (rm.cadastretype.type_code == 0 || this.cadastretype.type_code == rm.cadastretype.type_code); bool r3 = (rm.emergencyclass.type_code == 0 || this.emergencyclass.type_code == rm.emergencyclass.type_code); bool r4 = (rm.penetrationdepth.type_code == 0 || this.penetrationdepth.type_code == rm.penetrationdepth.type_code); bool r5 = (rm.soilpollutioncategories.code == 0 || this.soilpollutioncategories.code == rm.soilpollutioncategories.code); bool r6 = (rm.waterpollutioncategories.code == 0 || this.waterpollutioncategories.code == rm.waterpollutioncategories.code); bool r7 = (this.waterachieved == rm.waterachieved); bool r8 = (this.waterprotectionarea.type_code == rm.waterprotectionarea.type_code); int k = (r1?1:0) + (r2?1:0) + (r3?1:0) + (r3?1:0) + (r4?1:0) + (r5?1:0) + (r6?1:0) + (r7?1:0); mk = k > mk?k:mk; // if (r1 && r2 && r3 && r4 && r5 && r6 && r7 ) rehabilitationlist.Add(rm); if (k >= 5) { rehabilitationlist.Add(rm); } } } }