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

Method normalize

code/geometry/primitives3d.cpp:35–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 point3d N = (B-A)*(C-A); double D = A%N;
34 return ((*this)%N - D)/N.length(); }
35 point3d normalize(double k = 1) const {
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()); }

Callers 8

testFunction · 0.80
getProjectionMethod · 0.80
rotatePointMethod · 0.80
line_line_intersectFunction · 0.80
operator +Method · 0.80
operator -Method · 0.80
operator *Method · 0.80
divmodMethod · 0.80

Calls

no outgoing calls

Tested by 1

testFunction · 0.64