-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPI_IsctWithParticleSegmentVisitor.cpp
42 lines (32 loc) · 1.23 KB
/
MPI_IsctWithParticleSegmentVisitor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// MPI_IsctWithParticleSegmentVisitor.cpp
//
#include "MPI_IsctWithParticleSegmentVisitor.h"
#include "MPI_ParticleSegment.h"
#include "MPI_RemovalSegment.h"
MPI_IsctWithParticleSegmentVisitor::MPI_IsctWithParticleSegmentVisitor( MPI_ParticleSegment &particlesegment ) :
MPI_SegmentIntersectionVisitor( particlesegment ),
particlesegment_( particlesegment )
{
// empty
}
void MPI_IsctWithParticleSegmentVisitor::visitSegment( MPI_Segment &segment ) const
{
// empty
}
void MPI_IsctWithParticleSegmentVisitor::visitParticleSegment( MPI_ParticleSegment &segment ) const
{
// determine if the two segments intersect, and if they do,
// add the appropriate intersection between them.
// findIntersection() returns the parameter values where the intersection
// happens for each segment through the arguments thissegpos, othersegpos.
float thissegpos = 0.0;
float othersegpos = 0.0;
if ( particlesegment_.findIntersection(segment, thissegpos, othersegpos) )
particlesegment_.addParticleSegIntersection( segment, thissegpos, othersegpos );
}
void MPI_IsctWithParticleSegmentVisitor::visitRemovalSegment( MPI_RemovalSegment &segment ) const
{
visitSegment( segment );
}
// vim:sw=4:et:cindent: