Hi guys,
-
I have 4 points(p0, p1, p2, p3) in the same plane; I know the coordinates all of these.
-
Then the plane is translated and rotated,(not scaled); I know the new coordinates of p0, p1, p2; I don’t know the coordinate of p3.
-
How can I calculate the new coordinate of p3?
-
What I current do, but not working:
4.1 Init status:Vector3 initP0;
Vector3 initNormal;
Vector3 initP3;
void beforeTransform(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
{
    initP0 = p0;
    initNormal = Vector3.Cross(p1-p0, p2-p0);
    initP3 = p3;
}
4.2 The plane is translated and rotated,(not scaled)
Vector3 afterTransform(Vector3 p0, Vector3 p1, Vector3 p2)
{
    Vector3 new_normal = Vector3.Cross(p1-p0, p2-p0);
    Vector3 translation = p0-initP0;
    Quaternion rotation = Quaternion.FromToRotation(normal, initNormal);
    Matrix4x4 matrix4x4 = Matrix4x4.TRS(translation, rotation, Vector3.one);
    return matrix4x4.MultiplyPoint3x4(initP3);
}
Thanks in advance.