Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a bug in function bool PBD::DirectPositionBasedSolverForStiffRods::solve(...) in PositionBasedElasticRods.cpp #79

Open
Allen3Young opened this issue Nov 4, 2019 · 0 comments

Comments

@Allen3Young
Copy link

I think the constraints do not work in the right way when there are more than one static segment because in the
bool PBD::DirectPositionBasedSolverForStiffRods::solve(int , std::list <Node*> * , std::list <Node*> * , std::vector<Vector6r> & , std::vector<Vector6r> & , std::vector<Vector3r> & , std::vector<Quaternionr> & )
of PositionBasedElasticRods.cpp

       // compute position and orientation updates
	for (nodeIter = forward[intervalIndex].begin(); nodeIter != forward[intervalIndex].end(); nodeIter++)
	{
		Node *node = *nodeIter;
		if (!node->isconstraint)
		{
			RodSegment *segment = (RodSegment *)node->object;
			if (!segment->isDynamic())
			{
                            break;
			}

			const Vector6r & soln(node->soln);
			Vector3r deltaXSoln = Vector3r(-soln[0], -soln[1], -soln[2]);
			corr_x[node->index] = deltaXSoln;

			Eigen::Matrix<Real, 4, 3> G;
			computeMatrixG(segment->Rotation(), G);
			Quaternionr deltaQSoln;
			deltaQSoln.coeffs() = G * Vector3r(-soln[3], -soln[4], -soln[5]);
			corr_q[node->index] = deltaQSoln;
		}
	}

Here I guess when a segment is not dynamic, the loop needs continue instead of break.
Therefore, when there is no non-dynamic segment, the update is fine. And when there is one non-dynamic-segment, the update is also okay because the non-dynamic segment is the root which is at the end of the forward vector. However, when there is more than one static segment, the segments between the first and the last segments will not satisfy under rods constraints(bending, twisting, etc.) anymore because they are not updated then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant