Kiwi.Geom.Intersect Class
Contains a collection of STATIC methods for determining intersections between geometric objects.
May methods contained here store the results of the intersections in a 'IntersectResult' Object, which is either created for you (by the methods which require it) OR you can pass one to use instead.
If you are using the Intersect methods a lot, you may want to consider creating a IntersectResult class a reusing it (by passing it to the methods on the Intersect class) instead of having new IntersectResults created.
Item Index
Methods
- circleContainsPoint static
- circleToCircle static
- circleToRectangle static
- distance static
- distanceSquared static
- lineSegmentToCircle static
- lineSegmentToLineSegment static
- lineSegmentToRawSegment static
- lineSegmentToRay static
- lineSegmentToRectangle static
- lineToCircle static
- lineToLine static
- lineToLineSegment static
- lineToRawSegment static
- lineToRay static
- lineToRectangle static
- objType
- pointToRectangle static
- rayToCircle static
- rayToLineSegment static
- rayToRectangle static
- rectangleToRectangle static
Methods
circleContainsPoint
-
circle -
point -
[output]
Check if the given Point is found within the given Circle.
Parameters:
-
circleKiwi.Geom.CircleThe circle object to check
-
pointKiwi.Geom.PointThe point object to check
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
circleToCircle
-
circle1 -
circle2 -
[output]
Check if the two given Circle objects intersect at any point.
Parameters:
-
circle1Kiwi.Geom.CircleThe first circle object to check.
-
circle2Kiwi.Geom.CircleThe second circle object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
circleToRectangle
-
circle -
rect -
[output]
Check if a Circle and a Rectangle intersect with each other at any point.
Parameters:
-
circleKiwi.Geom.CircleThe circle object to check.
-
rectKiwi.Geom.RectangleThe Rectangle object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
distance
-
x1 -
y1 -
x2 -
y2
Returns the distance between two sets of coordinates that you specify.
Parameters:
-
x1NumberThe x position of the first coordinate.
-
y1NumberThe y position of the first coordinate.
-
x2NumberThe x position of the second coordinate.
-
y2NumberThe y position of the second coordinate.
Returns:
The distance between the two points.
distanceSquared
-
x1 -
y1 -
x2 -
y2
Returns the distance squared between two sets of coordinates that you specify.
Parameters:
-
x1NumberThe x position of the first coordinate.
-
y1NumberThe y position of the first coordinate.
-
x2NumberThe x position of the second coordinate.
-
y2NumberThe y position of the second coordinate.
Returns:
The distance between the two points squared.
lineSegmentToCircle
-
seg -
circle -
[ouput]
Check if the Line Segment intersects with the Circle. Note the Line only exists between its point points.
Parameters:
-
segKiwi.Geom.LineThe Line object to check
-
circleKiwi.Geom.CircleThe Circle object to check
-
[ouput]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineSegmentToLineSegment
-
line1 -
line2 -
[output]
Checks to see if two Line Segments intersect at any point in space. Note: Both lines are treated as if they only exist between their two line coordinates.
Parameters:
-
line1Kiwi.Geom.LineThe first line object to check.
-
line2Kiwi.Geom.LineThe second line object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y.
lineSegmentToRawSegment
-
line -
x1 -
y1 -
x2 -
y2 -
[output]
Checks to see if a Line that is passed intersects with a Line that is made by passing a set of coordinates to this method. Note: The lines will only exist between the two points passed.
Parameters:
-
lineKiwi.Geom.LineThe line object that extends infinitely through space.
-
x1NumberThe x coordinate of the first point in the second line.
-
y1NumberThe y coordinate of the first point in the second line.
-
x2NumberThe x coordinate of the second point in the second line.
-
y2NumberThe y coordinate of the second point in the second line.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineSegmentToRay
-
line1 -
ray -
[output]
Check if the Line Segment intersects with the Ray. Note: The Line only exists between its two points.
Parameters:
-
line1Kiwi.Geom.LineThe Line object to check.
-
rayKiwi.Geom.LineThe Ray object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineSegmentToRectangle
-
seg -
rect -
[output]
Check if the Line Segment intersects with any side of a Rectangle, or is entirely within the Rectangle. Note: The Line only exists between its two points.
Parameters:
-
segKiwi.Geom.LineThe Line object to check.
-
rectKiwi.Geom.RectangleThe Rectangle object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y.
lineToCircle
-
line -
circle -
[output]
Checks to see if a Line and a Circle intersect at any point. Note: The line passed is assumed to extend infinately through space.
Parameters:
-
lineKiwi.Geom.LineThe Line object that you want to check it against.
-
circleKiwi.Geom.CircleThe Circle object to check.
-
[output]IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
lineToLine
-
line1 -
line2 -
[output]
Check to see if any two Lines intersect at any point. Both lines are treated as if they extend infintely through space.
Parameters:
-
line1Kiwi.Geom.LineThe first line object to check.
-
line2Kiwi.Geom.LineThe second line object to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineToLineSegment
-
line1 -
seg -
[output]
Check to see if a Line and a Line Segment intersect at any point. Note: The first line passed is treated as if it extends infinitely though space. The second is treated as if it only exists between its two points.
Parameters:
-
line1Kiwi.Geom.LineThe first line to check. This is the one that will extend through space infinately.
-
segKiwi.Geom.LineThe second line to check. This is the one that will only exist between its two coordinates.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection.
lineToRawSegment
-
line -
x1 -
y1 -
x2 -
y2 -
[output]
Checks to see if a Line that is passed, intersects at any point with a Line that is made by passing a set of coordinates to this method. Note: The first line will extend infinately through space. And the second line will only exist between the two points passed.
Parameters:
-
lineKiwi.Geom.LineThe line object that extends infinitely through space.
-
x1NumberThe x coordinate of the first point in the second line.
-
y1NumberThe y coordinate of the first point in the second line.
-
x2NumberThe x coordinate of the second point in the second line.
-
y2NumberThe y coordinate of the second point in the second line.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineToRay
-
line1 -
ray -
[output]
Checks to see if a Line and Ray object intersects at any point. Note: The line in this case extends infinately through space.
Parameters:
-
line1Kiwi.Geom.LineThe Line object that extends infinatly through space.
-
rayKiwi.Geom.RayThe Ray object that you want to check it against.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y
lineToRectangle
-
line -
rectangle -
[output]
Check if the Line intersects with each side of a Rectangle. Note: The Line is assumned to extend infinately through space.
Parameters:
-
lineKiwi.Geom.LineThe Line object to check
-
rectangleKiwi.Geom.RectangleThe Rectangle object to check
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
objType
()
String
public
The type of this object.
Returns:
"Intersect"
pointToRectangle
-
point -
rect -
[output]
Determines whether the specified point is contained within a given Rectangle object.
Parameters:
-
pointKiwi.Geom.PointThe point object being checked.
-
rectKiwi.Geom.RectangleThe rectangle object being checked.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y/result
rayToCircle
-
ray -
circle -
[output]
Check to see if a Ray intersects at any point with a Circle.
Parameters:
-
rayKiwi.Geom.RayRay object to check
-
circleKiwi.Geom.CircleCircle object to check
-
[output]Kiwi.Geom.IntersectResult optionalOptional object to store the intersection values. Created if not supplied.
Returns:
Results of this intersection
rayToLineSegment
-
rayx1 -
rayy1 -
rayx2 -
rayy2 -
linex1 -
liney1 -
linex2 -
liney2 -
[output]
Check whether a Ray intersects a Line segment, returns the parametric value where the intersection occurs. Note: The Line only exists between its two points.
Parameters:
-
rayx1NumberThe origin point of the ray on the x axis.
-
rayy1NumberThe origin point of the ray on the y axis.
-
rayx2NumberThe direction of the ray on the x axis.
-
rayy2NumberThe direction of the ray on the y axis.
-
linex1NumberThe x of the first point of the line segment.
-
liney1NumberThe y of the first point of the line segment.
-
linex2NumberThe x of the second point of the line segment.
-
liney2NumberThe y of the second point of the line segment.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection stored in x
rayToRectangle
-
ray -
rect -
[output]
Check to see if a Ray intersects at any point with a Rectangle.
Parameters:
-
rayKiwi.Geom.RayThe Ray object to check.
-
rectKiwi.Geom.RectangleThe Rectangle to check.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection
rectangleToRectangle
-
rect1 -
rect2 -
[output]
Check whether two axis aligned rectangles intersect. Return the intersecting rectangle dimensions if they do.
Parameters:
-
rect1Kiwi.Geom.RectangleThe first Rectangle object.
-
rect2Kiwi.Geom.RectangleThe second Rectangle object.
-
[output]Kiwi.Geom.IntersectResult optionalAn optional IntersectResult object to store the intersection values in. One is created if none given.
Returns:
An IntersectResult object containing the results of this intersection in x/y/width/height
