UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

130 lines (129 loc) 4.17 kB
import { BoundingBox } from './bounding-box'; import { Point3 } from './point3'; /** * A bounding sphere. * * A bounding sphere may be empty. An empty sphere contains no points. * A non-empty sphere contains at least one point. Some attributes, * such as the sphere center and radius, are defined only for spheres * that are not empty. * * A bouding sphere may be infinite. An infinite sphere contains all points. */ export declare class BoundingSphere { private _x; private _y; private _z; private _r; /** * Constructs an empty sphere. */ static AsEmpty(): BoundingSphere; /** * Constructs an infinite sphere. */ static AsInfinite(): BoundingSphere; /** * Constructs a new bounding sphere from a provided center and radius. * @param c the center point. * @param r the radius. */ static FromParameters(c: Point3, r: number): BoundingSphere; /** * Constructs a new bounding sphere from a bounding box. * @param bbox the bounding box. */ static FromBoundingBox(bbox: BoundingBox): BoundingSphere; /** * Constructs a new bounding sphere. * @param x the center x-coordinate. * @param y the center y-coordinate. * @param z the center z-coordinate. * @param r the radius. */ constructor(x: number, y: number, z: number, r: number); /** * Gets the center of this bounding sphere. */ get center(): Point3; /** * Gets the radius fo this bounding sphere. */ get radius(): number; /** * Determines whether this sphere is infinite or not. */ get isInfinite(): boolean; /** * Determines whether this sphere is empty or not. */ get isEmpty(): boolean; /** * Expands this bounding sphere to fit the provided feature. * @param b the feature by which to expand this sphere. */ expandBy(b: BoundingBox | BoundingSphere | Point3 | Point3[] | number[]): void; /** * Expands the radius of this bounding sphere by a specified feature. * @param b the feature by which to expand this sphere's radius. */ expandRadiusBy(b: BoundingSphere | BoundingBox | Point3): void; /** * Sets this sphere to an empty sphere. * @returns a reference to this sphere. */ setEmpty(): this; /** * Sets this sphere to an infinite sphere. * @returns a reference to this sphere. */ setInfinite(): this; /** * Expands this sphere to include the specified bounding sphere. * <p> * Changes only the radius, if necessary, not the center of the sphere. * @param bs the bounding sphere. */ expandRadiusByBoundingSphere(bs: BoundingSphere): void; /** * Expands this sphere to include the specified point. * <p> * Expands only the radius, if necessary, not the center of this sphere. * @param p the point. */ expandRadiusByPoint(p: Point3): void; /** * Expands this sphere to include the specified bounding box. * <p> * Changes only the radius, if necessary, not the center of this sphere. * @param bbox the bounding box. */ expandRadiusByBoundingBox(bbox: BoundingBox): void; /** * Expands this sphere to include the specified bounding sphere. * <p> * Adjusts the sphere center to minimize any increase in radius. * @param bs */ expandByBoundingSphere(bs: BoundingSphere): void; /** * Expands this bounding sphere to include a specified coordinate. * <p> * Adjusts the sphere center to minimize any increase in radius. * @param p the point. */ expandByPoint(p: Point3): void; /** * Expands this sphere to include the specified bounding box. * <p> * Adjusts the sphere center to minimize any increase in radius. * @param bbox the bounding box. */ expandByBoundingBox(bbox: BoundingBox): void; /** * Determines whether this sphere contains the specified point. * @param p the point. * @returns true, if this sphere contains the point; false, otherwise. */ contains(p: Point3): boolean; }