RayTracable
public protocol RayTracable : Intersectable
A shape that can interact with a Ray
-
modifyRay(_:
Default implementation)
-
interface(of:
Extension method) -
deflectionAngle(for:
Extension methodat: refraction: extIndex: ) Calculate the angle of deflection using Snell’s Law of Reflection
Declaration
Parameters
dir
The angle of intersection
interface
The interface
refraction
The refraction index of the material
extIndex
The refraction index of the exterior material
Return Value
A
Vector
rotated by the abgle of reflection -
deflectRay(_:
Extension method) Deflect a ray according to Snell’s Law
Declaration
Swift
func deflectRay(_ ray: Ray)
Parameters
ray
The ray to deflect
-
criticalAngle(refraction:
Extension methodextIndex: ) Calculate the critical angle of a material
Declaration
Swift
func criticalAngle(refraction: Double, extIndex: Double) -> Radians
Parameters
refraction
The refraction index of the material
extIndex
The refraction index of the exterior material
Return Value
The critical angle
-
modifyRay(_:
Default implementation) Default Implementation
Modify the path of a ray by deflecting the ray through the object.
Declaration
Swift
func modifyRay(_ ray: Ray)
Parameters
ray
The ray to modify