The Point object represents a point in the two dimensional space of the Illustrator document. Some functions also use it as a two dimensional vector object.
Creates a Point object using the width and height values of the given Size object.
Sample code:
// Create a Size with a width of 100pt and a height of 50pt var size = new Size(100, 50); print(size); // prints { width: 100.0, height: 50.0 } var point = new Point(size); print(point); // prints { x: 100.0, y: 50.0 }
Returns the addition of the supplied point to the point as a new point.
The object itself is not modified!
Sample code:
var point1 = new Point(5, 10); var point2 = new Point(10, 20); var result = point1 + point2; print(result); // { x: 15.0, y: 30.0 }
Returns the addition of the supplied value to both coordinates of the point as a new point.
The object itself is not modified!
Sample code:
var point = new Point(5, 10); var result = point + 20; print(result); // { x: 25.0, y: 30.0 }
Returns the subtraction of the supplied point from the point as a new point.
The object itself is not modified!
Sample code:
var firstPoint = new Point(10, 20); var secondPoint = new Point(5, 5); var result = firstPoint - secondPoint; print(result); // { x: 5.0, y: 15.0 }
Returns the subtraction of the supplied value from both coordinates of the point as a new point.
The object itself is not modified!
Sample code:
var point = new Point(10, 20); var result = point - 5; print(result); // { x: 5.0, y: 15.0 }
Returns the multiplication of the point with the supplied point as a new point.
The object itself is not modified!
Sample code:
var firstPoint = new Point(5, 10); var secondPoint = new Point(4, 2); var result = firstPoint * secondPoint; print(result); // { x: 20.0, y: 20.0 }
Returns the multiplication of the supplied value with both coordinates of the point as a new point.
The object itself is not modified!
Sample code:
var point = new Point(10, 20); var result = point * 2; print(result); // { x: 20.0, y: 40.0 }
Returns the division of the point by the supplied point as a new point.
The object itself is not modified!
Sample code:
var firstPoint = new Point(8, 10); var secondPoint = new Point(2, 5); var result = firstPoint / secondPoint; print(result); // { x: 4.0, y: 2.0 }
Returns the division of both coordinates of the point by the supplied value and returns it as a new point.
The object itself is not modified!
Sample code:
var point = new Point(10, 20); var result = point / 2; print(result); // { x: 5.0, y: 10.0 }
The modulo operator returns the integer remainders of dividing the point by the supplied point as a new point.
Sample code:
var point = new Point(12, 6); print(point % new Point(5, 2)); // {x: 2, y: 0}
The modulo operator returns the integer remainders of dividing the point by the supplied value as a new point.
Sample code:
var point = new Point(12, 6); print(point % 5); // {x: 2, y: 1}
The length of the vector that is represented by this point's coordinates.
Each point can be interpreted as a vector that points from the origin (x = 0 ,y = 0 ) to the point's location.
Setting the length changes the location but keeps the vector's angle.
The angle from the x axis to the vector in radians, measured in counter clockwise direction.
Checks whether the point is inside the boundaries of the rectangle.
Checks if the point is within a given distance of another point.
Checks if the vector represented by this point is parallel (collinear) to another vector.
Checks if this point has both the x and y coordinate set to 0.
Checks if this point has an undefined value for at least one of its coordinates.
Returns the distance between the point and another point.
Sample code:
var firstPoint = new Point(5, 10); var secondPoint = new Point(5, 20); var distance = firstPoint.getDistance(secondPoint); print(distance); // 10
Returns the smaller angle between two vectors in radians.
The angle is unsigned, no information about rotational direction is given.
Returns the angle between two vectors in radians.
The angle is directional and signed, giving information about the rotational direction.
Returns the dot product of the point and another point.
Copyright © 2001-2010 Jürg Lehni, Scratchdisk.com. All Rights Reserved.