Browse Source

use unit/structure boundary for interactions geo

Alexander Rose 4 years ago
parent
commit
6662dbfdd6

+ 7 - 1
src/mol-model-props/computed/representations/interactions-inter-unit-cylinder.ts

@@ -21,6 +21,7 @@ import { InteractionsProvider } from '../interactions';
 import { LocationIterator } from '../../../mol-geo/util/location-iterator';
 import { InteractionFlag } from '../interactions/common';
 import { Unit } from '../../../mol-model/structure/structure';
+import { Sphere3D } from '../../../mol-math/geometry';
 
 const tmpLoc = StructureElement.Location.create(void 0);
 
@@ -67,7 +68,12 @@ function createInterUnitInteractionCylinderMesh(ctx: VisualContext, structure: S
         ignore: (edgeIndex: number) => edges[edgeIndex].props.flag === InteractionFlag.Filtered
     };
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh);
+    const m = createLinkCylinderMesh(ctx, builderProps, props, mesh);
+
+    const sphere = Sphere3D.expand(Sphere3D(), structure.boundary.sphere, 1 * sizeFactor);
+    m.setBoundingSphere(sphere);
+
+    return m;
 }
 
 export const InteractionsInterUnitParams = {

+ 7 - 1
src/mol-model-props/computed/representations/interactions-intra-unit-cylinder.ts

@@ -20,6 +20,7 @@ import { VisualUpdateState } from '../../../mol-repr/util';
 import { LocationIterator } from '../../../mol-geo/util/location-iterator';
 import { Interactions } from '../interactions/interactions';
 import { InteractionFlag } from '../interactions/common';
+import { Sphere3D } from '../../../mol-math/geometry';
 
 async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<InteractionsIntraUnitParams>, mesh?: Mesh) {
     if (!Unit.isAtomic(unit)) return Mesh.createEmpty(mesh);
@@ -53,7 +54,12 @@ async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit:
         ignore: (edgeIndex: number) => flag[edgeIndex] === InteractionFlag.Filtered
     };
 
-    return createLinkCylinderMesh(ctx, builderProps, props, mesh);
+    const m = createLinkCylinderMesh(ctx, builderProps, props, mesh);
+
+    const sphere = Sphere3D.expand(Sphere3D(), unit.boundary.sphere, 1 * sizeFactor);
+    m.setBoundingSphere(sphere);
+
+    return m;
 }
 
 export const InteractionsIntraUnitParams = {