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
Methods
Name | Description | |
---|---|---|
constructor(x: number0, y: number0, z: number0): XYZ Protected | ||
addInPlace(other: Readonly<WritableXYAndZ>): void | Add x,y,z from other in place. | |
addScaledInPlace(other: Readonly<WritableXYAndZ>, scale: number): void | Add (in place) the scaled x,y,z of other | |
addXYZInPlace(dx: number0.0, dy: number0.0, dz: number0.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: Readonly<WritableXYAndZ>): number | Return the distance from this point to other | |
distanceSquared(other: Readonly<WritableXYAndZ>): number | Return squared distance from this point to other | |
distanceSquaredXY(other: Readonly<WritableXAndY>): number | Return squared XY distance from this point to other | |
distanceXY(other: Readonly<WritableXAndY>): number | Return the XY distance from this point to other | |
freeze(): Readonly<XYZ> | Freeze this XYZ | |
indexOfMaxAbs(): number | Return the index (0,1,2) of the x,y,z component with largest absolute value | |
isAlmostEqual(other: Readonly<Readonly<WritableXYAndZ>>, tol?: number): boolean | Returns true if this and other have equal x,y,z parts within Geometry.smallMetricDistance. | |
isAlmostEqualMetric(other: Readonly<WritableXYAndZ>): boolean | Equality test with Geometry.smallMetricDistance tolerance | |
isAlmostEqualPointPlusScaledVector(other: Readonly<WritableXYAndZ>, vector: Readonly<WritableXYAndZ>, scale: number, tol?: number): boolean | Return true if this and {other + vector*scale} have equal x,y,z parts within Geometry.smallMetricDistance. | |
isAlmostEqualXY(other: Readonly<WritableXAndY>, 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: Readonly<WritableXYAndZ>): 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: Readonly<WritableXYAndZ>): number | Return the largest absolute distance between corresponding components | |
scaleInPlace(scale: number): void | Multiply the x, y, z parts by scale. | |
scaledVectorTo(other: Readonly<WritableXYAndZ>, scale: number, result?: Vector3d): Vector3d | Return a multiple of a the (full length) vector from this point to other | |
set(x: number0, y: number0, z: number0): void | Set the x,y,z parts. | |
setAt(index: number, value: number): void | Set value at index 0 or 1 or 2 | |
setFrom(other: Float64Array | Readonly<WritableXAndY> | Readonly<WritableXYAndZ>): void | Set the x,y,z parts from one of these input types | |
setFromJSON(json?: XYZProps): void | Set the x,y,z properties from one of several json forms: | |
setFromPoint3d(other?: Readonly<WritableXYAndZ>): void | Set the x,y,z parts from a Point3d. | |
setFromVector3d(other?: Vector3d): void | Set the x,y,z parts from a Vector3d | |
setZero(): void | Set the x,y,z parts to zero. | |
subtractInPlace(other: Readonly<WritableXYAndZ>): void | Subtract x,y,z from other in place. | |
toArray(): number[] | Return as an array [x,y,z] |
|
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: Readonly<WritableXYAndZ>, result?: Vector3d): undefined | Vector3d | Return a unit vector from this vector to other. | |
vectorTo(other: Readonly<WritableXYAndZ>, result?: Vector3d): Vector3d | Return a (full length) vector from this point to other | |
accessX(arg: any, defaultValue?: number): undefined | number Static | Look for (in order) an x coordinate present as: | |
accessY(arg: any, defaultValue?: number): undefined | number Static | Look for (in order) an x coordinate present as: | |
accessZ(arg: any, defaultValue?: number): undefined | number Static | Look for (in order) an x coordinate present as: | |
hasZ(arg: any): arg is Readonly<WriteableHasZ> Static | Type guard to determine whether an object has a member called "z" | |
isAnyImmediatePointType(arg: any): arg is number[] | Readonly<WritableXAndY> | Readonly<WritableXYAndZ> Static | Test if arg is any of: | |
isXAndY(arg: any): arg is Readonly<WritableXAndY> Static | Type guard for XAndY. | |
isXYAndZ(arg: any): arg is Readonly<WritableXYAndZ> Static | Type guard for XYAndZ. | |
x(xyz: XYZProps, defaultValue: number0): number Static | Access x part of XYZProps (which may be .x or [0]) | |
y(xyz: XYZProps, defaultValue: number0): number Static | Access x part of XYZProps (which may be .x or [0]) | |
z(xyz: XYZProps, defaultValue: number0): number Static | Access x part of XYZProps (which may be .x or [0]) |
Properties
Defined in
- geometry3d/Point3dVector3d.ts Line 24
Last Updated: 28 October, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.