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
dirThe angle of intersection
interfaceThe interface
refractionThe refraction index of the material
extIndexThe refraction index of the exterior material
Return Value
A
Vectorrotated by the abgle of reflection -
deflectRay(_:Extension method) Deflect a ray according to Snell’s Law
Declaration
Swift
func deflectRay(_ ray: Ray)Parameters
rayThe ray to deflect
-
criticalAngle(refraction:Extension methodextIndex: ) Calculate the critical angle of a material
Declaration
Swift
func criticalAngle(refraction: Double, extIndex: Double) -> RadiansParameters
refractionThe refraction index of the material
extIndexThe 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
rayThe ray to modify
View on GitHub
RayTracable Protocol Reference