Point4d Class
4 Dimensional point (x,y,z,w) used in perspective calculations.
- the coordinates are stored in a Float64Array of length 4.
- properties
x
,y
,z
,w
access array members. - The coordinates are physically stored as a single Float64Array with 4 entries. (w last)
Extends
Implements
Methods
Name | Description | |
---|---|---|
constructor(x: number0, y: number0, z: number0, w: number0): Point4d Protected | Construct from coordinates. | |
altitude(point: Point3d): number | dotProduct with (point.x, point.y, point.z, 1) Used in PlaneAltitudeEvaluator interface | |
altitudeXYZ(x: number, y: number, z: number): number | dotProduct with (x, y, z, 1) Used in PlaneAltitudeEvaluator interface | |
clone(result?: Point4d): Point4d | Clone this point | |
crossWeightedMinus(other: Point4d, result?: Vector3d): Vector3d | Return ((other.w * this) - (this.w * other)) |
|
crossWeightedMinusPoint3d(other: Point3d, result?: Vector3d): Vector3d | Return ((other.w * this) - (this.w * other)) , with other.w known to be 1 |
|
distanceSquaredXYZW(other: Point4d): number | Return the squared 4d distance from this point to other, with all 4 components squared into the hypotenuse. | |
distanceXYZW(other: Point4d): number | Return the 4d distance from this point to other, with all 4 components squared into the hypotenuse. | |
dotProduct(other: Point4d): number | return (4d) dot product of the instance and other point. | |
dotProductXYZW(x: number, y: number, z: number, w: number): number | return (4d) dot product of the instance with xyzw | |
dotVectorsToTargets(targetA: Point4d, targetB: Point4d): number | Return dot product of (4d) vectors from the instance to targetA and targetB | |
interpolate(fraction: number, pointB: Point4d, result?: Point4d): Point4d | Return interpolation between instance and pointB at fraction | |
isAlmostEqual(other: Point4d): boolean | Near-equality test, using Geometry.isSameCoordinate on all 4 x,y,z,w |
|
isAlmostEqualXYZW(x: number, y: number, z: number, w: number): boolean | Test for same coordinate by direct x,y,z,w args | |
magnitudeSquaredXYZ(): number | Returns the magnitude of the leading xyz components. | |
magnitudeXYZW(): number | Returns the magnitude including all 4 components x,y,z,w | |
maxAbs(): number | Return the largest absolute entry of all 4 components x,y,z,w | |
maxDiff(other: Point4d): number | Return the largest absolute distance between corresponding components | |
minus(other: Point4d, result?: Point4d): Point4d | Return the difference (this-other) using all 4 components x,y,z,w | |
negate(result?: Point4d): Point4d | Negate components (including w!!) | |
normalizeQuaternion(): number | Normalize so sum of squares of all 4 coordinates is 1. | |
normalizeWeight(result?: Point4d): undefined | Point4d | If this.w is nonzero, return a 4d point (x/w,y/w,z/w, 1) |
|
normalizeXYZW(result?: Point4d): undefined | Point4d | divide all components (x,y,z,w) by the 4d magnitude. | |
normalX(): number | Return the x component of the normal used to evaluate altitude. | |
normalY(): number | Return the x component of the normal used to evaluate altitude. | |
normalZ(): number | Return the z component of the normal used to evaluate altitude. | |
plus(other: Point4d, result?: Point4d): Point4d | Return the sum of this and other, using all 4 components x,y,z,w | |
plus2Scaled(vectorA: Point4d, scalarA: number, vectorB: Point4d, scalarB: number, result?: Point4d): Point4d | Return point + vectorA * scalarA + vectorB * scalarB |
|
plus3Scaled(vectorA: Point4d, scalarA: number, vectorB: Point4d, scalarB: number, vectorC: Point4d, scalarC: number, result?: Point4d): Point4d | Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC |
|
plusScaled(vector: Point4d, scaleFactor: number, result?: Point4d): Point4d | Return point + vector * scalar |
|
projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d | * Return xyz projection of spacePoint to the plane (this Point4d is understood as plane coefficients, not point coordinates) | |
radiansToPoint4dXYZW(other: Point4d): undefined | number | Measure the "angle" between two points, using all 4 components in the dot product that | |
realDistanceXY(other: Point4d): undefined | number | Return the distance between the instance and other after normalizing by weights | |
realPoint(result?: Point3d): undefined | Point3d | If this.w is nonzero, return a 3d point (x/w,y/w,z/w) |
|
realPointDefault000(result?: Point3d): Point3d | * If this.w is nonzero, return Point3d with x/w,y/w,z/w. | |
realPointOrVector(): Point3d | Vector3d | Convert the homogeneous point to a (strongly typed) point or vector. | |
safeDivideOrNull(denominator: number, result?: Point4d): undefined | Point4d | Divide by denominator, but return undefined if denominator is zero. | |
scale(scale: number, result?: Point4d): Point4d | scale all components (including w!!) | |
set(x: number0, y: number0, z: number0, w: number0): Point4d | Set x,y,z,w of this point. | |
setComponent(index: number, value: number): void | Set a component by index. | |
setFrom(other: Point4d): Point4d | Copy coordinates from other . |
|
setFromJSON(json?: Point4dProps): void | Set this point's xyzw from a json array [x,y,z,w] |
|
toJSON(): Point4dProps | Convert an Angle to a JSON object. | |
toPlane3dByOriginAndUnitNormal(result?: Plane3dByOriginAndUnitNormal): undefined | Plane3dByOriginAndUnitNormal | Treating this Point4d as plane coefficients, convert to origin and normal form. | |
velocity(vector: Vector3d): number | dotProduct with (vector.x, vector.y, vector.z, 0). | |
velocityXYZ(x: number, y: number, z: number): number | dotProduct with (x,y,z, 0). | |
weightedAltitude(point: Point4d): number | dotProduct with (point.x, point.y, point.z, point.w) Used in PlaneAltitudeEvaluator interface | |
create(x: number0, y: number0, z: number0, w: number0, result?: Point4d): Point4d Static | Return a Point4d with specified x,y,z,w | |
createAdd2Scaled(vectorA: Point4d, scalarA: number, vectorB: Point4d, scalarB: number, result?: Point4d): Point4d Static | Return point + vectorA * scalarA + vectorB * scalarB |
|
createAdd3Scaled(vectorA: Point4d, scalarA: number, vectorB: Point4d, scalarB: number, vectorC: Point4d, scalarC: number, result?: Point4d): Point4d Static | Return point + vectorA \ scalarA + vectorB * scalarB + vectorC * scalarC |
|
createFromPacked(data: Float64Array, xIndex: number0, result?: Point4d): undefined | Point4d Static | extract 4 consecutive numbers from a Float64Array into a Point4d. | |
createFromPackedXYZ(data: Float64Array, xIndex: number0, result?: Point4d): undefined | Point4d Static | extract 3 consecutive numbers from a Float64Array into the xyz values of a Point4d with w = 1. | |
createFromPackedXYZW(data: Float64Array, xIndex: number0, result?: Point4d): Point4d Static | extract 4 consecutive numbers from a Float64Array into a Point4d. | Deprecated |
createFromPoint(point: number[] | Readonly<WritableXAndY> | Readonly<WritableXYAndZ> | Point4d): Point4d Static | Create a Point4d from |
|
createFromPointAndWeight(xyz: Readonly<WritableXYAndZ>, w: number): Point4d Static | Create a Point4d with x,y,z from an XYAndZ input, and w from a separate number. |
|
createPlaneFrom(source: PlaneAltitudeEvaluator): undefined | Point4d Static | Create a "Point4d as a plane" from "any" other PlaneAltitudeEvaluator type. | |
createPlanePointPointZ(pointA: Point4d, pointB: Point4d, result?: Point4d): Point4d Static | Create plane coefficients for the plane containing pointA, pointB, and 0010. | |
createRealDerivativePlane3dByOriginAndVectorsDefault000(x: number, y: number, z: number, w: number, dx: number, dy: number, dz: number, dw: number, ddx: number, ddy: number, ddz: number, ddw: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors Static | * If w is nonzero, return Vector3d which is the derivative of the projected xyz with given w and 4d derivatives. | |
createRealDerivativeRay3dDefault000(x: number, y: number, z: number, w: number, dx: number, dy: number, dz: number, dw: number, result?: Ray3d): Ray3d Static | * If w is nonzero, return Vector3d which is the derivative of the projected xyz with given w and 4d derivatives. | |
createRealPoint3dDefault000(x: number, y: number, z: number, w: number, result?: Point3d): Point3d Static | * If w is nonzero, return Point3d with x/w,y/w,z/w. | |
createZero(): Point4d Static | Create a point with zero in all coordinates. | |
determinantIndexed3X3(pointA: Point4d, pointB: Point4d, pointC: Point4d, i: number, j: number, k: number): number Static | Return the determinant of the 3x3 matrix using components i,j,k of the 3 inputs. | |
fromJSON(json?: Point4dProps): Point4d Static | Create a new point with coordinates from a json array [x,y,z,w] |
|
interpolateQuaternions(quaternion0: Point4d, fractionParameter: number, quaternion1: Point4d, result?: Point4d): Point4d Static | Return a (normalized) quaternion interpolated between two quaternions. | |
perpendicularPoint4dPlane(pointA: Point4d, pointB: Point4d, pointC: Point4d): Point4d Static | Return a Point4d perpendicular to all 3 inputs. | |
unitW(): Point4d Static | unit W vector | |
unitX(): Point4d Static | unit X vector | |
unitY(): Point4d Static | unit Y vector | |
unitZ(): Point4d Static | unit Z vector |
Inherited methods
Name | Inherited from | Description |
---|---|---|
classifyAltitude(point: Point3d, tolerance: numberGeometry.smallMetricDistance): "-1" | "0" | "1" Inherited | Plane3d | Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is |
classifyAltitudeXYZ(x: number, y: number, z: number, tolerance: numberGeometry.smallMetricDistance): "-1" | "0" | "1" Inherited | Plane3d | Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is |
getAnyPointOnPlane(result?: Point3d): Point3d Inherited | Plane3d | Return any point on the plane. |
getUnitNormal(result?: Vector3d): undefined | Vector3d Inherited | Plane3d | Return the unit normal for the plane. |
isPointInPlane(spacePoint: Point3d, tolerance: numberGeometry.smallMetricDistance): boolean Inherited | Plane3d | Returns true if spacePoint is within distance tolerance of the plane. |
Properties
Name | Type | Description | |
---|---|---|---|
isAlmostZero Accessor ReadOnly | boolean | Test if all components are nearly zero. | |
w Accessor | number | The w component of this point. | |
x Accessor | number | The x component. | |
xyzw | Float64Array | x,y,z,w are packed into a Float64Array | |
y Accessor | number | The y component. | |
z Accessor | number | The z component. |
Defined in
- geometry4d/Point4d.ts Line 46
Last Updated: 21 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.