Beispiel #1
0
        public SharpEngine(
            PhysicsEngineParameters simulationParameters,
            CollisionEngineParameters collisionEngineParameters,
            SolverParameters solverParameters)
        {
            SolverParameters     = solverParameters;
            CollisionEngineParam = collisionEngineParameters;
            EngineParameters     = simulationParameters;

            // Default solver
            SetSolverType(SolverType.ProjectedGaussSeidel);

            Shapes = new IShape[0];

            CollisionEngine = new CollisionDetectionEngine(
                collisionEngineParameters,
                EngineParameters.CollisionDistance);

            contactPartitioningEngine = new ContactPartitioningEngine();

            CollisionShapes          = new List <ICollisionShape>();
            CollisionJoints          = new List <ICollisionJoint>();
            Joints                   = new List <IConstraint> ();
            HsGenerator              = new HashGenerator();
            LinearSystemBuilder      = new LinearProblemBuilderEngine(EngineParameters);
            IntegrateVelocityEngine  = new IntegrateVelocity(EngineParameters);
            IntegratePositionEngine  = new IntegratePosition(EngineParameters);
            contactConstraintBuilder = new ContactConstraintBuilder(EngineParameters);
            rayCastEngine            = new RayCastingEngine();
            warmStartEngine          = new WarmStartEngine(EngineParameters);
            ccdEngine                = new ConservativeAdvancement();
        }
        public ProjectedSymmetricGS(
            SolverParameters solverParameters,
            LinearProblemBuilderEngine lcpEngine)
        {
            SolverParameters = solverParameters;

            var gaussSeidelSolverParam = new SolverParameters(
                2,
                SolverParameters.ErrorTolerance,
                1.0,
                SolverParameters.MaxThreadNumber);

            gsSolver       = new ProjectedGaussSeidel(gaussSeidelSolverParam);
            this.lcpEngine = lcpEngine;
        }
        public NonLinearGaussSeidel(
            SolverParameters solverParameters,
            LinearProblemBuilderEngine lcpEngine,
            IntegrateVelocity velocityIntegration)
        {
            solverParam              = solverParameters;
            this.lcpEngine           = lcpEngine;
            this.velocityIntegration = velocityIntegration;

            var gaussSeidelSolverParam = new SolverParameters(
                1,
                solverParam.ErrorTolerance,
                solverParam.SOR,
                solverParam.MaxThreadNumber);

            gaussSeidelSolver = new ProjectedGaussSeidel(gaussSeidelSolverParam);
        }