TTK
Loading...
Searching...
No Matches
MergeTreePrincipalGeodesics.cpp
Go to the documentation of this file.
2
3namespace ttk {
5 std::vector<std::vector<std::vector<double>>> &vS,
6 std::vector<std::vector<std::vector<double>>> &v2s,
7 bool doPrint) {
8 unsigned int const geodesicNumber = vS.size() - 1;
9 if(geodesicNumber == 0)
10 return 0.0;
11 if(doPrint)
12 printMsg("Scalar Products:");
13 double cost = 0.0;
14 std::vector<std::vector<double>> sumVs;
16 for(unsigned int i = 0; i < geodesicNumber; ++i) {
17 double const scalarProd
18 = ttk::Geometry::dotProduct(sumVs[i], sumVs[geodesicNumber]);
19 cost += scalarProd * scalarProd;
20 if(doPrint and geodesicNumber < 4) {
21 std::stringstream ss;
22 ss << " - " << i << " _ " << scalarProd;
23 printMsg(ss.str());
24 }
25 }
26 if(doPrint) {
27 std::stringstream ss;
28 ss << " - Ortho. Cost : " << cost;
29 printMsg(ss.str());
30 }
31 return cost;
32 }
33
35 std::vector<std::vector<std::vector<double>>> &vS,
36 std::vector<std::vector<std::vector<double>>> &v2s,
37 std::vector<std::vector<double>> &v,
38 std::vector<std::vector<double>> &v2,
39 bool doPrint) {
40 std::vector<std::vector<std::vector<double>>> vSTemp = vS, v2sTemp = v2s;
41 vSTemp.push_back(v);
42 v2sTemp.push_back(v2);
43 return verifyOrthogonality(vSTemp, v2sTemp, doPrint);
44 }
45} // namespace ttk
double verifyOrthogonality(std::vector< std::vector< std::vector< double > > > &vS, std::vector< std::vector< std::vector< double > > > &v2s, bool doPrint=true)
T dotProduct(const T *vA0, const T *vA1, const T *vB0, const T *vB1)
Definition Geometry.cpp:388
int multiAddVectorsFlatten(const std::vector< std::vector< std::vector< T > > > &a, const std::vector< std::vector< std::vector< T > > > &b, std::vector< std::vector< T > > &out)
Definition Geometry.cpp:581
The Topology ToolKit.
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)