final Polygon2D pfeilAnfang,
final Polygon2D pfeilEnde,
final Vektor2D anfFaktor,
final Vektor2D endFaktor) {
Vektor2D aktVekX;
Vektor2D aktVekY;
Vektor2D aktVek;
Strecke2D p, q;
if (punkte == null || punkte.size() < 2) {
throw new RuntimeException("Zu wenige Segmente f�r Pfeil.");
}
ArrayList<Double> dick = dicken;
if (dick == null) {
dick = new ArrayList<Double>(punkte.size());
for (int i = 0; i < punkte.size(); i++) {
dick.add((double) this.pfeilDicke);
}
}
Polygon2D pktList1 = new Polygon2D(punkte.size()
+ pfeilAnfang.size()
+ pfeilEnde.size());
Polygon2D pktList2 = new Polygon2D(pktList1.size());
// Pfeilanfang.
Vektor2D normAnf = new Vektor2D(punkte.get(0));
Vektor2D orthoAnf;
normAnf.sub(punkte.get(1));
normAnf.normal();
orthoAnf = new Vektor2D(normAnf);
orthoAnf.ortho();
Iterator<Vektor2D> it1 = pfeilAnfang.iterator();
Polygon2D zwisch = new Polygon2D(pfeilAnfang.size());
while (it1.hasNext()) {
aktVek = it1.next();
aktVekX = new Vektor2D(orthoAnf);
aktVekY = new Vektor2D(normAnf);
aktVekX.mult(aktVek.x * anfFaktor.x * dick.get(0));
aktVekY.mult(aktVek.y * anfFaktor.y * dick.get(0));
aktVek = new Vektor2D(aktVekX);
aktVek.add(aktVekY);
aktVek.add(punkte.get(0));
zwisch.add(aktVek);
}
for (int i = zwisch.size() - 1; i >= 0; i--) {
pktList2.add(zwisch.get(i));
}
Polygon2D zwischPunkte;
Vektor2D c1 = new Vektor2D(punkte.get(1));
Vektor2D c2;
c1.sub(punkte.get(0));
c1.ortho();
c1.normal();
c1.mult((double) dick.get(0) / 2);
Vektor2D p01 = new Vektor2D(punkte.get(0));
Vektor2D p02 = new Vektor2D(p01);
Vektor2D p11;
Vektor2D p12;
p01.add(c1);
p02.sub(c1);
pktList1.add(p01);
pktList2.add(p02);
for (int i = 1; i < punkte.size() - 1; i++) {
zwischPunkte = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.schnPkte(
punkte.get(i - 1),
punkte.get(i),
punkte.get(i + 1),
dick.get(i));
p = new Strecke2D(
zwischPunkte.get(0),
zwischPunkte.get(1));
q = new Strecke2D(
pktList1.get(pktList1.size() - 1),
pktList2.get(pktList2.size() - 1));
if (p.schnPkt(q) == null) {
pktList1.add(zwischPunkte.get(0));
pktList2.add(zwischPunkte.get(1));
} else {
SonstMeth.log(SonstMeth.LOG_WARNING,
"Segment konnte nicht �berschneidungsfrei "
+ "platziert werden um Pixel: " + punkte.get(i),
this.pars,
"",
punkte.get(i));
pktList1.add(zwischPunkte.get(0));
pktList2.add(zwischPunkte.get(1));
}
}
c2 = new Vektor2D(punkte.get(punkte.size() - 1));
c2.sub(punkte.get(punkte.size() - 2));
c2.ortho();
c2.normal();
c2.mult((double) dick.get(punkte.size() - 1) / 2);
p11 = new Vektor2D(punkte.get(punkte.size() - 1));
p12 = new Vektor2D(p11);
p11.add(c2);
p12.sub(c2);
pktList1.add(p11);
pktList2.add(p12);
// Pfeilspitze.
Vektor2D normEnd = new Vektor2D(punkte.get(punkte.size() - 1));
Vektor2D orthoEnd;
normEnd.sub(punkte.get(punkte.size() - 2));
normEnd.normal();
orthoEnd = new Vektor2D(normEnd);
orthoEnd.ortho();
Iterator<Vektor2D> it2 = pfeilEnde.iterator();
while (it2.hasNext()) {
aktVek = it2.next();
aktVekX = new Vektor2D(orthoEnd);
aktVekY = new Vektor2D(normEnd);
aktVekX.mult(aktVek.x * endFaktor.x * dick.get(dick.size() - 1));
aktVekY.mult(aktVek.y * endFaktor.y * dick.get(dick.size() - 1));
aktVek = new Vektor2D(aktVekX);
aktVek.add(aktVekY);
aktVek.add(punkte.get(punkte.size() - 1));
pktList1.add(aktVek);
}