UNPKG

molstar

Version:

A comprehensive macromolecular library.

43 lines (42 loc) 1.8 kB
/** * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { Vec3, Mat4 } from '../../linear-algebra'; import { PositionData } from '../common'; import { Sphere3D } from './sphere3d'; interface Box3D { min: Vec3; max: Vec3; } declare function Box3D(): Box3D; declare namespace Box3D { function create(min: Vec3, max: Vec3): Box3D; function zero(): Box3D; function copy(out: Box3D, a: Box3D): Box3D; function clone(a: Box3D): Box3D; /** Get box from sphere, uses extrema if available */ function fromSphere3D(out: Box3D, sphere: Sphere3D): Box3D; /** Get box from sphere, uses extrema if available */ function fromVec3Array(out: Box3D, array: Vec3[]): Box3D; function computeBounding(data: PositionData): Box3D; /** Get size/extent of the box */ function size(size: Vec3, box: Box3D): Vec3; /** Get volume of the box */ function volume(box: Box3D): number; /** Sets min to Number.MAX_VALUE and max to -Number.MAX_VALUE */ function setEmpty(box: Box3D): Box3D; /** Add point to box */ function add(box: Box3D, point: Vec3): Box3D; /** Expand box by delta */ function expand(out: Box3D, box: Box3D, delta: Vec3): Box3D; function scale(out: Box3D, box: Box3D, scale: number): Box3D; /** Transform box with a Mat4 */ function transform(out: Box3D, box: Box3D, m: Mat4): Box3D; function containsVec3(box: Box3D, v: Vec3): boolean; function overlaps(a: Box3D, b: Box3D): boolean; function nearestIntersectionWithRay(out: Vec3, box: Box3D, origin: Vec3, dir: Vec3): Vec3; } export { Box3D };