Gets or sets the x value of the Point.
Gets or sets the y value of the Point.
Compare this point with a finite line segment given by two Points.
This method compares this point with a finite line segment determined by the given two Points. If the point is on the finite line segment, this returns zero. If the point is on the left side of the segment, this returns a positive number. If the point is on the right side of the segment, this returns a negative number. If the point is on the infinitely extended line but not within the segment, then this returns a positive number if the point is beyond the end of the segment when going from A1 to A2, or this returns a negative number if the point comes before the segment's start at A1.
<0 if this Point is on the right side of the line segment, or >0 if this Point is on the left side, or zero if exactly on the finite line segment
Virtual
copyCompute the angle from this Point to a given Point. However, if the given Point is the same as this Point, the direction is zero.
the other Point to which to measure the relative angle.
the angle, in degrees, of the line from this Point to the given point.
Modify this point to be the closest point to this point that is on a finite line segment.
one end of the finite line segment
one end of the finite line segment
the other end of the finite line segment
the other end of the finite line segment
this modified Point
Modify this Point so that its X and Y values correspond to a particular Spot in a given Rect.
The result is meaningless if Spot.isNoSpot is true for the given Spot.
the Rect for which we are finding the point.
the Spot; Spot.isSpot must be true for this Spot.
this.
Modify this Point so that its X and Y values correspond to a particular Spot in a given rectangle.
The result is meaningless if Spot.isNoSpot is true for the given Spot.
The X coordinate of the Rect for which we are finding the point.
The Y coordinate of the Rect for which we are finding the point.
The Width of the Rect for which we are finding the point.
The Height of the Rect for which we are finding the point.
the Spot; Spot.isSpot must be true for this Spot.
this the point of the spot in the rectangle.
Modify this point to be at the nearest point on an infinite grid, given the grid's origin and size of each grid cell.
the top-left point of one of the grid cells
the top-left point of one of the grid cells
the size of each grid cell -- must be a real number larger than zero
the size of each grid cell -- must be a real number larger than zero
this modified Point
Static
compareThis static function compares a point with a finite line segment.
If the point is on the finite line segment, this returns zero. If the point is on the left side of the segment, this returns a positive number. If the point is on the right side of the segment, this returns a negative number. If the point is on the infinitely extended line but not within the segment, then this returns a positive number if the point is beyond the end of the segment when going from A1 to A2, or this returns a negative number if the point comes before the segment's start at A1.
<0 if on the right side, or >0 if on the left side, or zero if exactly on the finite line segment
Static
directionStatic
distanceThis static function returns the square of the distance from the point P to the finite line segment from point A to point B.
the euclidean distance.
Static
distanceStatic
intersectingThis static function is true if two finite straight line segments intersect each other.
True if the two given finite line segments intersect with each other, false otherwise.
Static
parseThis static function can be used to read in a Point from a string that was produced by Point.stringify.
go.Point.parse("1 2")
produces the Point new go.Point(1, 2)
.
Static
stringifyThis static function can be used to write out a Point as a string that can be read by Point.parse.
go.Point.stringify(new go.Point(1, 2))
produces the string "1 2".
Static
stringifyThis static function returns a function that can be used as a back converter for a Binding to write out a Point's values as numbers with a fixed number of digits after the decimal point.
This is useful for limiting the size of JSON output and making it more legible. It might also be useful for regression testing.
Example:
new go.Binding("location", "loc", go.Point.parse, go.Point.stringifyFixed(2))
must be a non-negative integer
a function that converts a Point to a string without so many decimals
This static function returns a function that can be used as a back converter for a Binding to write out a Point's values as numbers with a fixed number of digits after the decimal point.
This is useful for limiting the size of JSON output and making it more legible. It might also be useful for regression testing.
Example:
new go.Binding("location", "loc", go.Point.parse, go.Point.stringifyFixed(2))
a function that converts a Point to a string without so many decimals
A Point represents an x- and y-coordinate pair in two-dimensional space.
Use the static functions Point.parse and Point.stringify to convert to and from a standard string representation that is independent of the current locale.
When an instance of this class is the value of a property of a GraphObject class or Diagram or CommandHandler or a Tool class, you should treat the object as if it were frozen or read-only -- you cannot modify its properties. This allows the property to return a value without allocating a new instance. If you need to do your own calculations with the value, call copy to make a new instance with the same values that you can modify.
Many methods modify the object's properties and then return a reference to "this" object. The only instance method to allocate a new object is the copy method. The static Point.parse method also allocates a new object.
The "Debug" implementation of this class is significantly slower than the "Release" implementation, mostly due to additional error checking.
You cannot inherit from this class.