API Reference > geometry-core > CartesianGeometry > XYZ 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 Point3d Vector3d Implements XYAndZ Methods Name Description constructor(x: number = 0, y: number = 0, z: number = 0): 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: number = 0.0, dy: number = 0.0, dz: number = 0.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<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 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: 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: undefined | 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 add 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): boolean 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: undefined | XYZProps, defaultValue: number = 0): number Static access x part of XYZProps (which may be .x or [0]) y(xyz: undefined | XYZProps, defaultValue: number = 0): number Static access x part of XYZProps (which may be .x or [0]) z(xyz: undefined | XYZProps, defaultValue: number = 0): number Static access x part of XYZProps (which may be .x or [0]) 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 geometry3d/Point3dVector3d.ts Line 23 Last Updated: 12 June, 2024