Click or drag to resize

Telogis.GeoBase.Point

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Point Class

Represents a 2D spatial coordinate pair.

Constructor
NameDescription
Point(x, y)

Arguments

  • (Optional)x (Element) - The horizontal coordinate value of the Point. This may also be another Point (invoking a copy constructor), a Size (in which case Point.x is set to Size.width and Point.y to Size.height), or a DOM element with offset information (in decreasing order of priority: offset(Width|Height) dimensions; width|height attribute; CSS width|height property). Defaults to 0.

  • (Optional)y (Number) - The vertical coordinate value of the Point. Defaults to x.

Functions
NameDescription
add (Point other)

Performs component-wise addition of another Point to the calling one. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • other (Point) - The point to add to the caller.

Returns

Point - The calling point, once Point.add.other has been added to it.

distSqr (Point other)

Calculates the squared linear distance between the calling Point and another.

Arguments
  • other (Point) - The other point to find the squared distance from.

Returns

Number - The squared distance in pixels between the calling Point and Point.distSqr.other.

equals (Point other, Number tolerance)

Determines whether the calling Point is equivalent to another, component-wise.

Arguments
  • other (Point) - The Point to compare with the caller.

  • (Optional) tolerance (Number) - The permissible x- and y- differences to allow between the points while still deeming them equivalent (e.g. a one-pixel tolerance can allow for rounding errors). Defaults to 0.

Returns

Boolean - True if the components of the calling Point and Point.equals.other are equivalent; false otherwise.

isValid ()

Returns true if point is valid.

midPoint (Point other)

Finds the mid-point of the line segment defined by the calling Point and another. Does not modify the calling point.

Arguments
  • other (Point) - The other end of the line segment to find the mid-point of.

Returns

Point - The mid-point of the line segment from the calling Point to Point.midPoint.other.

multiply (Number scalar)

Performs component-wise multiplication of the calling Point by a given scalar value. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • scalar (Number) - The scalar to multiply the x- and y- coordinates of the point by.

Returns

Point - The calling point, once scaled by Point.multiply.scalar.

rotateByDegrees (Number degrees, Point origin)

Rotates, in degrees, this point around an origin. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • degrees (Number) - The amount, in degrees, to rotate this point.

  • origin (Point) - The origin of rotation, which is (0, 0) by default.

Returns

Point - The calling point, with the rotation applied.

rotateByRadians (Number radians, Point origin)

Rotates, in radians, this point around an origin. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • radians (Number) - The amount, in radians, to rotate this point.

  • origin (Point) - The origin of rotation, which is (0, 0) by default.

Returns

Point - The calling point, with the rotation applied.

rotateByRadians (Number scaleFactor, Point origin)

Scales a vector, with respect to a given origin. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • scaleFactor (Number) - The amount to scale the point by.

  • origin (Point) - The origin of the scale, which is (0, 0) by default.

Returns

Point - The calling point, with the scale applied.

round ()

Rounds the components of the calling Point to the nearest integer. A reference to the point is returned for convenience.

Returns

Point - A reference to the calling point, once rounded.

subtract (Point other)

Performs component-wise subtraction of another Point from the calling one. The result is saved in the calling point, but a reference is returned for convenience.

Arguments
  • other (Point) - The point to subtract from the caller.

Returns

Point - The calling point, once Point.subtract.other has been subtracted from it.

toString ()

Gets a string representation of the current point.

Returns

String - A string of the form '($x, $y)'.

Properties
NameTypeDescription
xNumber

The horizontal coordinate value of the Point.

yNumber

The vertical coordinate value of the Point.