Ignore:
Timestamp:
2013-01-22T23:39:39+01:00 (13 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/seamap/Renderer.java

    r29206 r29207  
    211211                                                                        double s = prev.distance(next);
    212212                                                                        double p = curr.distance(prev);
    213                                                                         if (p > 0) {
     213                                                                        if ((s > 0) && (p > 0)) {
    214214                                                                                double n = curr.distance(next);
    215                                                                                 double beta = Math.acos((s * s + p * p - n * n) / 2 / s / p);
    216                                                                                 double gamma = Math.asin(p / len * Math.sin(beta));
    217                                                                                 double alpha = Math.PI - beta - gamma;
    218                                                                                 rem = len * Math.sin(alpha) / Math.sin(beta);
     215                                                                                double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p);
     216                                                                                double phi = Math.asin(p / len * Math.sin(theta));
     217                                                                                rem = len * Math.sin(Math.PI - theta - phi) / Math.sin(theta);
    219218                                                                        }
    220219                                                                        succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle)));
     
    225224                                                                if (!gap) {
    226225                                                                        Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(),
    227                                                                                         new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2(succ.getY() - curr.getY(), succ.getX() - curr.getX())+Math.toRadians(90))), null);
     226                                                                                        new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX()) + Math.toRadians(90)))), null);
    228227                                                                }
    229228                                                                if (space > 0) gap = !gap;
Note: See TracChangeset for help on using the changeset viewer.