Ray
public class Ray
An object representing a set of straight lines originating from a point.
The Ray may be modified by intersecting it with other Shapes
-
The position of the ray
Declaration
Swift
public var origin: Vector -
The direction of the ray
Declaration
Swift
public var direction: Vector -
The path the ray has taken
Declaration
Swift
public var path: [Line] -
Whether or no the ray is terminated
If this value is true no more tracing will be done
Declaration
Swift
public var isTerminated: Bool -
Instantiate a new Ray.
Declaration
Swift
public convenience init(x: Double, y: Double, direction: Degrees)Parameters
xThe X position of the Ray.
yThe Y position of the Ray.
directionThe direction of the Ray, in degrees.
-
Remove the ray’s saved path and reset its iterations
Declaration
Swift
public func resetPath() -
Stop the receiver from continuing to trace new paths.
Declaration
Swift
public func terminateRay() -
Perform the ray tracing operation.
Declaration
Swift
public func run(objects: [RayTracable])Parameters
objectsThe objects to trace against.
-
Draw the emitter and ray trace using the specified objects
Declaration
Swift
public func draw()Parameters
objectsObjects to test for intersection when casting rays
-
Draws a representation of the emitter suitable for debugging.
Declaration
Swift
public func debugDraw(in context: CGContext)Parameters
contextContext in which to draw
View on GitHub
Ray Class Reference