Kiwi.Geom.Line Class
A 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=0]
-
[y1=0]
-
[x2=0]
-
[y2=0]
Parameters:
-
[x1=0]
Number optionalStarting location of the line on the x-axis.
-
[y1=0]
Number optionalStarting location of the line on the y-axis.
-
[x2=0]
Number optionalEnd location of the line on the x-axis.
-
[y2=0]
Number optionalEnd location of the line on the y-axis.
Returns:
This Object
Item Index
Methods
Methods
clone
-
[output=Line]
Makes a clone of this Line. The clone can 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:
-
[output=Line]
Kiwi.Geom.Line optional
Returns:
copyFrom
-
source
Make this Line a copy of another passed Line.
Parameters:
-
source
Kiwi.Geom.Linesource
Returns:
copyTo
-
target
Make another passed Line a copy of this one.
Parameters:
-
target
Kiwi.Geom.Linetarget
Returns:
getY
-
x
Get the y of a point on the line for a given x.
Parameters:
-
x
Number
Returns:
intersectLineLine
-
line
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.LineThe line you want to check for a Intersection with.
Returns:
The Intersect Result containing the collision information.
isPointOnLine
-
x
-
y
Check if a point is on the line.
Parameters:
-
x
Number -
y
Number
Returns:
isPointOnLineSegment
-
x
-
y
Check if the point is both on the line and within the line segment.
Parameters:
-
x
Number -
y
Number
Returns:
objType
()
String
public
Returns the type of this object
Returns:
"Line"
perp
-
x
-
y
-
[output]
Get a line perpendicular to the line passing through a given point.
Parameters:
-
x
Number -
y
Number -
[output]
Kiwi.Geom.Line optionalThe 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]
Used to set all components on the line.
Parameters:
-
[x1=0]
Number optionalX component of first point.
-
[y1=0]
Number optionalY component of first point.
-
[x2=0]
Number optionalX component of second point.
-
[y2=0]
Number optionalY component of second point.
Returns:
toString
()
String
public
Get a string representation of the line.
Returns:
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.