API Docs for: 1.4.0
Show:

Kiwi.Geom.Ray Class

Extends Kiwi.Geom.Line
Defined in: src\geom\Ray.ts:9
Module: Geom
Parent Module: Kiwi

Represents a halfline. The ray starts at the first point and extends infinitely in the direction of the second.

Constructor

Kiwi.Geom.Ray

(
  • [x1=0]
  • [y1=0]
  • [x2=0]
  • [y2=0]
)
Kiwi.Geom.Ray

Defined in src\geom\Ray.ts:9

Parameters:

  • [x1=0] Number optional

    Starting location of the ray on the x-axis

  • [y1=0] Number optional

    Starting location of the ray on the y-axis

  • [x2=0] Number optional

    End location of the ray on the x-axis. Used to calculate direction so it isn't really the 'end' location.

  • [y2=0] Number optional

    End location of the ray on the y-axis. Used to calculate direction so it isn't really the 'end' location.

Returns:

Kiwi.Geom.Ray:

This object

Methods

clone

(
  • [output]
)
Kiwi.Geom.Ray public

Inherited from Kiwi.Geom.Line but overwritten in src\geom\Ray.ts:41

Makes a copy of this Ray, either as a new Ray object, or makes a passed Ray a copy of this one.

Parameters:

Returns:

copyFrom

(
  • source
)
Kiwi.Geom.Line public

Make this Line a copy of another passed Line.

Parameters:

Returns:

copyTo

(
  • target
)
Kiwi.Geom.Line public

Make another passed Line a copy of this one.

Parameters:

Returns:

getY

(
  • x
)
Number public

Get the y of a point on the line for a given x.

Parameters:

  • x Number

Returns:

Number:

intersectLineLine

(
  • line
)
Kiwi.Geom.IntersectResult public

Check to see if this Line object intersects at any point with a passed Line. Note: Both are treated as extending infinately through space. Functions as an alias for the 'Kiwi.Geom.Intersect.lineToLine' method.

Parameters:

  • line Kiwi.Geom.Line

    The line you want to check for a Intersection with.

Returns:

Kiwi.Geom.IntersectResult:

The Intersect Result containing the collision information.

isPointOnLine

(
  • x
  • y
)
Boolean public

Check if a point is on the line.

Parameters:

  • x Number
  • y Number

Returns:

Boolean:

isPointOnLineSegment

(
  • x
  • y
)
Boolean public

Check if the point is both on the line and within the line segment.

Parameters:

  • x Number
  • y Number

Returns:

Boolean:

isPointOnRay

(
  • x
  • y
)
Boolean public

Defined in src\geom\Ray.ts:56

Check if the Ray passes through a point.

Parameters:

  • x Number
  • y Number

Returns:

Boolean:

objType

() String public

Inherited from Kiwi.Geom.Line but overwritten in src\geom\Ray.ts:31

The type of this object.

Returns:

String:

"Ray"

perp

(
  • x
  • y
  • [output]
)
Kiwi.Geom.Line public

Get a line perpendicular to the line passing through a given point.

Parameters:

  • x Number
  • y Number
  • [output] Kiwi.Geom.Line optional

    The line object that the result should be output to. Creates a new Line if one is not passed.

Returns:

setTo

(
  • [x1=0]
  • [y1=0]
  • [x2=0]
  • [y2=0]
)
Kiwi.Geom.Line public

Used to set all components on the line.

Parameters:

  • [x1=0] Number optional

    X component of first point.

  • [y1=0] Number optional

    Y component of first point.

  • [x2=0] Number optional

    X component of second point.

  • [y2=0] Number optional

    Y component of second point.

Returns:

toString

() String public

Inherited from Kiwi.Geom.Line but overwritten in src\geom\Ray.ts:76

Get a string representation of the ray.

Returns:

String:

Properties

angle

Number public

Get the angle of the line.

length

Number public

Get the length of the Line as a Line Segment.

perpSlope

Number public

Get the perpendicular slope of the line (x/y).

slope

Number public

Get the slope of the line (y/x).

x1

Number public

X position of first point on the line.

x2

Number public

X position of second point.

y1

Number public

Y position of first point on the line.

y2

Number public

Y position of second point.

yIntercept

Number public

Get the y intercept for the line.