Hello Emanuele,
Can you please check if the following script executed in your project rotates the coordinate system in proper way:
import Metashape
MARKERS = ["point Z", "point X", "point Y"]
def get_marker(label, chunk):
for marker in chunk.markers:
if marker.label.lower() == label.lower():
return marker
return None
def cross(a, b):
result = Metashape.Vector([a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y *b.x])
return result.normalized()
chunk = Metashape.app.document.chunk
T = chunk.transform.matrix
m0 = get_marker(MARKERS[0], chunk)
m1 = get_marker(MARKERS[1], chunk)
m2 = get_marker(MARKERS[2], chunk)
horizontal = m0.position - m1.position
vertical = m0.position - m2.position
normal = cross(vertical, horizontal)
horizontal = -cross(vertical, normal)
vertical = vertical.normalized()
R = PhotoScan.Matrix ([horizontal, vertical, -normal])
chunk.transform.rotation = R
print("done")
As the preliminary step you need to put markers with the following labels to the corners of your Area B:
point Z
point X
point Y
If the resulting Z is inverted, switch the labels between point X and point Y.