|
@@ -225,6 +225,7 @@ function getSymbolScale(symbol: string) {
|
|
|
function setSymbolTransform(t: Mat4, symbol: string, axes: AssemblySymmetry.RotationAxes, size: number, structure: Structure) {
|
|
|
const eye = Vec3();
|
|
|
const target = Vec3();
|
|
|
+ const dir = Vec3();
|
|
|
const up = Vec3();
|
|
|
let pair: Mutable<AssemblySymmetry.RotationAxes> | undefined = undefined;
|
|
|
|
|
@@ -246,8 +247,8 @@ function setSymbolTransform(t: Mat4, symbol: string, axes: AssemblySymmetry.Rota
|
|
|
const a5dir = Vec3.sub(Vec3(), a5.end, a5.start);
|
|
|
pair = [a5];
|
|
|
for (const a of axes.filter(a => a.order === 3)) {
|
|
|
- let d = radToDeg(Vec3.angle(Vec3.sub(up, a.end, a.start), a5dir));
|
|
|
- if (equalEps(d, 100.81, 0.1) || equalEps(d, 79.19, 0.1)) {
|
|
|
+ const d = radToDeg(Vec3.angle(Vec3.sub(up, a.end, a.start), a5dir));
|
|
|
+ if (!pair[1] && (equalEps(d, 100.81, 0.1) || equalEps(d, 79.19, 0.1))) {
|
|
|
pair[1] = a;
|
|
|
break;
|
|
|
}
|
|
@@ -263,8 +264,8 @@ function setSymbolTransform(t: Mat4, symbol: string, axes: AssemblySymmetry.Rota
|
|
|
Vec3.copy(target, aA.end);
|
|
|
if (aB) {
|
|
|
Vec3.sub(up, aB.end, aB.start);
|
|
|
- const d = Vec3.dot(eye, up);
|
|
|
- if (d < 0) Vec3.negate(up, up);
|
|
|
+ Vec3.sub(dir, eye, target);
|
|
|
+ if (Vec3.dot(dir, up) < 0) Vec3.negate(up, up);
|
|
|
Mat4.targetTo(t, eye, target, up);
|
|
|
Mat4.scaleUniformly(t, t, size * getSymbolScale(symbol));
|
|
|
} else {
|