Commit 269b6d8a authored by Chae Ho Shin's avatar Chae Ho Shin

add 3-p

parent 00600790
......@@ -295,6 +295,8 @@ public class FlatlandMovement : MonoBehaviour
FlatlandMovement other = collision.transform.parent.GetComponent<FlatlandMovement>();
Vector3 col = (other.v - this.v);
var totalThreeMomentum = this.GetThreeMomentum() + other.GetThreeMomentum();
var tmp = collision.GetContact(0).normal;
tmp = new Vector3(tmp.x, 0, tmp.z);
......@@ -333,4 +335,27 @@ public class FlatlandMovement : MonoBehaviour
alpha -= collisionforce;
collisionforce = new Vector3(0, 0, 0);
}
public double GetEnergy()
{
return Constants.Gamma(v.magnitude) * mass * Constants.c * Constants.c;
}
public Vector<double> GetThreeMomentum()
{
var twop = GetTwoMomentum();
double[] tmp = { GetEnergy() / Constants.c, twop[0], twop[1] };
var result = V.DenseOfArray(tmp);
return result;
}
public Vector<double> GetTwoMomentum()
{
double[] tmp = {Constants.Gamma(v.magnitude) * mass * v.x, Constants.Gamma(v.magnitude) * mass * v.z};
var result = V.DenseOfArray(tmp);
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment