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
/////////////////////////////////////////////////////////////
15
// --- System includes ---
20
double Sphere::NearZero=1e-8;
21
int Sphere::s_output_style=0;
22
unsigned int Sphere::s_current_id=0;
25
construct "invalid" Sphere
35
construct valid Sphere
37
\param center the center of the circle
40
Sphere::Sphere(const Vector3& center,double rad)
45
m_id=Sphere::s_current_id;
46
Sphere::s_current_id++;
55
Sphere::Sphere(const Sphere& S)
65
get distance between given point and the surface of the Sphere
69
double Sphere::getDist(const Vector3& P) const
71
return (P-m_center).norm()-m_rad;
76
Set id of sphere. If higher than current_id, increase current_id
79
\param i the new id of the sphere
81
void Sphere::setId(int i)
92
\param style the output style: 0=Debug, 1=.geo
94
void Sphere::SetOutputStyle(int style)
96
Sphere::s_output_style=style;
99
ostream& operator << (ostream& ost, const Sphere& S)
101
if(Sphere::s_output_style==0){
103
ost << S.m_center << " | " << S.m_rad << " | " << S.m_id;
105
ost << "invalid Sphere";
107
} else if (Sphere::s_output_style==1){
109
ost << S.m_center << " " << S.m_rad << " " << S.m_id << " " << S.m_tag;