MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / getProjection

Method getProjection

code/geometry/primitives3d.cpp:38–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 // length() must not return 0
37 return (*this) * (k / length()); }
38 point3d getProjection(P(A), P(B)) const {
39 point3d v = B - A;
40 return A + v.normalize((v % (*this - A)) / v.length()); }
41 point3d rotate(P(normal)) const {
42 //normal must have length 1 and be orthogonal to the vector
43 return (*this) * normal; }

Callers

nothing calls this directly

Calls 2

normalizeMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected