Explorar o código

fix .expandBySphere and .expand in Sphere3D

Alexander Rose %!s(int64=5) %!d(string=hai) anos
pai
achega
ee35e39611
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/mol-math/geometry/primitives/sphere3d.ts

+ 4 - 2
src/mol-math/geometry/primitives/sphere3d.ts

@@ -107,13 +107,15 @@ namespace Sphere3D {
     }
 
     /** Expand sphere radius by another sphere */
-    export function expandBySphere(out: Sphere3D, sphere: Sphere3D) {
-        out.radius = Math.max(out.radius, Vec3.distance(out.center, sphere.center) + sphere.radius)
+    export function expandBySphere(out: Sphere3D, sphere: Sphere3D, by: Sphere3D) {
+        Vec3.copy(out.center, sphere.center)
+        out.radius = Math.max(sphere.radius, Vec3.distance(sphere.center, by.center) + by.radius)
         return out
     }
 
     /** Expand sphere radius by delta */
     export function expand(out: Sphere3D, sphere: Sphere3D, delta: number): Sphere3D {
+        Vec3.copy(out.center, sphere.center)
         out.radius = sphere.radius + delta
         return out
     }