Commit 3b621c07 authored by Michael Turner's avatar Michael Turner
Browse files

added normal vector testing, works fine, problem with octree is elsewhere

parent e9e76af7
......@@ -409,6 +409,22 @@ void CADSystem::AddSurf(int i, TopoDS_Shape in, vector<EdgeLoop> ein)
{
m_surfs[i]->SetTwoC();
}
//check the normals are interior
Array<OneD, NekDouble> bnds = newSurf->GetBounds();
Array<OneD, NekDouble> uv(2);
uv[0] = (bnds[1]+bnds[0])/2.0;
uv[1] = (bnds[3]+bnds[2])/2.0;
Array<OneD, NekDouble> N = newSurf->N(uv);
Array<OneD, NekDouble> P = newSurf->P(uv);
Array<OneD, NekDouble> tl(3);
tl[0] = P[0] + 0.01*N[0];
tl[1] = P[1] + 0.01*N[1];
tl[2] = P[2] + 0.01*N[2];
ASSERTL0(InsideShape(tl), "normal incorrectly orientated");
}
bool CADSystem::InsideShape(Array<OneD, NekDouble> loc)
......
......@@ -165,5 +165,10 @@ bool operator==(OctantSharedPtr const &p1, OctantSharedPtr const &p2)
return false;
}
bool lessThanOp(OctantSharedPtr const &p1, OctantSharedPtr const &p2)
{
return p1->GetId() < p2->GetId();
}
}
}
......@@ -53,6 +53,8 @@ class Octant; //have to forward declare the class for the sharedptr
typedef boost::shared_ptr<Octant> OctantSharedPtr;
typedef std::set<OctantSharedPtr> OctantSet;
bool lessThanOp(OctantSharedPtr const &p1, OctantSharedPtr const &p2);
/**
* @brief this class contains the infomration and methods for individal octants
* in the Octree
......@@ -75,7 +77,10 @@ class Octant
void ClearNeigbourList(){m_neighbourList.clear();}
void SetNeigbourList(std::vector<OctantSharedPtr> const &l)
{m_neighbourList = l;}
{
std::sort(l.begin(), l.end(), &lessThanOp);
m_neighbourList = l;
}
int GetId(){return m_id;}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment