Dart DocumentationcollisionsChecker_T1

Checker_T1 class

Check only the current position3d of particles and segment

class Checker_T1 implements Checker{
 final IntersectionFinder _intf = new IntersectionFinderXY();

 /// Returns whether two particles A ([psA] + [iA]) and B [psB] + [iB]) intersect
 /// [psA.collide[iA]] and [psB.collide[iB]] are set to true if collision.
 /// Doesn't check if provided particles are the same or part of same group,... should be done before calling.
 /// take care of radius of each particle
 collideParticleParticle(Particles psA, int iA, Particles psB, int iB, Vector4 acol) {
   //psA = psA as Particles;
   var b = _intf.sphere_sphere(psA.position3d[iA], psA.radius[iA], psB.position3d[iB], psA.radius[iB]);
   if (b) {
     psA.collide[iA] = -1;
     psB.collide[iB] = -1;
   }
   return b;
 }

 /// Returns whether the provided particle A and the segment [s]
 /// Doesn't check if provided particles are the same or part of same group,... should be done before calling.
 /// only check against last position of the segment
 collideParticleSegment(Particles psA, int iA, Segment s, Vector4 scol) {
   var b = false;
   b = b || _intf.segment_sphere(s.ps.position3d[s.i1], s.ps.position3d[s.i2], psA.position3d[iA], psA.radius[iA]);

   if (b) {
     psA.collide[iA] = -1;
     s.collide = -1;
   }
   return b;
 }
}

Implements

Checker

Methods

dynamic collideParticleParticle(Particles psA, int iA, Particles psB, int iB, Vector4 acol) #

Returns whether two particles A ( psA + iA) and B psB + iB) intersect [psA.collide[iA]] and [psB.collide[iB]] are set to true if collision. Doesn't check if provided particles are the same or part of same group,... should be done before calling. take care of radius of each particle

collideParticleParticle(Particles psA, int iA, Particles psB, int iB, Vector4 acol) {
 //psA = psA as Particles;
 var b = _intf.sphere_sphere(psA.position3d[iA], psA.radius[iA], psB.position3d[iB], psA.radius[iB]);
 if (b) {
   psA.collide[iA] = -1;
   psB.collide[iB] = -1;
 }
 return b;
}

dynamic collideParticleSegment(Particles psA, int iA, Segment s, Vector4 scol) #

Returns whether the provided particle A and the segment s Doesn't check if provided particles are the same or part of same group,... should be done before calling. only check against last position of the segment

collideParticleSegment(Particles psA, int iA, Segment s, Vector4 scol) {
 var b = false;
 b = b || _intf.segment_sphere(s.ps.position3d[s.i1], s.ps.position3d[s.i2], psA.position3d[iA], psA.radius[iA]);

 if (b) {
   psA.collide[iA] = -1;
   s.collide = -1;
 }
 return b;
}