MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / CalcMinimumOnSegment

Method CalcMinimumOnSegment

comp/contact.cpp:57–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 }
56
57 bool CalcMinimumOnSegment( Vec<DIM> x1, Vec<DIM> x2, Vec<DIM> & res )
58 {
59 auto v = x2-x1;
60 Vec<DIM> va = a*v;
61 double lam = - InnerProduct(v,b) - InnerProduct(va,x1-x0);
62 lam /= InnerProduct(va,v);
63
64 if(lam<0 || lam>1.0)
65 return false;
66
67 res = lam*x2 + (1-lam)*x1;
68 return true;
69 }
70
71 Vec<DIM> CalcMinimum( )
72 {

Callers 1

FindClosestPointFunction · 0.80

Calls 1

InnerProductFunction · 0.50

Tested by

no test coverage detected