← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1751: Realise InsertionSortCollider::probeBoundingVolume() so SpheresFactory now works

 

------------------------------------------------------------
revno: 1751
committer: Sergei D. <sega@laptop>
branch nick: trunk
timestamp: Tue 2009-09-01 12:51:57 +0400
message:
  Realise InsertionSortCollider::probeBoundingVolume() so SpheresFactory now works
modified:
  core/Collider.hpp
  examples/STLImporterTest.py
  pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp
  pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'core/Collider.hpp'
--- core/Collider.hpp	2009-03-01 20:35:11 +0000
+++ core/Collider.hpp	2009-09-01 08:51:57 +0000
@@ -16,6 +16,10 @@
 	public :
 		Collider();
 		virtual ~Collider();
+		/*! To probe the BoundingVolume on a bodies presense.
+		 *
+		 * Returns true, if the BoundingVolume contains a bodies, otherwise it returns false.
+		 */
 		virtual  bool probeBoundingVolume(const BoundingVolume&){throw;}
 		/*! Tell whether given bodies may interact, for other than spatial reasons.
 		 *

=== modified file 'examples/STLImporterTest.py'
--- examples/STLImporterTest.py	2009-08-10 16:59:33 +0000
+++ examples/STLImporterTest.py	2009-09-01 08:51:57 +0000
@@ -4,7 +4,6 @@
 ## PhysicalParameters 
 Density=2400
 frictionAngle=radians(35)
-sphereRadius=0.05
 tc = 0.001
 en = 0.3
 es = 0.3

=== modified file 'pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp'
--- pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp	2009-08-12 08:27:41 +0000
+++ pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp	2009-09-01 08:51:57 +0000
@@ -61,6 +61,27 @@
 	}
 }
 
+bool InsertionSortCollider::probeBoundingVolume(const BoundingVolume& bv)
+{
+	probedBodies.clear();
+	for( vector<Bound>::iterator 
+			it=XX.begin(),et=XX.end(); it < et; ++it)
+	{
+		if (it->coord > bv.max[0]) break;
+		if (!it->flags.isMin) continue;
+		int offset = 3*it->id;
+		if (!(maxima[offset] < bv.min[0] ||
+				minima[offset+1] > bv.max[1] ||
+				maxima[offset+1] < bv.min[1] ||
+				minima[offset+2] > bv.max[2] ||
+				maxima[offset+2] < bv.min[2] )) 
+		{
+			probedBodies.push_back(it->id);
+		}
+	}
+	return (bool)probedBodies.size();
+}
+
 #ifdef COLLIDE_STRIDED
 	bool InsertionSortCollider::isActivated(MetaBody* rb){
 		// activated if number of bodies changes (hence need to refresh collision information)

=== modified file 'pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp'
--- pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp	2009-08-12 08:27:41 +0000
+++ pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp	2009-09-01 08:51:57 +0000
@@ -98,6 +98,8 @@
 		virtual bool isActivated(MetaBody*);
 	#endif
 
+	bool probeBoundingVolume(const BoundingVolume&);
+
 	InsertionSortCollider():
 	#ifdef COLLIDE_STRIDED
 		strideActive(false), sweepLength(-1), sweepFactor(1.05), fastestBodyMaxDist(-1), nBins(0), binCoeff(5), binOverlap(0.8),