Point class

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.

Available Extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Point([num? x, num? y])
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

alloc() Point
allocAt(num x, num y) Point
compareWithLineSegment(num a1x, num a1y, num a2x, num a2y, num px, num py) num
This static function compares a point with a finite line segment.
direction(num px, num py, num qx, num qy) num
This static function returns the angle in degrees of the line from point P to point Q.
distanceLineSegmentSquared(num px, num py, num ax, num ay, num bx, num by) num
This static function returns the square of the distance from the point P to the finite line segment from point A to point B.
distanceSquared(num px, num py, num qx, num qy) num
This static function returns the square of the distance from the point P to the point Q.
free(Point temp) → void
intersectingLineSegments(num a1x, num a1y, num a2x, num a2y, num b1x, num b1y, num b2x, num b2y) bool
This static function is true if two finite straight line segments intersect each other.
parse(String str) Point
This static function can be used to read in a Point from a string that was produced by Point.stringify.
stringify(Point val) String
This static function can be used to write out a Point as a string that can be read by Point.parse.