/** 初期化する。最初に一度だけ呼ぶこと */ public void reset(List <Controller.Constraint> src, PinnedArray <Point> points) { var d = new List <Constraint_Distance>(); var a = new List <Constraint_Axis>(); foreach (var i in src) { switch (i.mode) { case Controller.Constraint.Mode.Distance: { var b = new Constraint_Distance() { compliance = i.compliance }; b.reset( points.ptr + i.srcPointIdx, points.ptr + i.dstPointIdx ); d.Add(b); } break; case Controller.Constraint.Mode.Axis: { var b = new Constraint_Axis() { compliance = i.compliance, axis = i.axis }; b.reset( points.ptr + i.srcPointIdx, points.ptr + i.dstPointIdx ); a.Add(b); } break; default: throw new InvalidProgramException(); } } distance.reset(d.ToArray()); axis.reset(a.ToArray()); }