Packagecom.yworks.bridge.geom
Classpublic class Point2D
InheritancePoint2D Inheritance YObject Inheritance Object
Implements Clonable
Subclasses Point2DDouble

The Point2D class defines a point representing a location in (x, y) coordinate space. This class is only the abstract superclass for all objects that store a 2D coordinate. The actual storage representation of the coordinates is left to the subclass.



Public Properties
 PropertyDefined By
  location : Point2D
[write-only] Sets the location of this Point2D to the same coordinates as the specified Point2D object.
Point2D
  x : Number
[read-only] Returns the X coordinate of this Point2D in double precision.
Point2D
  y : Number
[read-only] Returns the Y coordinate of this Point2D in double precision.
Point2D
Public Methods
 MethodDefined By
  
Point2D(init:Boolean = true)
This is an abstract class that cannot be instantiated directly.
Point2D
  
clone():Object
Point2D
  
distance(p:Point2D):Number
Returns the distance from this Point2D to a specified point.
Point2D
  
distance2(px:Number, py:Number):Number
Returns the distance from this Point2D to a specified point.
Point2D
  
distanceBetween(x1:Number, y1:Number, x2:Number, y2:Number):Number
[static] Returns the distance between two points.
Point2D
  
distanceBetweenSq(x1:Number, y1:Number, x2:Number, y2:Number):Number
[static] Returns the square of the distance between two points.
Point2D
  
Returns the square of the distance from this Point2D to a specified point.
Point2D
  
distanceSq2(px:Number, py:Number):Number
Returns the square of the distance from this Point2D to a specified point.
Point2D
  
equals(obj:Object):Boolean
[override] Determines whether or not two points are equal.
Point2D
  
getClass():Class
[override]
Point2D
  
hashCode():int
[override]
Point2D
  
setLocation(x:Number, y:Number):void
Sets the location of this Point2D to the specified double coordinates.
Point2D
Protected Methods
 MethodDefined By
  
cloneImpl(o:Object):void
Point2D
  
Point2D
Property Detail
locationproperty
location:Point2D  [write-only]

Sets the location of this Point2D to the same coordinates as the specified Point2D object.


Implementation
    public function set location(value:Point2D):void
xproperty 
x:Number  [read-only]

Returns the X coordinate of this Point2D in double precision.


Implementation
    public function get x():Number
yproperty 
y:Number  [read-only]

Returns the Y coordinate of this Point2D in double precision.


Implementation
    public function get y():Number
Constructor Detail
Point2D()Constructor
public function Point2D(init:Boolean = true)

This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
clone()method
public function clone():Object

Returns
Object
cloneImpl()method 
protected function cloneImpl(o:Object):void

Parameters

o:Object

distance()method 
public function distance(p:Point2D):Number

Returns the distance from this Point2D to a specified point.

Parameters

p:Point2D — the specified Point2D

Returns
Number — the distance between this Point2D to a specified Point2D.
distance2()method 
public function distance2(px:Number, py:Number):Number

Returns the distance from this Point2D to a specified point.

Parameters

px:Number — the x coordinate of the other point.
 
py:Number — the y coordinate of the other point.

Returns
Number — the distance between this Point2D and the specified point.
distanceBetween()method 
public static function distanceBetween(x1:Number, y1:Number, x2:Number, y2:Number):Number

Returns the distance between two points.

Parameters

x1:Number — the x coordinate of the first point.
 
y1:Number — the y coordinate of the first point.
 
x2:Number — the x coordinate of the second point.
 
y2:Number — the y coordinate of the second point.

Returns
Number — the distance between the two sets of specified coordinates.
distanceBetweenSq()method 
public static function distanceBetweenSq(x1:Number, y1:Number, x2:Number, y2:Number):Number

Returns the square of the distance between two points.

Parameters

x1:Number — the x coordinate of the first point.
 
y1:Number — the y coordinate of the first point.
 
x2:Number — the x coordinate of the second point.
 
y2:Number — the y coordinate of the second point.

Returns
Number — the square of the distance between the two sets of specified coordinates.
distanceSq()method 
public function distanceSq(p:Point2D):Number

Returns the square of the distance from this Point2D to a specified point.

Parameters

p:Point2D — the specified Point2D

Returns
Number — the square of the distance between this Point2D to a specified Point2D.
distanceSq2()method 
public function distanceSq2(px:Number, py:Number):Number

Returns the square of the distance from this Point2D to a specified point.

Parameters

px:Number — the x coordinate of the other point.
 
py:Number — the y coordinate of the other point.

Returns
Number — the square of the distance between this Point2D and the specified point.
equals()method 
override public function equals(obj:Object):Boolean

Determines whether or not two points are equal. Two instances of Point2D are equal if the values of their x and y member fields, representing their position in the coordinate space, are the same.

Parameters

obj:Object — an object to be compared with this Point2D.

Returns
Boolean — true if the object to be compared is an instance of Point2D and has the same values; false otherwise.
getClass()method 
override public function getClass():Class

Returns
Class
hashCode()method 
override public function hashCode():int

Returns
int
initPoint2D()method 
protected final function initPoint2D():void

setLocation()method 
public function setLocation(x:Number, y:Number):void

Sets the location of this Point2D to the specified double coordinates.

Parameters

x:Number — the new x coordinate of this point.
 
y:Number — the new y coordinate of this point.