MCPcopy Create free account
hub / github.com/PDAL/PDAL / satisfyConstraintSelf

Method satisfyConstraintSelf

filters/private/csf/Particle.cpp:32–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void Particle::satisfyConstraintSelf(int constraintTimes) {
33 Particle *p1 = this;
34
35 for (std::size_t i = 0; i < neighborsList.size(); i++) {
36 Particle *p2 = neighborsList[i];
37 Vec3 correctionVector(0, p2->pos.f[1] - p1->pos.f[1], 0);
38
39 if (p1->isMovable() && p2->isMovable()) {
40 // Lets make it half that length, so that we can move BOTH p1 and p2.
41 Vec3 correctionVectorHalf = correctionVector * (
42 constraintTimes > 14 ? 0.5 : doubleMove1[constraintTimes]
43 );
44 p1->offsetPos(correctionVectorHalf);
45 p2->offsetPos(-correctionVectorHalf);
46 } else if (p1->isMovable() && !p2->isMovable()) {
47 Vec3 correctionVectorHalf = correctionVector * (
48 constraintTimes > 14 ? 1 : singleMove1[constraintTimes]
49 );
50 p1->offsetPos(correctionVectorHalf);
51 } else if (!p1->isMovable() && p2->isMovable()) {
52 Vec3 correctionVectorHalf = correctionVector * (
53 constraintTimes > 14 ? 1 : singleMove1[constraintTimes]
54 );
55 p2->offsetPos(-correctionVectorHalf);
56 }
57 }
58}

Callers 1

timeStepMethod · 0.80

Calls 3

isMovableMethod · 0.80
offsetPosMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected