XYZ Class
XYZ
is a minimal object containing x,y,z and operations that are meaningful without change in both point and vector.XYZ
is not instantiable.- The derived (instantiable) classes are
Point3d
Vector3d
Extended by
Implements
- object
Methods
Name | Description | |
---|---|---|
constructor(x: number = 0, y: number = 0, z: number = 0): XYZ Protected | ||
addInPlace(other: XYAndZ): void | add x,y,z from other in place. | |
addScaledInPlace(other: XYAndZ, scale: number): void | add (in place) the scaled x,y,z of other | |
addXYZInPlace(dx: number = 0, dy: number = 0, dz: number = 0): void | add to x, y, z parts | |
at(index: number): number | Return the x,y, z component corresponding to 0,1,2. | |
cloneAsPoint3d(): Point3d | Clone strongly typed as Point3d | |
distance(other: XYAndZ): number | Return the distance from this point to other | |
distanceSquared(other: XYAndZ): number | Return squared distance from this point to other | |
distanceSquaredXY(other: XAndY): number | Return squared XY distance from this point to other | |
distanceXY(other: XAndY): number | Return the XY distance from this point to other | |
freeze(): void | Freeze this XYZ | |
indexOfMaxAbs(): number | Return the index (0,1,2) of the x,y,z component with largest absolute value | |
isAlmostEqual(other: XYAndZ, tol?: number): boolean | Returns true if this and other have equal x,y,z parts within Geometry.smallMetricDistance. | |
isAlmostEqualMetric(other: XYAndZ): boolean | equality test with Geometry.smallMetricDistance tolerance | |
isAlmostEqualXY(other: XAndY, tol?: number): boolean | Return true if this and other have equal x,y parts within Geometry.smallMetricDistance. | |
isAlmostEqualXYZ(x: number, y: number, z: number, tol?: number): boolean | Return true if this and other have equal x,y,z parts within Geometry.smallMetricDistance. | |
isExactEqual(other: XYAndZ): boolean | exact equality test. | |
magnitude(): number | Return the sqrt of the sum of squared x,y,z parts | |
magnitudeSquared(): number | Return the sum of squared x,y,z parts | |
magnitudeSquaredXY(): number | Return the sum of squared x,y parts | |
magnitudeXY(): number | Return sqrt of the sum of squared x,y parts | |
maxAbs(): number | Return the largest absolute value of any component | |
maxDiff(other: XYAndZ): number | Return the largest absolute distance between corresponding components | |
scaleInPlace(scale: number): void | Multiply the x, y, z parts by scale. | |
scaledVectorTo(other: XYAndZ, scale: number, result?: Vector3d): Vector3d | Return a multiple of a the (full length) vector from this point to other | |
set(x: number = 0, y: number = 0, z: number = 0): void | Set the x,y,z parts. | |
setFrom(other: Float64Array | XAndY | XYAndZ | undefined): void | Set the x,y,z parts from one of these input types XYZ -- copy the x,y,z parts Float64Array -- Copy from indices 0,1,2 to x,y,z * XY -- copy the x, y parts and set z=0 |
|
setFromJSON(json?: XYZProps): void | Set the x,y,z properties from one of several json forms: array of numbers: [x,y,z] object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue} |
|
setFromPoint3d(other?: XYAndZ): void | Set the x,y,z parts from a Point3d. | |
setFromVector3d(other: Vector3d): void | Set the x,y,z parts from a Vector3d This is the same effect as setFrom(other) with no pretesting of variant input type |
|
setZero(): void | Set the x,y,z parts to zero. | |
subtractInPlace(other: XYAndZ): void | add x,y,z from other in place. | |
toFloat64Array(): Float64Array | Pack the x,y,z values in a Float64Array. | |
toJSON(): XYZProps | Return a JSON object as array [x,y,z] |
|
toJSONXYZ(): XYZProps | Return a JSON object as key value pairs {x: value, y: value, z: value} |
|
unitVectorTo(target: XYAndZ, result?: Vector3d): Vector3d | undefined | Return a unit vector from this vector to other. | |
vectorTo(other: XYAndZ, result?: Vector3d): Vector3d | Return a (full length) vector from this point to other | |
accessX(arg: any, defaultValue?: number): number | undefined Static | Look for (in order) an x coordinate present as: arg.x arg[0] |
|
accessY(arg: any, defaultValue?: number): number | undefined Static | Look for (in order) an x coordinate present as: arg.y arg[1] |
|
accessZ(arg: any, defaultValue?: number): number | undefined Static | Look for (in order) an x coordinate present as: arg.z arg[2] |
|
hasZ(arg: any): boolean Static | Type guard to determine whether an object has a member called "z" | |
isAnyImmediatePointType(arg: any): boolean Static | Test if arg is any of: XAndY XYAndZ [number,number] [number,number,number] |
|
isXAndY(arg: any): boolean Static | Type guard for XAndY. | |
isXYAndZ(arg: any): boolean Static | Type guard for XYAndZ. |
Properties
Defined in
Last Updated: 08 January, 2020