API Docs for: 1.4.0
Show:

Kiwi.Geom.Intersect Class

Module: Geom
Parent Module: Kiwi

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.

Methods

circleContainsPoint

(
  • circle
  • point
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check if the given Point is found within the given Circle.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

circleToCircle

(
  • circle1
  • circle2
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check if the two given Circle objects intersect at any point.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

circleToRectangle

(
  • circle
  • rect
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check if a Circle and a Rectangle intersect with each other at any point.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

distance

(
  • x1
  • y1
  • x2
  • y2
)
Number public static

Returns the distance between two sets of coordinates that you specify.

Parameters:

  • x1 Number

    The x position of the first coordinate.

  • y1 Number

    The y position of the first coordinate.

  • x2 Number

    The x position of the second coordinate.

  • y2 Number

    The y position of the second coordinate.

Returns:

Number:

The distance between the two points.

distanceSquared

(
  • x1
  • y1
  • x2
  • y2
)
Number public static

Returns the distance squared between two sets of coordinates that you specify.

Parameters:

  • x1 Number

    The x position of the first coordinate.

  • y1 Number

    The y position of the first coordinate.

  • x2 Number

    The x position of the second coordinate.

  • y2 Number

    The y position of the second coordinate.

Returns:

Number:

The distance between the two points squared.

lineSegmentToCircle

(
  • seg
  • circle
  • [ouput]
)
Kiwi.Geom.IntersectResult public static

Check if the Line Segment intersects with the Circle. Note the Line only exists between its point points.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineSegmentToLineSegment

(
  • line1
  • line2
  • [output]
)
Kiwi.Geom.IntersectResult public static

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:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y.

lineSegmentToRawSegment

(
  • line
  • x1
  • y1
  • x2
  • y2
  • [output]
)
Kiwi.Geom.IntersectResult public static

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.Line

    The line object that extends infinitely through space.

  • x1 Number

    The x coordinate of the first point in the second line.

  • y1 Number

    The y coordinate of the first point in the second line.

  • x2 Number

    The x coordinate of the second point in the second line.

  • y2 Number

    The y coordinate of the second point in the second line.

  • [output] Kiwi.Geom.IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineSegmentToRay

(
  • line1
  • ray
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check if the Line Segment intersects with the Ray. Note: The Line only exists between its two points.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineSegmentToRectangle

(
  • seg
  • rect
  • [output]
)
Kiwi.Geom.IntersectResult public static

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:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y.

lineToCircle

(
  • line
  • circle
  • [output]
)
Kiwi.Geom.IntersectResult public static

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.Line

    The Line object that you want to check it against.

  • circle Kiwi.Geom.Circle

    The Circle object to check.

  • [output] IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

lineToLine

(
  • line1
  • line2
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check to see if any two Lines intersect at any point. Both lines are treated as if they extend infintely through space.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineToLineSegment

(
  • line1
  • seg
  • [output]
)
Kiwi.Geom.IntersectResult public static

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.Line

    The first line to check. This is the one that will extend through space infinately.

  • seg Kiwi.Geom.Line

    The second line to check. This is the one that will only exist between its two coordinates.

  • [output] Kiwi.Geom.IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection.

lineToRawSegment

(
  • line
  • x1
  • y1
  • x2
  • y2
  • [output]
)
Kiwi.Geom.IntersectResult public static

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.Line

    The line object that extends infinitely through space.

  • x1 Number

    The x coordinate of the first point in the second line.

  • y1 Number

    The y coordinate of the first point in the second line.

  • x2 Number

    The x coordinate of the second point in the second line.

  • y2 Number

    The y coordinate of the second point in the second line.

  • [output] Kiwi.Geom.IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineToRay

(
  • line1
  • ray
  • [output]
)
Kiwi.Geom.IntersectResult public static

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.Line

    The Line object that extends infinatly through space.

  • ray Kiwi.Geom.Ray

    The Ray object that you want to check it against.

  • [output] Kiwi.Geom.IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y

lineToRectangle

(
  • line
  • rectangle
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check if the Line intersects with each side of a Rectangle. Note: The Line is assumned to extend infinately through space.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

objType

() String public

The type of this object.

Returns:

String:

"Intersect"

pointToRectangle

(
  • point
  • rect
  • [output]
)
Kiwi.Geom.IntersectResult public static

Determines whether the specified point is contained within a given Rectangle object.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y/result

rayToCircle

(
  • ray
  • circle
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check to see if a Ray intersects at any point with a Circle.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

Results of this intersection

rayToLineSegment

(
  • rayx1
  • rayy1
  • rayx2
  • rayy2
  • linex1
  • liney1
  • linex2
  • liney2
  • [output]
)
Kiwi.Geom.IntersectResult public static

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 Number

    The origin point of the ray on the x axis.

  • rayy1 Number

    The origin point of the ray on the y axis.

  • rayx2 Number

    The direction of the ray on the x axis.

  • rayy2 Number

    The direction of the ray on the y axis.

  • linex1 Number

    The x of the first point of the line segment.

  • liney1 Number

    The y of the first point of the line segment.

  • linex2 Number

    The x of the second point of the line segment.

  • liney2 Number

    The y of the second point of the line segment.

  • [output] Kiwi.Geom.IntersectResult optional

    An optional IntersectResult object to store the intersection values in. One is created if none given.

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection stored in x

rayToRectangle

(
  • ray
  • rect
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check to see if a Ray intersects at any point with a Rectangle.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection

rectangleToRectangle

(
  • rect1
  • rect2
  • [output]
)
Kiwi.Geom.IntersectResult public static

Check whether two axis aligned rectangles intersect. Return the intersecting rectangle dimensions if they do.

Parameters:

Returns:

Kiwi.Geom.IntersectResult:

An IntersectResult object containing the results of this intersection in x/y/width/height