private void AdjustPeriodic(Face face2, ICurve2D curveOnFace2, GeoPoint leaveFace1) { if (!face2.Surface.IsUPeriodic && !face2.Surface.IsVPeriodic) { return; } double uperiod = 0.0, vperiod = 0.0; if (face2.Surface.IsUPeriodic) { uperiod = face2.Surface.UPeriod; } if (face2.Surface.IsVPeriodic) { vperiod = face2.Surface.VPeriod; } GeoPoint2D pos = face2.Surface.PositionOf(leaveFace1); if (!face2.area.Contains(pos, true)) { // dieser Punkt muss eigentlich in Area anthalten sein, er kann höchstens um die Periode verschoben sein bool found = false; CompoundShape tst = face2.area.Expand((uperiod + vperiod) / 100); if (tst.Contains(pos, true)) { found = true; } if (!found && uperiod > 0.0) { if (tst.Contains(pos + uperiod * GeoVector2D.XAxis, true)) { pos = pos + uperiod * GeoVector2D.XAxis; found = true; } if (!found && tst.Contains(pos - uperiod * GeoVector2D.XAxis, true)) { pos = pos - uperiod * GeoVector2D.XAxis; found = true; } } if (!found && vperiod > 0.0) { if (tst.Contains(pos + vperiod * GeoVector2D.YAxis, true)) { pos = pos + vperiod * GeoVector2D.YAxis; found = true; } if (!found && tst.Contains(pos - vperiod * GeoVector2D.YAxis, true)) { pos = pos - vperiod * GeoVector2D.YAxis; found = true; } } } // jetzt die Kurve so verschieben, dass der Punkt draufliegt double du = 0.0, dv = 0.0; double dist = curveOnFace2.MinDistance(pos); if (uperiod > 0.0) { double d = curveOnFace2.MinDistance(pos + uperiod * GeoVector2D.XAxis); if (d < dist) { du = -uperiod; dist = d; } d = curveOnFace2.MinDistance(pos - uperiod * GeoVector2D.XAxis); if (d < dist) { du = uperiod; dist = d; } } if (vperiod > 0.0) { double d = curveOnFace2.Distance(pos + vperiod * GeoVector2D.YAxis); if (d < dist) { dv = -vperiod; dist = d; } d = curveOnFace2.Distance(pos - vperiod * GeoVector2D.YAxis); if (d < dist) { dv = vperiod; dist = d; } } if (du != 0.0 || dv != 0.0) { curveOnFace2.Move(du, dv); } }