Kiwi.Geom.Ray Class
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]
Parameters:
-
[x1=0]
Number optionalStarting location of the ray on the x-axis
-
[y1=0]
Number optionalStarting location of the ray on the y-axis
-
[x2=0]
Number optionalEnd location of the ray on the x-axis. Used to calculate direction so it isn't really the 'end' location.
-
[y2=0]
Number optionalEnd location of the ray on the y-axis. Used to calculate direction so it isn't really the 'end' location.
Returns:
This object
Item Index
Methods
Methods
clone
-
[output]
Makes a copy of this Ray, either as a new Ray object, or makes a passed Ray a copy of this one.
Parameters:
-
[output]
Kiwi.Geom.Ray 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:
isPointOnRay
-
x
-
y
Check if the Ray passes through a point.
Parameters:
-
x
Number -
y
Number
Returns:
objType
()
String
public
The type of this object.
Returns:
"Ray"
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 ray.
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.