Class: Point

OpenSeadragon.Point

A Point is really used as a 2-dimensional vector, equally useful for representing a point on a plane, or the height and width of a plane not requiring any other frame of reference.

Constructor

new Point(xopt, yopt)

Parameters:
Name Type Attributes Description
x Number <optional>
The vector component 'x'. Defaults to the origin at 0.
y Number <optional>
The vector component 'y'. Defaults to the origin at 0.
Source:

Members

x :Number

The vector component 'x'.
Type:
  • Number
Source:

y :Number

The vector component 'y'.
Type:
  • Number
Source:

Methods

apply(func) → {OpenSeadragon.Point}

Apply a function to each coordinate of this point and return a new point.
Parameters:
Name Type Description
func function The function to apply to each coordinate.
Source:
Returns:
A new point with the coordinates computed by the specified function
Type
OpenSeadragon.Point

clone() → {OpenSeadragon.Point}

Source:
Returns:
a duplicate of this Point
Type
OpenSeadragon.Point

distanceTo(point) → {Number}

Compute the distance between this point and another point.
Parameters:
Name Type Description
point OpenSeadragon.Point The point to compute the distance with.
Source:
Returns:
The distance between the 2 points
Type
Number

divide(factor) → {OpenSeadragon.Point}

Divide this point by a factor and return a new Point.
Parameters:
Name Type Description
factor Number The factor to divide vector components.
Source:
Returns:
A new point representing the division of the vector components by the factor
Type
OpenSeadragon.Point

equals(point) → {Boolean}

Check if this point is equal to another one.
Parameters:
Name Type Description
point OpenSeadragon.Point The point to compare this point with.
Source:
Returns:
true if they are equal, false otherwise.
Type
Boolean

minus(point) → {OpenSeadragon.Point}

Substract another Point to this point and return a new Point.
Parameters:
Name Type Description
point OpenSeadragon.Point The point to substract vector components.
Source:
Returns:
A new point representing the substraction of the vector components
Type
OpenSeadragon.Point

negate() → {OpenSeadragon.Point}

Compute the opposite of this point and return a new Point.
Source:
Returns:
A new point representing the opposite of the vector components
Type
OpenSeadragon.Point

plus(point) → {OpenSeadragon.Point}

Add another Point to this point and return a new Point.
Parameters:
Name Type Description
point OpenSeadragon.Point The point to add vector components.
Source:
Returns:
A new point representing the sum of the vector components
Type
OpenSeadragon.Point

rotate(degress, pivotopt) → {OpenSeadragon.Point}

Rotates the point around the specified pivot From http://stackoverflow.com/questions/4465931/rotate-rectangle-around-a-point
Parameters:
Name Type Attributes Default Description
degress Number to rotate around the pivot.
pivot OpenSeadragon.Point <optional>
(0,0) Point around which to rotate. Defaults to the origin.
Source:
Returns:
. A new point representing the point rotated around the specified pivot
Type
OpenSeadragon.Point

squaredDistanceTo(point) → {Number}

Compute the squared distance between this point and another point. Useful for optimizing things like comparing distances.
Parameters:
Name Type Description
point OpenSeadragon.Point The point to compute the squared distance with.
Source:
Returns:
The squared distance between the 2 points
Type
Number

times(factor) → {OpenSeadragon.Point}

Multiply this point by a factor and return a new Point.
Parameters:
Name Type Description
factor Number The factor to multiply vector components.
Source:
Returns:
A new point representing the multiplication of the vector components by the factor
Type
OpenSeadragon.Point

toString() → {String}

Convert this point to a string in the format (x,y) where x and y are rounded to the nearest integer.
Source:
Returns:
A string representation of this point.
Type
String