API Reference > geometry-core > CartesianGeometry > Point2d Point2d Class 2D point with x,y as properties Extends XY Implements { T } BeJSONFunctions Methods Name Description constructor(x: number = 0, y: number = 0): Point2d Constructor for Point2d addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d): Point2d Starting at this point, move along vector by tangentFraction of the vector length, and to the left by leftFraction of clone(): Point2d return a new Point2d with x,y coordinates from this. crossProductToPoints(target1: XAndY, target2: XAndY): number Returns the (scalar) cross product of two points/vectors, computed from origin to target1 and target2 dotVectorsToTargets(targetA: XAndY, targetB: XAndY): number Return the dot product of vector from this to targetA and vector from this to targetB forwardLeftInterpolate(tangentFraction: number, leftFraction: number, point: XAndY): Point2d Interpolate at tangentFraction between this instance and point. fractionOfProjectionToLine(startPoint: Point2d, endPoint: Point2d, defaultFraction?: number): number Return the fractional coordinate of the projection of this instance x,y onto the line from startPoint to endPoint. interpolate(fraction: number, other: XAndY, result?: Point2d): Point2d Return a point interpolated between this point and the right param. interpolateXY(fractionX: number, fractionY: number, other: XAndY, result?: Point2d): Point2d Return a point with independent x,y fractional interpolation. minus(vector: XAndY, result?: Point2d): Point2d Return this point minus vector plus(vector: XAndY, result?: Point2d): Point2d Return point plus vector plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Point2d): Point2d Return point + vectorA * scalarA + vectorB * scalarB plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, vectorC: XAndY, scalarC: number, result?: Point2d): Point2d Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC plusScaled(vector: XAndY, scaleFactor: number, result?: Point2d): Point2d Return point + vector * scalar plusXY(dx: number = 0, dy: number = 0, result?: Point2d): Point2d Return point plus vector create(x: number = 0, y: number = 0, result?: Point2d): Point2d Static Return a point (newly created unless result provided) with given x,y coordinates createFrom(xy: XAndY | undefined, result?: Point2d): Point2d Static Create (or optionally reuse) a Point2d from another object with fields x and y createZero(result?: Point2d): Point2d Static Create a Point2d with both coordinates zero. fromJSON(json?: XYProps): Point2d Static Convert JSON [1,2] or {x:1, y:2} to a Point2d instance Inherited methods Name Inherited from Description distance(other: XAndY): number XY Return the distance from this point to other distanceSquared(other: XAndY): number XY Return squared distance from this point to other freeze(): void XY Freeze this instance (and its deep content) so it can be considered read-only isAlmostEqual(other: XAndY, tol?: number): boolean XY Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. isAlmostEqualMetric(other: XAndY): boolean XY returns true if x,y match other within metric tolerance isAlmostEqualXY(x: number, y: number, tol?: number): boolean XY Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. isExactEqual(other: XAndY): boolean XY returns true if the x,y components are exactly equal. magnitude(): number XY Return the magnitude of the vector magnitudeSquared(): number XY Return the squared magnitude of the vector. maxAbs(): number XY Return the largest absolute value of any component maxDiff(other: XAndY): number XY Return the largest absolute distance between corresponding components set(x: number = 0, y: number = 0): void XY Set both x and y. setFrom(other?: XAndY): void XY Set both x and y from other. setFromJSON(json?: XYProps): void XY Set x and y from a JSON source such as [1,2] or {x:1, y:2} setZero(): void XY Set both x and y to zero toJSON(): XYProps XY return a json array [x,y] toJSONXY(): XYProps XY return a json object {x: 1, y:2} unitVectorTo(target: XAndY, result?: Vector2d): Vector2d | undefined XY Return a unit vector from this point to other vectorTo(other: XAndY, result?: Vector2d): Vector2d XY Return a (full length) vector from this point to other crossProductToPoints(origin: XAndY, targetA: XAndY, targetB: XAndY): number Static XY cross product of vectors from origin to targets Inherited properties Name Type Inherited from Description isAlmostZero Accessor ReadOnly boolean XY returns true if the x,y components are both small by metric metric tolerance x number XY x component y number XY y component Defined in core/geometry/src/geometry3d/Point2dVector2d.ts Line 122 Last Updated: 13 June, 2024