Skip to content

Commit

Permalink
SpatialIndex separate for 2D and 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
ctieben committed Sep 21, 2018
1 parent 593402e commit 796867f
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 290 deletions.
16 changes: 8 additions & 8 deletions include/sempr/processing/SpatialConclusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:
using Ptr = std::shared_ptr< SpatialConclusion<SpatialEntity> >;

// isGlobal is set if both geometries are transformed in the same global reference system
typedef std::function<bool(const SpatialIndex::Box& self,const SpatialIndex::Box& other, bool isGlobal)> CheckBoxFunction;
typedef std::function<bool(const SpatialIndex<3>::Box& self,const SpatialIndex<3>::Box& other, bool isGlobal)> CheckBoxFunction;
typedef std::function<bool(const entity::Geometry::Ptr& self,const entity::Geometry::Ptr& other, bool isGlobal)> CheckGeometryFunction;

SpatialConclusion(const std::weak_ptr<SpatialIndex>& spatialIndex) :
SpatialConclusion(const std::weak_ptr< SpatialIndex<3> >& spatialIndex) :
index_(spatialIndex)
{
globalRoot_ = false;
Expand Down Expand Up @@ -128,7 +128,7 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:


private:
std::weak_ptr<SpatialIndex> index_;
std::weak_ptr< SpatialIndex<3> > index_;

std::map<entity::Geometry::Ptr, std::string> spatialGeometry_;

Expand Down Expand Up @@ -330,13 +330,13 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:
}


static bool check2D(const SpatialIndex::Box& test)
static bool check2D(const SpatialIndex<3>::Box& test)
{
double h = abs(test.min_corner().get<2>() - test.max_corner().get<2>());
return h < 0.00001; // objects with a high less than 0.1mm
}

static bool checkNorthOf(const SpatialIndex::Box& self, const SpatialIndex::Box& other, bool isGlobal)
static bool checkNorthOf(const SpatialIndex<3>::Box& self, const SpatialIndex<3>::Box& other, bool isGlobal)
{
if (isGlobal)
{
Expand All @@ -348,7 +348,7 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:
}
}

static bool checkSouthOf(const SpatialIndex::Box& self, const SpatialIndex::Box& other, bool isGlobal)
static bool checkSouthOf(const SpatialIndex<3>::Box& self, const SpatialIndex<3>::Box& other, bool isGlobal)
{
if (isGlobal)
{
Expand All @@ -360,7 +360,7 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:
}
}

static bool checkEastOf(const SpatialIndex::Box& self, const SpatialIndex::Box& other, bool isGlobal)
static bool checkEastOf(const SpatialIndex<3>::Box& self, const SpatialIndex<3>::Box& other, bool isGlobal)
{
if (isGlobal)
{
Expand All @@ -372,7 +372,7 @@ class SpatialConclusion : public Module< core::EntityEvent<SpatialEntity>, core:
}
}

static bool checkWestOf(const SpatialIndex::Box& self, const SpatialIndex::Box& other, bool isGlobal)
static bool checkWestOf(const SpatialIndex<3>::Box& self, const SpatialIndex<3>::Box& other, bool isGlobal)
{
if (isGlobal)
{
Expand Down
Loading

0 comments on commit 796867f

Please sign in to comment.