- Source: src/geom/intersects/index.js (Line 7)
Methods
-
<static> CircleToCircle(circleA, circleB)
-
Checks if two Circles intersect.
Parameters:
Name Type Description circleAPhaser.Geom.Circle The first Circle to check for intersection.
circleBPhaser.Geom.Circle The second Circle to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/CircleToCircle.js (Line 9)
Returns:
trueif the two Circles intersect, otherwisefalse.- Type
- boolean
-
<static> CircleToRectangle(circle, rect)
-
Checks for intersection between a circle and a rectangle.
Parameters:
Name Type Description circlePhaser.Geom.Circle The circle to be checked.
rectPhaser.Geom.Rectangle The rectangle to be checked.
- Since: 3.0.0
- Source: src/geom/intersects/CircleToRectangle.js (Line 7)
Returns:
trueif the two objects intersect, otherwisefalse.- Type
- boolean
-
<static> GetCircleToCircle(circleA, circleB [, out])
-
Checks if two Circles intersect and returns the intersection points as a Point object array.
Parameters:
Name Type Argument Description circleAPhaser.Geom.Circle The first Circle to check for intersection.
circleBPhaser.Geom.Circle The second Circle to check for intersection.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetCircleToCircle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetCircleToRectangle(circle, rect [, out])
-
Checks for intersection between a circle and a rectangle, and returns the intersection points as a Point object array.
Parameters:
Name Type Argument Description circlePhaser.Geom.Circle The circle to be checked.
rectPhaser.Geom.Rectangle The rectangle to be checked.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetCircleToRectangle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetLineToCircle(line, circle [, out])
-
Checks for intersection between the line segment and circle, and returns the intersection points as a Point object array.
Parameters:
Name Type Argument Description linePhaser.Geom.Line The line segment to check.
circlePhaser.Geom.Circle The circle to check against the line.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetLineToCircle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetLineToLine(line1, line2 [, out])
-
Checks for intersection between the two line segments and returns the intersection point as a Vector3, or
nullif the lines are parallel, or do not intersect.The
zproperty of the Vector3 contains the intersection distance, which can be used to find the closest intersecting point from a group of line segments.Parameters:
Name Type Argument Description line1Phaser.Geom.Line The first line segment to check.
line2Phaser.Geom.Line The second line segment to check.
outPhaser.Math.Vector3 <optional>
A Vector3 to store the intersection results in.
- Since: 3.50.0
- Source: src/geom/intersects/GetLineToLine.js (Line 9)
Returns:
A Vector3 containing the intersection results, or
null.- Type
- Phaser.Math.Vector3
-
<static> GetLineToPoints(line, points [, out])
-
Checks for the closest point of intersection between a line segment and an array of points, where each pair of points are converted to line segments for the intersection tests.
If no intersection is found, this function returns
null.If intersection was found, a Vector3 is returned with the following properties:
The
xandycomponents contain the point of the intersection. Thezcomponent contains the closest distance.Parameters:
Name Type Argument Description linePhaser.Geom.Line The line segment to check.
pointsArray.<Phaser.Math.Vector2> | Array.<Phaser.Geom.Point> An array of points to check.
outPhaser.Math.Vector3 <optional>
A Vector3 to store the intersection results in.
- Since: 3.50.0
- Source: src/geom/intersects/GetLineToPoints.js (Line 17)
Returns:
A Vector3 containing the intersection results, or
null.- Type
- Phaser.Math.Vector3
-
<static> GetLineToPolygon(line, polygons [, out])
-
Checks for the closest point of intersection between a line segment and an array of polygons.
If no intersection is found, this function returns
null.If intersection was found, a Vector4 is returned with the following properties:
The
xandycomponents contain the point of the intersection. Thezcomponent contains the closest distance. Thewcomponent contains the index of the polygon, in the given array, that triggered the intersection.Parameters:
Name Type Argument Description linePhaser.Geom.Line The line segment to check.
polygonsPhaser.Geom.Polygon | Array.<Phaser.Geom.Polygon> A single polygon, or array of polygons, to check.
outPhaser.Math.Vector4 <optional>
A Vector4 to store the intersection results in.
- Since: 3.50.0
- Source: src/geom/intersects/GetLineToPolygon.js (Line 14)
Returns:
A Vector4 containing the intersection results, or
null.- Type
- Phaser.Math.Vector4
-
<static> GetLineToRectangle(line, rect [, out])
-
Checks for intersection between the Line and a Rectangle shape, and returns the intersection points as a Point object array.
Parameters:
Name Type Argument Description linePhaser.Geom.Line The Line to check for intersection.
rectPhaser.Geom.Rectangle | object The Rectangle to check for intersection.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetLineToRectangle.js (Line 12)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetRaysFromPointToPolygon(x, y, polygons)
-
Projects rays out from the given point to each line segment of the polygons.
If the rays intersect with the polygons, the points of intersection are returned in an array.
If no intersections are found, the returned array will be empty.
Each Vector4 intersection result has the following properties:
The
xandycomponents contain the point of the intersection. Thezcomponent contains the angle of intersection. Thewcomponent contains the index of the polygon, in the given array, that triggered the intersection.Parameters:
Name Type Description xnumber The x coordinate to project the rays from.
ynumber The y coordinate to project the rays from.
polygonsPhaser.Geom.Polygon | Array.<Phaser.Geom.Polygon> A single polygon, or array of polygons, to check against the rays.
- Since: 3.50.0
- Source: src/geom/intersects/GetRaysFromPointToPolygon.js (Line 40)
Returns:
An array containing all intersections in Vector4s.
- Type
- Array.<Phaser.Math.Vector4>
-
<static> GetRectangleIntersection(rectA, rectB [, output])
-
Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object.
If optional
outputparameter is omitted, new Rectangle object is created and returned. If there is intersection, it will contain intersection area. If there is no intersection, it wil be empty Rectangle (all values set to zero).If Rectangle object is passed as
outputand there is intersection, then intersection area data will be loaded into it and it will be returned. If there is no intersection, it will be returned without any change.Parameters:
Name Type Argument Description rectAPhaser.Geom.Rectangle The first Rectangle object.
rectBPhaser.Geom.Rectangle The second Rectangle object.
outputPhaser.Geom.Rectangle <optional>
Optional Rectangle object. If given, the intersection data will be loaded into it (in case of no intersection, it will be left unchanged). Otherwise, new Rectangle object will be created and returned with either intersection data or empty (all values set to zero), if there is no intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetRectangleIntersection.js (Line 10)
Returns:
A rectangle object with intersection data.
-
<static> GetRectangleToRectangle(rectA, rectB [, out])
-
Checks if two Rectangles intersect and returns the intersection points as a Point object array.
A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle.
Parameters:
Name Type Argument Description rectAPhaser.Geom.Rectangle The first Rectangle to check for intersection.
rectBPhaser.Geom.Rectangle The second Rectangle to check for intersection.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetRectangleToRectangle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetRectangleToTriangle(rect, triangle [, out])
-
Checks for intersection between Rectangle shape and Triangle shape, and returns the intersection points as a Point object array.
Parameters:
Name Type Argument Description rectPhaser.Geom.Rectangle Rectangle object to test.
trianglePhaser.Geom.Triangle Triangle object to test.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetRectangleToTriangle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetTriangleToCircle(triangle, circle [, out])
-
Checks if a Triangle and a Circle intersect, and returns the intersection points as a Point object array.
A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection.
Parameters:
Name Type Argument Description trianglePhaser.Geom.Triangle The Triangle to check for intersection.
circlePhaser.Geom.Circle The Circle to check for intersection.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetTriangleToCircle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetTriangleToLine(triangle, line [, out])
-
Checks if a Triangle and a Line intersect, and returns the intersection points as a Point object array.
The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid".
Parameters:
Name Type Argument Description trianglePhaser.Geom.Triangle The Triangle to check with.
linePhaser.Geom.Line The Line to check with.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetTriangleToLine.js (Line 12)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> GetTriangleToTriangle(triangleA, triangleB [, out])
-
Checks if two Triangles intersect, and returns the intersection points as a Point object array.
A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid".
Parameters:
Name Type Argument Description triangleAPhaser.Geom.Triangle The first Triangle to check for intersection.
triangleBPhaser.Geom.Triangle The second Triangle to check for intersection.
outarray <optional>
An optional array in which to store the points of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/GetTriangleToTriangle.js (Line 11)
Returns:
An array with the points of intersection if objects intersect, otherwise an empty array.
- Type
- array
-
<static> LineToCircle(line, circle [, nearest])
-
Checks for intersection between the line segment and circle.
Based on code by Matt DesLauriers.
Parameters:
Name Type Argument Description linePhaser.Geom.Line The line segment to check.
circlePhaser.Geom.Circle The circle to check against the line.
nearestPhaser.Geom.Point | any <optional>
An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object.
- Since: 3.0.0
- Source: src/geom/intersects/LineToCircle.js (Line 12)
Returns:
trueif the two objects intersect, otherwisefalse.- Type
- boolean
-
<static> LineToLine(line1, line2 [, out])
-
Checks if two Lines intersect. If the Lines are identical, they will be treated as parallel and thus non-intersecting.
Parameters:
Name Type Argument Description line1Phaser.Geom.Line The first Line to check.
line2Phaser.Geom.Line The second Line to check.
outPhaser.Geom.Point <optional>
A Point in which to optionally store the point of intersection.
- Since: 3.0.0
- Source: src/geom/intersects/LineToLine.js (Line 12)
Returns:
trueif the two Lines intersect, and theoutobject will be populated, if given. Otherwise,false.- Type
- boolean
-
<static> LineToRectangle(line, rect)
-
Checks for intersection between the Line and a Rectangle shape, or a rectangle-like object, with public
x,y,rightandbottomproperties, such as a Sprite or Body.An intersection is considered valid if:
The line starts within, or ends within, the Rectangle. The line segment intersects one of the 4 rectangle edges.
The for the purposes of this function rectangles are considered 'solid'.
Parameters:
Name Type Description linePhaser.Geom.Line The Line to check for intersection.
rectPhaser.Geom.Rectangle | object The Rectangle to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/LineToRectangle.js (Line 7)
Returns:
trueif the Line and the Rectangle intersect,falseotherwise.- Type
- boolean
-
<static> PointToLine(point, line [, lineThickness])
-
Checks if the a Point falls between the two end-points of a Line, based on the given line thickness.
Assumes that the line end points are circular, not square.
Parameters:
Name Type Argument Default Description pointPhaser.Geom.Point | any The point, or point-like object to check.
linePhaser.Geom.Line The line segment to test for intersection on.
lineThicknessnumber <optional>
1 The line thickness. Assumes that the line end points are circular.
- Since: 3.0.0
- Source: src/geom/intersects/PointToLine.js (Line 8)
Returns:
trueif the Point falls on the Line, otherwisefalse.- Type
- boolean
-
<static> PointToLineSegment(point, line)
-
Checks if a Point is located on the given line segment.
Parameters:
Name Type Description pointPhaser.Geom.Point The Point to check for intersection.
linePhaser.Geom.Line The line segment to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/PointToLineSegment.js (Line 9)
Returns:
trueif the Point is on the given line segment, otherwisefalse.- Type
- boolean
-
<static> RectangleToRectangle(rectA, rectB)
-
Checks if two Rectangles intersect.
A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle.
Parameters:
Name Type Description rectAPhaser.Geom.Rectangle The first Rectangle to check for intersection.
rectBPhaser.Geom.Rectangle The second Rectangle to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/RectangleToRectangle.js (Line 7)
Returns:
trueif the two Rectangles intersect, otherwisefalse.- Type
- boolean
-
<static> RectangleToTriangle(rect, triangle)
-
Checks for intersection between Rectangle shape and Triangle shape.
Parameters:
Name Type Description rectPhaser.Geom.Rectangle Rectangle object to test.
trianglePhaser.Geom.Triangle Triangle object to test.
- Since: 3.0.0
- Source: src/geom/intersects/RectangleToTriangle.js (Line 12)
Returns:
A value of
trueif objects intersect; otherwisefalse.- Type
- boolean
-
<static> RectangleToValues(rect, left, right, top, bottom [, tolerance])
-
Check if rectangle intersects with values.
Parameters:
Name Type Argument Default Description rectPhaser.Geom.Rectangle The rectangle object
leftnumber The x coordinate of the left of the Rectangle.
rightnumber The x coordinate of the right of the Rectangle.
topnumber The y coordinate of the top of the Rectangle.
bottomnumber The y coordinate of the bottom of the Rectangle.
tolerancenumber <optional>
0 Tolerance allowed in the calculation, expressed in pixels.
- Since: 3.0.0
- Source: src/geom/intersects/RectangleToValues.js (Line 7)
Returns:
Returns true if there is an intersection.
- Type
- boolean
-
<static> TriangleToCircle(triangle, circle)
-
Checks if a Triangle and a Circle intersect.
A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection.
Parameters:
Name Type Description trianglePhaser.Geom.Triangle The Triangle to check for intersection.
circlePhaser.Geom.Circle The Circle to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/TriangleToCircle.js (Line 10)
Returns:
trueif the Triangle and theCircleintersect, otherwisefalse.- Type
- boolean
-
<static> TriangleToLine(triangle, line)
-
Checks if a Triangle and a Line intersect.
The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid".
Parameters:
Name Type Description trianglePhaser.Geom.Triangle The Triangle to check with.
linePhaser.Geom.Line The Line to check with.
- Since: 3.0.0
- Source: src/geom/intersects/TriangleToLine.js (Line 9)
Returns:
trueif the Triangle and the Line intersect, otherwisefalse.- Type
- boolean
-
<static> TriangleToTriangle(triangleA, triangleB)
-
Checks if two Triangles intersect.
A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid".
Parameters:
Name Type Description triangleAPhaser.Geom.Triangle The first Triangle to check for intersection.
triangleBPhaser.Geom.Triangle The second Triangle to check for intersection.
- Since: 3.0.0
- Source: src/geom/intersects/TriangleToTriangle.js (Line 11)
Returns:
trueif the Triangles intersect, otherwisefalse.- Type
- boolean
