Provides methods for geometric operations.
Inheritance Hierarchy
GeomUtilities
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.geometry.GeomUtilities
Static Methods
Checks whether an ellipse contains the given point.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- bounds - Rect
- The coordinates of the bounds of the ellipse's enclosing rectangle.
- point - Point
- The coordinates of the point to test.
- eps - number
- A positive value allows for fuzzy hit testing. If the point lies outside the given object but it's distance is less than or equal to that value, it will be considered a hit.
Returns
- ↪boolean
- Whether the point lies within the ellipse
Returns the ellipse/line intersection point for the given point pair.
Remarks
This will always return the intersection point that lies in the direction from inner to outer.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- bounds - Rect
- The coordinates of the bounds of the ellipse's enclosing rectangle.
- inner - Point
- The coordinates of a point lying inside the ellipse.
- outer - Point
- The coordinates of a point lying outside the ellipse.
Returns
- ↪Point
- The intersection point iff the inner point lies inside the ellipse and an intersection point has been found, otherwise
null
.
Finds the intersection between a line segment and an infinite ray.
Remarks
The ray is described using an anchor point and a ray direction. The direction vector does not need to be normalized. In order to obtain the intersection point do the following:
const factor = GeomUtilities.findRayIntersection(l1, l2, anchor, ray)
if (factor < Number.POSITIVE_INFINITY) {
const intersection = anchor.add(ray.multiply(factor))
}
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- start - Point
- The coordinates of the first end point of the line segment.
- end - Point
- The coordinates of the second end point of the line segment.
- anchor - Point
- The coordinates of the starting point of the ray.
- rayDirection - Point
- The direction vector of the ray.
Returns
- ↪number
- The distance factor or Number.POSITIVE_INFINITY if the ray does not intersect the line.