From 5111604646898f590081d0fd9073a9379aa45944 Mon Sep 17 00:00:00 2001 From: John May Date: Tue, 13 Dec 2016 15:43:25 +0000 Subject: [PATCH] Watch out for shallow (and now sharp) bond angles when slanting wedges. --- .../renderer/generators/standard/StandardBondGenerator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardBondGenerator.java b/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardBondGenerator.java index aefd41522e..f1fc297cb5 100644 --- a/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardBondGenerator.java +++ b/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardBondGenerator.java @@ -359,7 +359,7 @@ IRenderingElement generateBoldWedgeBond(IAtom from, IAtom to, List toBond final double theta = refVector.angle(unit); - if (theta > threshold) { + if (theta > threshold && theta + threshold + threshold < Math.PI) { c = intersection(b, newUnitVector(b, c), toPoint, refVector); d = intersection(a, newUnitVector(a, d), toPoint, refVector); @@ -444,7 +444,8 @@ IRenderingElement generateHashedWedgeBond(IAtom from, IAtom to, List toBo } // only slant if the angle isn't shallow - if (refVector.angle(unit) > threshold) { + double theta = refVector.angle(unit); + if (theta > threshold && theta + threshold + threshold < Math.PI) { hatchAngle = refVector; } }