I have a triangle in 3d and a line, they are lie in one plane. How can I map 5 points from 3d to 2d?
I can convert triangle to 2d, but can't do the same with line.
Vector2[] ConvertTo2d(Vector3 a, Vector3 b, Vector3 c)
{
var aN = new Vector2(0, 0);
var bN = new Vector2(0, 0);
bN.x = Mathf.Sqrt(Mathf.Pow(b.x - a.x, 2f) + Mathf.Pow(b.y - a.y, 2f) + Mathf.Pow(b.z - a.z, 2f));
var cN = new Vector2(0, 0);
cN.x = ((b.x - a.x) * (c.x - a.x) +
(b.y - a.y) * (c.y - a.y) +
(b.z - a.z) * (c.z - a.z)) / bN.x;
cN.y = Mathf.Sqrt(Mathf.Pow(c.x - a.x, 2f) + Mathf.Pow(c.y - a.y, 2f) + Mathf.Pow(c.z - a.z, 2f) - Mathf.Pow(cN.x, 2f));
return new[] {aN, bN, cN};
}