Ejemplo n.º 1
0
        private Vector3 get_force(ModelNode x, int node_index)
        {
            List <int> indices     = x.AdjacencyIndices;
            Vector3    total_force = Vector3.Zero;

            for (int i = 0; i < x.EdgeCount; i++)
            {
                Adjacency current_edge   = currentstate.GetEdge(indices[i]);
                int       relevant_index = current_edge.GetRelevantIndex(node_index);
                ModelNode y               = currentstate.GetNode(relevant_index);
                Vector3   direction       = new Vector3(x.CurrentLocation, y.CurrentLocation);
                double    eff_length      = direction.Norm - current_edge.EquilibriumLength;
                double    total_magnitude = current_edge.SpringConstant * eff_length;
                Vector3   current_force   = (total_magnitude / direction.Norm) * direction;
                //Vector3 current_force = direction;
                total_force = total_force + current_force;
            }
            return(total_force - x.DampingCoefficient * x.CurrentVelocity);
        }