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:
-
circle
Kiwi.Geom.CircleThe circle object to check
-
point
Kiwi.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:
-
circle1
Kiwi.Geom.CircleThe first circle object to check.
-
circle2
Kiwi.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:
-
circle
Kiwi.Geom.CircleThe circle object to check.
-
rect
Kiwi.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:
-
x1
NumberThe x position of the first coordinate.
-
y1
NumberThe y position of the first coordinate.
-
x2
NumberThe x position of the second coordinate.
-
y2
NumberThe 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:
-
x1
NumberThe x position of the first coordinate.
-
y1
NumberThe y position of the first coordinate.
-
x2
NumberThe x position of the second coordinate.
-
y2
NumberThe 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:
-
seg
Kiwi.Geom.LineThe Line object to check
-
circle
Kiwi.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:
-
line1
Kiwi.Geom.LineThe first line object to check.
-
line2
Kiwi.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:
-
line
Kiwi.Geom.LineThe line object that extends infinitely through space.
-
x1
NumberThe x coordinate of the first point in the second line.
-
y1
NumberThe y coordinate of the first point in the second line.
-
x2
NumberThe x coordinate of the second point in the second line.
-
y2
NumberThe 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:
-
line1
Kiwi.Geom.LineThe Line object to check.
-
ray
Kiwi.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:
-
seg
Kiwi.Geom.LineThe Line object to check.
-
rect
Kiwi.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:
-
line
Kiwi.Geom.LineThe Line object that you want to check it against.
-
circle
Kiwi.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:
-
line1
Kiwi.Geom.LineThe first line object to check.
-
line2
Kiwi.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:
-
line1
Kiwi.Geom.LineThe first line to check. This is the one that will extend through space infinately.
-
seg
Kiwi.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:
-
line
Kiwi.Geom.LineThe line object that extends infinitely through space.
-
x1
NumberThe x coordinate of the first point in the second line.
-
y1
NumberThe y coordinate of the first point in the second line.
-
x2
NumberThe x coordinate of the second point in the second line.
-
y2
NumberThe 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:
-
line1
Kiwi.Geom.LineThe Line object that extends infinatly through space.
-
ray
Kiwi.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:
-
line
Kiwi.Geom.LineThe Line object to check
-
rectangle
Kiwi.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:
-
point
Kiwi.Geom.PointThe point object being checked.
-
rect
Kiwi.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:
-
ray
Kiwi.Geom.RayRay object to check
-
circle
Kiwi.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:
-
rayx1
NumberThe origin point of the ray on the x axis.
-
rayy1
NumberThe origin point of the ray on the y axis.
-
rayx2
NumberThe direction of the ray on the x axis.
-
rayy2
NumberThe direction of the ray on the y axis.
-
linex1
NumberThe x of the first point of the line segment.
-
liney1
NumberThe y of the first point of the line segment.
-
linex2
NumberThe x of the second point of the line segment.
-
liney2
NumberThe 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:
-
ray
Kiwi.Geom.RayThe Ray object to check.
-
rect
Kiwi.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:
-
rect1
Kiwi.Geom.RectangleThe first Rectangle object.
-
rect2
Kiwi.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