My 3D modeling study showed that the following transform creation method would be really helpful:
Transform.transform(Point3D p0, Point3D p1, Point3D p2)
where all points specify new location and direction of the coordinate system after transformation. So origin moves to p0, X-axis goes in direction of vector p0p1, Y-axis is chosen so that all three points lay in the XY-plane of the new system and y-coordinate of p2 in local space is positive. Z-axis is chosen so that all axes comply to right-hand rule.