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 "BoxWithJointSet.h"
15
// --- STL includes ---
22
BoxWithJointSet::BoxWithJointSet()
26
Construct box. Just calls constructor of base class.
28
\param pmin minimum point of bounding box
29
\param pmax maximum point of bounding box
31
BoxWithJointSet::BoxWithJointSet(const Vector3& pmin,const Vector3& pmax) : BoxWithPlanes3D(pmin,pmax)
35
get the n geometrical objects closest to a given point
38
\param nmax the max. nr. of objects
39
\return a map of [dist,*object] pairs
41
const map<double,const AGeometricObject*> BoxWithJointSet::getClosestObjects(const Vector3& p,int nmax) const
43
map<double,const AGeometricObject*> res;
45
for(vector<Plane>::const_iterator iter=m_planes.begin();
48
double ndist=iter->getDist(p);
49
res.insert(make_pair(ndist,&(*iter)));
52
for(vector<Triangle3D>::const_iterator iter=m_joints.begin();
55
double ndist=iter->getDist(p);
56
res.insert(make_pair(ndist,&(*iter)));
63
add a set of triangular patches as joints
65
\param t the joint set
67
void BoxWithJointSet::addJoints(const TriPatchSet& t)
69
for(vector<Triangle3D>::const_iterator iter=t.triangles_begin();
70
iter!=t.triangles_end();
72
m_joints.push_back(*iter);
77
check if a Sphere is inside and doesn't intersect any planes or other objects
81
bool BoxWithJointSet::isIn(const Sphere& S)
86
// check inside & planes via base class
87
bool res=BoxWithPlanes3D::isIn(S);
90
// check intersection with joints
91
vector<Triangle3D>::iterator iter=m_joints.begin();
93
while((iter!=m_joints.end()) && res){
94
dist=iter->getDist(p);
104
ostream& operator<< (ostream& ost, const BoxWithJointSet& B)
106
ost << B.m_pmin << " to " << B.m_pmax;