1
/////////////////////////////////////////////////////////////
3
// Copyright (c) 2007-2011 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
11
/////////////////////////////////////////////////////////////
13
#include "fit_3d_sphere.h"
19
fit_3d_sphere_fn::fit_3d_sphere_fn(const AGeometricObject* GO1,
20
const AGeometricObject* GO2,
21
const AGeometricObject* GO3,
22
const AGeometricObject* GO4)
30
double fit_3d_sphere_fn::operator()(const nvector<double,3>& data) const
32
Vector3 x=Vector3(data[0],data[1],data[2]);
34
double ra=m_GO1->getDist(x);
35
double rb=m_GO2->getDist(x);
36
double rc=m_GO3->getDist(x);
37
double rd=m_GO4->getDist(x);
39
double rq=(ra+rb+rc+rd)*0.25;
40
double dr=sqrt((rq-ra)*(rq-ra)+(rq-rb)*(rq-rb)+(rq-rc)*(rq-rc)+(rq-rd)*(rq-rd));