27 const Eigen::DenseBase<VectorLikeIn> & x,
28 const Eigen::DenseBase<VectorLikeOut> &
x_proj_)
31 Eigen::DenseIndex index = 0;
49 const Eigen::DenseBase<VectorLikeIn> & x,
50 const Eigen::DenseBase<VectorLikeOut> &
x_proj_)
53 Eigen::DenseIndex index = 0;
68 Scalar computeConicComplementarity(
70 const Eigen::DenseBase<VectorLikeVelocity> &
velocities,
71 const Eigen::DenseBase<VectorLikeForce> &
forces)
74 Eigen::DenseIndex index = 0;
84 return complementarity;
89 typename ConstraintAllocator,
90 typename VectorLikeIn,
91 typename VectorLikeOut>
92 void computeComplementarityShift(
93 const std::vector<CoulombFrictionConeTpl<Scalar>, ConstraintAllocator> & cones,
94 const Eigen::DenseBase<VectorLikeIn> & velocities,
95 const Eigen::DenseBase<VectorLikeOut> & shift_)
97 assert(velocities.size() == shift_.size());
98 Eigen::DenseIndex index = 0;
99 VectorLikeOut & shift = shift_.const_cast_derived();
100 for (
const auto & cone : cones)
102 shift.template segment<3>(index) =
103 cone.computeNormalCorrection(velocities.template segment<3>(index));
108 template<
typename Scalar,
typename Constra
intAllocator,
typename VectorLikeIn>
109 Scalar computePrimalFeasibility(
110 const std::vector<CoulombFrictionConeTpl<Scalar>, ConstraintAllocator> & cones,
111 const Eigen::DenseBase<VectorLikeIn> & forces)
113 typedef CoulombFrictionConeTpl<Scalar> Cone;
114 typedef typename Cone::Vector3 Vector3;
116 Eigen::DenseIndex index = 0;
118 for (
const auto & cone : cones)
120 const Vector3 df_projected =
121 cone.project(forces.template segment<3>(index)) - forces.template segment<3>(index);
122 norm = math::max(norm, df_projected.norm());
131 typename ConstraintAllocator,
132 typename ForceVector,
133 typename VelocityVector>
134 Scalar computeReprojectionError(
135 const std::vector<CoulombFrictionConeTpl<Scalar>, ConstraintAllocator> & cones,
136 const Eigen::DenseBase<ForceVector> & forces,
137 const Eigen::DenseBase<VelocityVector> & velocities)
139 typedef CoulombFrictionConeTpl<Scalar> Cone;
140 typedef typename Cone::Vector3 Vector3;
142 Eigen::DenseIndex index = 0;
144 for (
const auto & cone : cones)
146 const Vector3 df_projected =
147 forces.template segment<3>(index)
148 - cone.project(forces.template segment<3>(index) - velocities.template segment<3>(index));
149 norm = math::max(norm, df_projected.norm());
void computeConeProjection(const std::vector< CoulombFrictionConeTpl< Scalar >, ConstraintAllocator > &cones, const Eigen::DenseBase< VectorLikeIn > &x, const Eigen::DenseBase< VectorLikeOut > &x_proj_)
Project a vector x on the vector of cones.
void computeDualConeProjection(const std::vector< CoulombFrictionConeTpl< Scalar >, ConstraintAllocator > &cones, const Eigen::DenseBase< VectorLikeIn > &x, const Eigen::DenseBase< VectorLikeOut > &x_proj_)
Project a vector x on the dual of the cones contained in the vector of cones.