Package | com.yworks.yfiles.geom |
Class | public class Geom |
Inheritance | Geom YObject Object |
java.lang.Math
which provides methods for general mathematical calculations.
Method | Defined By | ||
---|---|---|---|
Geom(init:Boolean = true) | Geom | ||
[static]
Calculates the convex hull for a set of points. | Geom | ||
[static]
Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. | Geom | ||
[static]
Calculates the intersection point of two affine lines. | Geom | ||
[static]
Calculates the intersection point of two affine lines. | Geom | ||
calcIntersection4(x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, x4:Number, y4:Number):YPoint [static]
Calculates the intersection point of two affine lines. | Geom | ||
calcTransformedBounds(x:Number, y:Number, width:Number, height:Number, transform:AffineTransform, dest:Rectangle2D):Rectangle2D [static]
Calculates the bounding box of the rectangle at location (x,y) with the specified width and height after the specified transformation has been applied. | Geom | ||
[static]
Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. | Geom | ||
[static]
Returns true iff the given points are collinear, i.e. | Geom | ||
distanceToLineSegment(pointX:Number, pointY:Number, lineX1:Number, lineY1:Number, lineX2:Number, lineY2:Number):Number [static]
Determines the distance of the point p to the line segment [l1, l2]. | Geom | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | Geom | ||
hashCode():int | YObject | ||
[static]
Same as orientation(p,q,r) > 0 (orientation())
| Geom | ||
linesIntersect(x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, x4:Number, y4:Number):Boolean [static]
Same as java.awt.geom.Line2D.linesIntersect(). | Geom | ||
[static]
Returns the orientation of point r relative to the directed line from point p to point q. | Geom | ||
orientation2(px:Number, py:Number, qx:Number, qy:Number, rx:Number, ry:Number):int [static]
Same as orientation() with double values as arguments. | Geom | ||
projection(pointX:Number, pointY:Number, lineX1:Number, lineY1:Number, lineX2:Number, lineY2:Number):YPoint [static]
Determines the projection of the point p onto the line segment [l1, l2]. | Geom | ||
[static]
Same as orientation(p,q,r) < 0 (orientation())
| Geom | ||
[static]
Returns +1 if point d lies left of the directed circle through points a, b, and c, 0 if a,b,c and d are cocircular, and -1 otherwise. | Geom | ||
toDegrees(angrad:Number):Number [static]
Same as Math.toDegrees(). | Geom | ||
toRadians(angdeg:Number):Number [static]
Same as Math.toRadians(). | Geom |
Geom | () | Constructor |
public function Geom(init:Boolean = true)
init:Boolean (default = true )
|
calcConvexHull | () | method |
public static function calcConvexHull(points:YList):YList
Calculates the convex hull for a set of points.
Complexity O(n)*log(n), n := points.size()
Parameters
points:YList — a list of com.yworks.yfiles.geom.YPoint objects
|
YList — a list of com.yworks.yfiles.geom.YPoint objects that constitute the convex hull of the given points. The list contains points in counter clockwise order around the hull. The first point is the one with the smallest x coordinate. If two such points exist then of these points the one with the smallest y coordinate is chosen as the first one.
|
See also
calcIntersection | () | method |
public static function calcIntersection(r1:Rectangle2D, r2:Rectangle2D, dest:Rectangle2D):Rectangle2D
Intersects the pair of specified source Rectangle2D
objects and puts the result into the specified destination Rectangle2D
object.
If one or both of the source rectangles have negative width or height, the resulting rectangle will be located at (0,0) with a width and height of -1. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method.
Parameters
r1:Rectangle2D — the first of a pair of Rectangle2D objects to be intersected with each other
| |
r2:Rectangle2D — the second of a pair of Rectangle2D objects to be intersected with each other
| |
dest:Rectangle2D — the Rectangle2D that holds the results of the intersection of r1 and r2
|
Rectangle2D |
calcIntersection2 | () | method |
public static function calcIntersection2(p1:YPoint, d1:YVector, p2:YPoint, d2:YVector):YPoint
Calculates the intersection point of two affine lines. Each line is given by a point and a direction vector.
Parameters
p1:YPoint — origin point of the first line.
| |
d1:YVector — direction vector of the first line.
| |
p2:YPoint — origin point of the second line.
| |
d2:YVector — direction vector of the second line.
|
YPoint — the intersection point of the specified lines or null if there is no intersection.
|
calcIntersection3 | () | method |
public static function calcIntersection3(p1:YPoint, p2:YPoint, p3:YPoint, p4:YPoint):YPoint
Calculates the intersection point of two affine lines. Each line is given by two points.
Parameters
p1:YPoint — one point on the first line.
| |
p2:YPoint — another point on the first line.
| |
p3:YPoint — one point on the second line.
| |
p4:YPoint — another point on the second line.
|
YPoint — the intersection point of the specified lines or null if there is no intersection.
|
calcIntersection4 | () | method |
public static function calcIntersection4(x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, x4:Number, y4:Number):YPoint
Calculates the intersection point of two affine lines. Each line is given by the coordinates of two points.
Parameters
x1:Number — x-coordinate of one point on the first line.
| |
y1:Number — y-coordinate of one point on the first line.
| |
x2:Number — x-coordinate of another point on the first line.
| |
y2:Number — y-coordinate of another point on the first line.
| |
x3:Number — x-coordinate of one point on the second line.
| |
y3:Number — y-coordinate of one point on the second line.
| |
x4:Number — x-coordinate of another point on the second line.
| |
y4:Number — y-coordinate of another point on the second line.
|
YPoint — the intersection point of the specified lines or null if there is no intersection.
|
calcTransformedBounds | () | method |
public static function calcTransformedBounds(x:Number, y:Number, width:Number, height:Number, transform:AffineTransform, dest:Rectangle2D):Rectangle2D
Calculates the bounding box of the rectangle at location (x,y) with the specified width and height after the specified transformation has been applied.
Parameters
x:Number — the x coordinate of the rectangle to be transformed
| |
y:Number — the y coordinate of the rectangle to be transformed
| |
width:Number — the width of the rectangle to be transformed
| |
height:Number — the height of the rectangle to be transformed
| |
transform:AffineTransform — the AffineTransform to be applied
| |
dest:Rectangle2D — the Rectangle2D that holds the bounding box of the transformed input
|
Rectangle2D |
calcUnion | () | method |
public static function calcUnion(r1:Rectangle2D, r2:Rectangle2D, dest:Rectangle2D):Rectangle2D
Unions the pair of source Rectangle2D
objects and puts the result into the specified destination Rectangle2D
object.
If one of the source rectangles has negative width or height, it is excluded from the union. If both source rectangles have negative width or height, the destination rectangle will become a copy of r1
. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method. If the destination is null
, a new Rectangle2D
is created.
Parameters
r1:Rectangle2D — the first of a pair of Rectangle2D objects to be combined with each other
| |
r2:Rectangle2D — the second of a pair of Rectangle2D objects to be combined with each other
| |
dest:Rectangle2D — the Rectangle2D that holds the results of the union of r1 and r2
|
Rectangle2D |
collinear | () | method |
public static function collinear(p:YPoint, q:YPoint, r:YPoint):Boolean
Returns true
iff the given points are collinear, i.e.
all three points lie on a common line.
Parameters
p:YPoint | |
q:YPoint | |
r:YPoint |
Boolean |
See also
distanceToLineSegment | () | method |
public static function distanceToLineSegment(pointX:Number, pointY:Number, lineX1:Number, lineY1:Number, lineX2:Number, lineY2:Number):Number
Determines the distance of the point p
to the line segment [l1, l2]
.
Parameters
pointX:Number — the x coordinate of p
| |
pointY:Number — the y coordinate of p
| |
lineX1:Number — the x coordinate of l1
| |
lineY1:Number — the y coordinate of l1
| |
lineX2:Number — the x coordinate of l2
| |
lineY2:Number — the y coordinate of l2
|
Number |
getClass | () | method |
override public function getClass():Class
ReturnsClass |
leftTurn | () | method |
public static function leftTurn(p:YPoint, q:YPoint, r:YPoint):Boolean
Same as orientation(p,q,r) > 0 (orientation())
Parameters
p:YPoint | |
q:YPoint | |
r:YPoint |
Boolean |
See also
linesIntersect | () | method |
public static function linesIntersect(x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, x4:Number, y4:Number):Boolean
Same as java.awt.geom.Line2D.linesIntersect().
Parameters
x1:Number | |
y1:Number | |
x2:Number | |
y2:Number | |
x3:Number | |
y3:Number | |
x4:Number | |
y4:Number |
Boolean |
See also
orientation | () | method |
public static function orientation(p:YPoint, q:YPoint, r:YPoint):int
Returns the orientation of point r
relative to the directed line from point p
to point q
.
p
and q
are distinct and r
lies to the left of the oriented line passing through p
and q
and oriented from p
to q
. The tuple is said to have negative orientation if p
and q
are distinct and r
lies to the right of the line, and the tuple is said to have orientation zero if the three points are collinear.
Parameters
p:YPoint | |
q:YPoint | |
r:YPoint |
int — +1 in the case of positive orientation, -1 in the case of negative orientation and 0 in the case of zero orientation.
|
orientation2 | () | method |
public static function orientation2(px:Number, py:Number, qx:Number, qy:Number, rx:Number, ry:Number):int
Same as orientation() with double values as arguments.
Parameters
px:Number | |
py:Number | |
qx:Number | |
qy:Number | |
rx:Number | |
ry:Number |
int |
See also
projection | () | method |
public static function projection(pointX:Number, pointY:Number, lineX1:Number, lineY1:Number, lineX2:Number, lineY2:Number):YPoint
Determines the projection of the point p
onto the line segment [l1, l2]
.
The resulting point is
p
onto the line through l1
and l2
, iff the projection lies on the line segment [l1, l2]
[l1, l2]
that is closest to p
Parameters
pointX:Number — the x coordinate of p
| |
pointY:Number — the y coordinate of p
| |
lineX1:Number — the x coordinate of l1
| |
lineY1:Number — the y coordinate of l1
| |
lineX2:Number — the x coordinate of l2
| |
lineY2:Number — the y coordinate of l2
|
YPoint |
rightTurn | () | method |
public static function rightTurn(p:YPoint, q:YPoint, r:YPoint):Boolean
Same as orientation(p,q,r) < 0 (orientation())
Parameters
p:YPoint | |
q:YPoint | |
r:YPoint |
Boolean |
See also
sideOfCircle | () | method |
public static function sideOfCircle(a:YPoint, b:YPoint, c:YPoint, d:YPoint):int
Returns +1 if point d
lies left of the directed circle through points a
, b
, and c
, 0 if a,b,c
and d
are cocircular, and -1 otherwise.
Parameters
a:YPoint | |
b:YPoint | |
c:YPoint | |
d:YPoint |
int |
toDegrees | () | method |
public static function toDegrees(angrad:Number):Number
Same as Math.toDegrees().
Parameters
angrad:Number |
Number |
See also
toRadians | () | method |
public static function toRadians(angdeg:Number):Number
Same as Math.toRadians().
Parameters
angdeg:Number |
Number |
See also