コード例 #1
0
        /// Initialize again this constraint.
        public override void Reset(Ta mobjA,
                                   Tb mobjB,
                                   collision.ChCollisionInfo cinfo)
        {
            // Base method call:
            base.Reset(mobjA, mobjB, cinfo);

            ChBody oA = (this.objA as ChBody);
            ChBody oB = (this.objB as ChBody);

            Rx.Get_tuple_a().SetVariables(ref this.objA);
            Rx.Get_tuple_b().SetVariables(ref this.objB);
            Ru.Get_tuple_a().SetVariables(ref this.objA);
            Ru.Get_tuple_b().SetVariables(ref this.objB);
            Rv.Get_tuple_a().SetVariables(ref this.objA);
            Rv.Get_tuple_b().SetVariables(ref this.objB);

            // Calculate composite material properties
            ChMaterialCompositeNSC mat = new ChMaterialCompositeNSC(
                this.container.GetSystem().composition_strategy,
                (ChMaterialSurfaceNSC)oA.GetMaterialSurfaceBase(),
                (ChMaterialSurfaceNSC)oB.GetMaterialSurfaceBase());

            Rx.SetRollingFrictionCoefficient(mat.rolling_friction);
            Rx.SetSpinningFrictionCoefficient(mat.spinning_friction);

            this.complianceRoll = mat.complianceRoll;
            this.complianceSpin = mat.complianceSpin;

            // COMPUTE JACOBIANS

            // delegate objA to compute its half of jacobian
            oA.ComputeJacobianForRollingContactPart(this.p1, ref this.contact_plane, ref Rx.Get_tuple_a(),
                                                    ref Ru.Get_tuple_a(), ref Rv.Get_tuple_a(), false);

            // delegate objB to compute its half of jacobian
            oB.ComputeJacobianForRollingContactPart(this.p2, ref this.contact_plane, ref Rx.Get_tuple_b(),
                                                    ref Ru.Get_tuple_b(), ref Rv.Get_tuple_b(), true);

            this.react_torque = ChVector.VNULL;
        }