diff options
| author | Martin Lehoux <martin@lehoux.net> | 2020-04-04 19:55:48 -0700 |
|---|---|---|
| committer | Martin Lehoux <martin@lehoux.net> | 2020-04-04 19:55:48 -0700 |
| commit | 8730659596dbfdb9625c0fc413625b261f7d6d70 (patch) | |
| tree | 85ff11a0c8f5a770b39330ec140965ffcc810ed5 /vec3d.go | |
| parent | 13be7ded788fe88d5ac8d6759273516652bf1a80 (diff) | |
feat - Add Metal material
Diffstat (limited to 'vec3d.go')
| -rw-r--r-- | vec3d.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -25,6 +25,10 @@ func (vec Vec3D) Unit() Vec3D { return ScalarProduct(1.0/length, vec) } +func (vec Vec3D) Reflect(normal Vec3D) Vec3D { + return SubVec3D(vec, ScalarProduct(2*DotProduct(vec, normal), normal)) +} + func AddVec3D(vec1 Vec3D, vec2 Vec3D) Vec3D { return Vec3D{vec1.x + vec2.x, vec1.y + vec2.y, vec1.z + vec2.z} } |
