API Docs for: 1.0.1
Show:

Kiwi.Geom.Line Class

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

A Kiwi Line object has two meanings depending on the situation you need. Either an infinte line through space (this is the usual meaning of a Line) OR it can be a Line Segment which just exists between the TWO points you specify.

Constructor

Kiwi.Geom.Line

(
  • [x1
  • [y1
  • [x2
  • [y2
)
Line

Defined in src\geom\Line.ts:9

Parameters:

  • [x1 Number

    = 0] x1 x component of first point.

  • [y1 Number

    = 0] y1 y component of first point.

  • [x2 Number

    = 0] x2 x component of second point.

  • [y2 Number

    = 0] y2 y component of second point.

Returns:

Line:

This Object

Methods

clone

(
  • [output
)
Kiwi.Geom.Line public

Defined in src\geom\Line.ts:74

Makes a clone of this Line. The clone will either be a new Line Object, Otherwise you can pass a existing Line Object that you want to be a clone of this one.

Parameters:

Returns:

copyFrom

(
  • source
)
Kiwi.Geom.Line public

Defined in src\geom\Line.ts:89

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.

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:

objType

() String public

Defined in src\geom\Line.ts:32

Returns the type of this object

Returns:

String:

The type of this object

perp

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

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

Parameters:

Returns:

setTo

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

Used to set all components on the line.

Parameters:

  • [x1 Number

    = 0] X component of first point.

  • [y1 Number

    = 0] Y component of first point.

  • [x2 Number

    = 0] X component of second point.

  • [y2 Number

    = 0] Y component of second point.

Returns:

toString

() String public

Get a string representation of the line.

Returns:

String:

Properties

angle

Unknown

Get the angle of the line.

length

Number public

Get the length of the Line as a Line Segment.

perpSlope

Unknown public

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

slope

Unknown public

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

x1

Number public

Defined in src\geom\Line.ts:42

X position of first point in your line.

x2

Number public

Defined in src\geom\Line.ts:58

X position of second point.

y1

Number public

Defined in src\geom\Line.ts:50

Y position of first point in your line.

y2

Number public

Defined in src\geom\Line.ts:66

X position of second point.

Unknown

Get the y intercept for the line.