Skip to content
Snippets Groups Projects
Commit 9a0c8769 authored by JonStargaryen's avatar JonStargaryen
Browse files

cleanup

parent a3932315
No related branches found
No related tags found
No related merge requests found
...@@ -151,18 +151,11 @@ export async function calculate(runtime: RuntimeContext, structure: Structure, p ...@@ -151,18 +151,11 @@ export async function calculate(runtime: RuntimeContext, structure: Structure, p
const normalVector = Vec3.zero(); const normalVector = Vec3.zero();
const center = Vec3.zero(); const center = Vec3.zero();
const jitter = [0.001, 0.001, 0.001] as Vec3;
Vec3.sub(normalVector, membrane.planePoint1, membrane.planePoint2); Vec3.sub(normalVector, membrane.planePoint1, membrane.planePoint2);
Vec3.normalize(normalVector, normalVector); Vec3.normalize(normalVector, normalVector);
// prevent degenerate matrices (e.g., 5cbg - assembly 1 which is oriented along the y-axis)
if (Math.abs(normalVector[0]) === 1 || Math.abs(normalVector[1]) === 1 || Math.abs(normalVector[2]) === 1) {
Vec3.add(normalVector, normalVector, jitter);
}
Vec3.add(center, membrane.planePoint1, membrane.planePoint2); Vec3.add(center, membrane.planePoint1, membrane.planePoint2);
Vec3.scale(center, center, 0.5); Vec3.scale(center, center, 0.5);
Vec3.add(center, center, jitter);
const extent = adjustExtent(ctx, membrane, center); const extent = adjustExtent(ctx, membrane, center);
return { return {
......
...@@ -119,8 +119,11 @@ function getLayerCircle(builder: LinesBuilder, p: Vec3, centroid: Vec3, normal: ...@@ -119,8 +119,11 @@ function getLayerCircle(builder: LinesBuilder, p: Vec3, centroid: Vec3, normal:
} }
const tmpMat = Mat4(); const tmpMat = Mat4();
const tmpV = Vec3();
const jitter = Vec3.create(0.001, 0.001, 0.001);
function getCircle(p: Vec3, centroid: Vec3, normal: Vec3, radius: number) { function getCircle(p: Vec3, centroid: Vec3, normal: Vec3, radius: number) {
Mat4.targetTo(tmpMat, p, centroid, normal); Vec3.add(tmpV, centroid, jitter);
Mat4.targetTo(tmpMat, p, tmpV, normal);
Mat4.setTranslation(tmpMat, p); Mat4.setTranslation(tmpMat, p);
Mat4.mul(tmpMat, tmpMat, Mat4.rotX90); Mat4.mul(tmpMat, tmpMat, Mat4.rotX90);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment