double y1d;
double y2d;
Polygon2D bez;
ArrayList<Double> dick;
Vektor2D pk0, pk1, pk2, pk3;
if (!gebogen) {
Vektor2D p1 = new Vektor2D(xx1, yy1);
Vektor2D p2 = new Vektor2D(xx2, yy2);
Polygon2D a = new Polygon2D(2);
a.add(p1);
a.add(p2);
dick = new ArrayList<Double>(2);
dick.add(staerke * Konstanten.DICKEN_REG_ST
+ this.pfeilDicke);
dick.add((double) this.pfeilDicke);
return this.segmentPfeilPol(a,
dick,
DOPPELSPITZES_ENDE,
EINFACHE_SPITZE_1,
new Vektor2D(1, 1),
new Vektor2D(1, 1),
1,
Vektor2D.NULL_VEKTOR);
}
if (x1 == x2 && y1 == y2) {
letztX = x1 + Konstanten.KN_DURCHM / 2;
letztY = y1 + Konstanten.KN_DURCHM / 2;
pk0 = new Vektor2D(letztX,
letztY);
pk1 = new Vektor2D(letztX + 80,
letztY + 40);
pk2 = new Vektor2D(letztX + 80,
y1 - Konstanten.KN_DURCHM / 2
+ this.pfeilDicke / 2 - 30);
pk3 = new Vektor2D(letztX + this.pfeilSpLaenge - 2,
y1 - Konstanten.KN_DURCHM / 2
+ this.pfeilDicke / 2 - 9);
bez = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.bezierKurve(
pk0,
pk1,
pk2,
pk3,
this.pars.getBezier());
// if (this.pars.getEinfacheDar()) {
// dick = null;
// } else {
dick = new ArrayList<Double>(bez.size());
for (double i = 0; i <= bez.size(); i++) {
dick.add((bez.size() - i) * staerke / bez.size()
* Konstanten.DICKEN_REG_ST
+ this.pfeilDicke);
}
// }
return this.segmentPfeilPol(bez,
dick,
DOPPELSPITZES_ENDE,
EINFACHE_SPITZE_1,
new Vektor2D(1, 1),
new Vektor2D(1, 1),
1,
Vektor2D.NULL_VEKTOR);
} else {
Vektor2D vv = new Vektor2D(x2, y2);
vv.sub(new Vektor2D(x1, y1));
vv.normal();
vv.mult(35);
x1 += vv.x;
y1 += vv.y;
x2 -= vv.x;
y2 -= vv.y;
// Die aktuelle Kante ist eine Doppelkante.
if (this.aktGraph.enthaeltPfeil(xx2, yy2, xx1, yy1)) {
x1d = (double) x1;
x2d = (double) x2;
y1d = (double) y1;
y2d = (double) y2;
vektorLen = Math.sqrt(Math.pow(x2d - x1d, 2)
+ Math.pow(y1d - y2d, 2));
dieseKante = new Polygon();
dieseKante.addPoint(x1, y1);
dieseKante.addPoint(x2, y2);
if (this.dopp.contains(dieseKante)) {
x1d = x1d + ((y1d - y2d) / vektorLen) * konstVersch;
x2d = x2d + ((y1d - y2d) / vektorLen) * konstVersch;
y1d = y1d + ((x2d - x1d) / vektorLen) * konstVersch;
y2d = y2d + ((x2d - x1d) / vektorLen) * konstVersch;
} else {
x1d = x1d - ((y1d - y2d) / vektorLen) * konstVersch;
x2d = x2d - ((y1d - y2d) / vektorLen) * konstVersch;
y1d = y1d - ((x2d - x1d) / vektorLen) * konstVersch;
y2d = y2d - ((x2d - x1d) / vektorLen) * konstVersch;
this.dopp.add(dieseKante);
}
x1 = (int) x1d;
x2 = (int) x2d;
y1 = (int) y1d;
y2 = (int) y2d;
} else {
Vektor2D v0 = new Vektor2D(x2, y2);
v0.sub(new Vektor2D(x1, y1));
v0.ortho();
v0.normal();
v0.mult(12);
x1 += v0.x;
x2 += v0.x;
y1 += v0.y;
y2 += v0.y;
}
Polygon pol1 = new Polygon();
Polygon pol2 = new Polygon();
pol1.addPoint(xx1, yy1);
pol1.addPoint(xx2, yy2);
pol2.addPoint(x1, y1);
pol2.addPoint(x2, y2);
this.urspKanten.add(pol1);
this.echteKant.add(pol2);
Vektor2D v = new Vektor2D(x2, y2);
double dist = new Vektor2D(x1, y1).distanz(new Vektor2D(x2, y2));
v.sub(new Vektor2D(x1, y1));
v.normal();
v.mult(this.pfeilSpLaenge);
Vektor2D v1 = new Vektor2D(x1, y1);
Vektor2D v2 = new Vektor2D(x2, y2);
v2.sub(v);
Vektor2D n1 = new Vektor2D((x1 + x2) / 2, (y1 + y2) / 2);
Vektor2D n2 = new Vektor2D((x1 + x2) / 2, (y1 + y2) / 2);
v.ortho();
v.normal();
Vektor2D zwisch = new Vektor2D(x2, y2);
zwisch.sub(new Vektor2D(x1, y2));
v.mult(Math.sqrt(Math.max(dist - 100, 0)) + 0.1);
n1.add(v);
n2.add(v);
bez = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.bezierKurve(
v1,
n1,
n2,
v2,
this.pars.getBezier());
// if (this.pars.getEinfacheDar()) {
// dick = null;
// } else {
dick = new ArrayList<Double>(bez.size());
for (double i = 0; i <= bez.size(); i++) {
dick.add((bez.size() - i) * staerke / bez.size()
* Konstanten.DICKEN_REG_ST
+ this.pfeilDicke);
}
// }
return this.segmentPfeilPol(bez,
dick,
DOPPELSPITZES_ENDE,
EINFACHE_SPITZE_1,
new Vektor2D(1, 1),
new Vektor2D(1, 1),
1,
Vektor2D.NULL_VEKTOR);
}
}