MCPcopy Create free account
hub / github.com/MITK/MITK / CalculateCentroid

Method CalculateCentroid

Modules/AlgorithmsExt/src/mitkPlaneFit.cpp:116–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void mitk::PlaneFit::CalculateCentroid(int t)
117{
118 if (m_PointSet == nullptr)
119 return;
120
121 int ps_total = m_PointSet->GetSize(t);
122
123 m_Centroids[t][0] = m_Centroids[t][1] = m_Centroids[t][2] = 0.0;
124
125 for (int i = 0; i < ps_total; i++)
126 {
127 mitk::Point3D p3d = m_PointSet->GetPoint(i, t);
128 m_Centroids[t][0] += p3d[0];
129 m_Centroids[t][1] += p3d[1];
130 m_Centroids[t][2] += p3d[2];
131 }
132
133 // calculation of centroid
134 m_Centroids[t][0] /= ps_total;
135 m_Centroids[t][1] /= ps_total;
136 m_Centroids[t][2] /= ps_total;
137}
138
139void mitk::PlaneFit::ProcessPointSet(int t)
140{

Callers 1

GenerateDataMethod · 0.95

Calls 2

GetSizeMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected