24#include "fmatvec/fmatvec.h"
25#include "mbsim/mbsim_event.h"
26#include <mbsim/numerics/csparse.h>
27#include <mbxmlutilshelper/dom.h>
28#include <xercesc/dom/DOMDocument.hpp>
32#include <boost/lexical_cast.hpp>
33#include <boost/algorithm/string/trim.hpp>
40 double sign(
double x);
45 inline double mod(
double x,
double y) {
return x - y * floor (x / y); }
53 double ArcTan(
double x,
double y);
67 static double cast(
const double &x) {
75 static double cast(
const fmatvec::Vector<Col,double> &x) {
81 class ToDouble<fmatvec::RowVector<Row,double>> {
83 static double cast(
const fmatvec::RowVector<Row,double> &x) {
91 static Ret cast(
double x) {
92 throw std::runtime_error(
"FromDouble::cast not implemented for current type.");
99 static fmatvec::Vector<Col,double> cast(
double x) {
100 return fmatvec::Vector<Col,double>(1,fmatvec::INIT,x);
107 static fmatvec::RowVector<Col,double> cast(
double x) {
108 return fmatvec::RowVector<Col,double>(1,fmatvec::INIT,x);
112 template <
class Row,
class Col>
113 class FromDouble<fmatvec::Matrix<fmatvec::General,Row,Col,double>> {
115 static fmatvec::Matrix<fmatvec::General,Row,Col,double> cast(
double x) {
116 return fmatvec::Matrix<fmatvec::General,Row,Col,double>(1,1,fmatvec::INIT,x);
123 static double cast(
double x) {
131 static Ret cast(
const fmatvec::VecV &x) {
139 static double cast(
const fmatvec::VecV &x) {
144 template <
typename T>
147 static fmatvec::Mat cast(
const std::vector<T> &x) {
148 fmatvec::Mat y(x.size(),x[0].cols(),fmatvec::NONINIT);
149 for (
unsigned int i=0; i<x.size(); i++)
158 static fmatvec::Vec cast(
const std::vector<double> &x) {
159 fmatvec::Vec y(x.size(),fmatvec::NONINIT);
160 for (
unsigned int i=0; i<x.size(); i++)
170 fmatvec::Vec3 computeTangential(
const fmatvec::Vec3 &n);
namespace MBSim
Definition: bilateral_constraint.cc:30
double sign(double x)
Compute the sign of x.
Definition: utils.cc:30
double mod(double x, double y)
Compute the modulo of x and y.
Definition: utils.h:45
Mat cs2Mat(cs *sparseMat)
calculate a fmatvec::Mat out of a sparse matrix
Definition: utils.cc:48
double ArcTan(double x, double y)
calculates planar angle in [0,2\pi] with respect to Cartesian coordinates of: Arc Tangent (y/x)
Definition: utils.cc:39