let surface_param ~mu =
let rec aux p = function [] -> p
| (Mu2 mu2)::t -> aux {p with sp_mu2=mu2; sp_mode=`dContactMu2::p.sp_mode} t
| (Bounce bounce)::t -> aux {p with sp_bounce=bounce; sp_mode=`dContactBounce::p.sp_mode} t
| (BounceVel bounce_vel)::t -> aux {p with sp_bounce_vel=bounce_vel; sp_mode=`dContactBounce::p.sp_mode} t
| (SoftERP soft_erp)::t -> aux {p with sp_soft_erp=soft_erp; sp_mode=`dContactSoftERP::p.sp_mode} t
| (SoftCFM soft_cfm)::t -> aux {p with sp_soft_cfm=soft_cfm; sp_mode=`dContactSoftCFM::p.sp_mode} t
| (Motion1 motion1)::t -> aux {p with sp_motion1=motion1; sp_mode=`dContactMotion1::p.sp_mode} t
| (Motion2 motion2)::t -> aux {p with sp_motion2=motion2; sp_mode=`dContactMotion2::p.sp_mode} t
| (Slip1 slip1)::t -> aux {p with sp_slip1=slip1; sp_mode=`dContactSlip1::p.sp_mode} t
| (Slip2 slip2)::t -> aux {p with sp_slip2=slip2; sp_mode=`dContactSlip2::p.sp_mode} t
in
let p = {
sp_mode = [];
sp_mu = mu;
sp_mu2 = 0.0;
sp_bounce = 0.0;
sp_bounce_vel = 0.0;
sp_soft_erp = 0.0;
sp_soft_cfm = 0.0;
sp_motion1 = 0.0;
sp_motion2 = 0.0;
sp_slip1 = 0.0;
sp_slip2 = 0.0;
} in
aux p