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.  
setAt(index: number, value: number): void Return the x,y, z component corresponding to 0,1,2.  
setFrom(other: Float64Array | XAndY | XYAndZ | undefined): 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?: XYAndZ): 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: 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:  
accessY(arg: any, defaultValue?: number): number | undefined Static Look for (in order) an x coordinate present as:  
accessZ(arg: any, defaultValue?: number): number | undefined Static Look for (in order) an x coordinate present as:  
hasZ(arg: any): arg Static Type guard to determine whether an object has a member called "z"  
isAnyImmediatePointType(arg: any): boolean Static Test if arg is any of:  
isXAndY(arg: any): arg Static Type guard for XAndY.  
isXYAndZ(arg: any): arg Static Type guard for XYAndZ.  

Properties

Name Type Description
isAlmostZero Accessor ReadOnly boolean Return true if the if x,y,z components are all nearly zero to tolerance Geometry.smallMetricDistance  
x number x coordinate  
y number y coordinate  
z number z coordinate  

Defined in

Last Updated: 05 June, 2020