MCPcopy Create free account
hub / github.com/apache/groovy / unitise

Method unitise

benchmark/bench/raytracer.java:17–17  ·  view source on GitHub ↗
(Vec a)

Source from the content-addressed store, hash-verified

15 Vec scale(double s, Vec a) { return new Vec(s*a.x, s*a.y, s*a.z); }
16 double dot(Vec a, Vec b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
17 Vec unitise(Vec a) { return scale(1 / Math.sqrt(dot(a, a)), a); }
18 class Ray {
19 public Vec orig, dir;
20 public Ray(Vec o, Vec d) { orig=o; dir=d; }

Callers 2

runMethod · 0.95
intersectMethod · 0.80

Calls 2

scaleMethod · 0.95
dotMethod · 0.95

Tested by

no test coverage detected