Forum

Author Topic: rotate cloud with a referance plane  (Read 2009 times)

tuffi

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
rotate cloud with a referance plane
« on: November 24, 2020, 01:32:09 PM »
Hi,
I am writing because I must perform a quite complex operation (for me) and I hope someone can help me.

I had a non-georeferenced cloud point of a rock landslaide scaled with a 2 scale bars.

I must carry out a rotation of a cloud in order to measure the right orientation of geological fault and features.

I know the DIP and the DIP Direction (that can create a plane) of a flat surface of the cloud point, so i need to impose my measures to this know surface of the cloud.

In theory I need to carry out to rotations centred on my plane.
Someone can help me?

Thank you

Emanuele

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: rotate cloud with a referance plane
« Reply #1 on: November 24, 2020, 04:40:41 PM »
Hello Emanuele,

Is it possible to place tree markers (not forming a line) on the surface that can be considered flat? If so, then via script it would be possible to apply the rotation to the chunk (keeping the scale), so that those markers would appear on the same plane, for example, XY.
Best regards,
Alexey Pasumansky,
Agisoft LLC

tuffi

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: rotate cloud with a referance plane
« Reply #2 on: November 24, 2020, 05:53:24 PM »
Hi Alexey,

my flat area is the area B on the attachment. So I think that I can place 3 markers. One for every of the 3 corners of the area.
waht do you think?

Thanks.

Emanuele

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: rotate cloud with a referance plane
« Reply #3 on: November 24, 2020, 09:51:49 PM »
Hello Emanuele,

Can you please check if the following script executed in your project rotates the coordinate system in proper way:

Code: [Select]
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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

tuffi

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: rotate cloud with a referance plane
« Reply #4 on: November 25, 2020, 11:38:49 AM »
Hi Alexey,

I tried and the script works (I changed PhotoScan with Metashape at the end in the R rotation matrix) and it works, but I think that is not ok for me.
I need to imposte my know direction in some way...


Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: rotate cloud with a referance plane
« Reply #5 on: November 25, 2020, 12:46:59 PM »
Hello Emanuele,

At the moment there are no GUI tools to set up certain orientation of the coordinate system, apart from manual Rotate Object instrument.

With some script customization it is possible to have a dialog box for selecting the pairs of markers that would define the coordinate system axis or coordinate plane, if it is applicable to your project and would be conveninet.
Best regards,
Alexey Pasumansky,
Agisoft LLC