Browse Source

added Box3D.scale

Alexander Rose 6 years ago
parent
commit
073999c697
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/mol-math/geometry/primitives/box3d.ts

+ 7 - 1
src/mol-math/geometry/primitives/box3d.ts

@@ -43,7 +43,7 @@ namespace Box3D {
         return { min, max }
     }
 
-    /** Get size of the box */
+    /** Get size/extent of the box */
     export function size(size: Vec3, box: Box3D): Vec3 {
         return Vec3.sub(size, box.max, box.min);
     }
@@ -75,6 +75,12 @@ namespace Box3D {
         return out
     }
 
+    export function scale(out: Box3D, box: Box3D, scale: number) {
+        Vec3.scale(out.min, box.min, scale)
+        Vec3.scale(out.max, box.max, scale)
+        return out;
+    }
+
     const tmpTransformV = Vec3()
     /** Transform box with a Mat4 */
     export function transform(out: Box3D, box: Box3D, m: Mat4): Box3D {