Forum

Author Topic: Best way to move a model?  (Read 2141 times)

Yän

  • Newbie
  • *
  • Posts: 2
    • View Profile
Best way to move a model?
« on: July 04, 2018, 01:57:20 PM »
I'm new to python scripting in Agisoft Photoscan.

My goal is to move the entire model or the point cloud along with the region and all cameras using a vector 3.
The vector 3 is the negative vector 3 of the region centre.
Basically what I'm trying to do is moving everything to the coordinate origin (0,0,0).

What is the best way to move everything using the same translation vector?

Thank you for your time.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14004
    • View Profile
Re: Best way to move a model?
« Reply #1 on: July 04, 2018, 02:34:43 PM »
Hello Yän,

I think that in order to solve this you need to create the 4x4 matrix that will perform the required transformation and apply it to chunk.transform. Thus all the chunk contents will be treated simultaneously.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yän

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Best way to move a model?
« Reply #2 on: July 12, 2018, 12:50:09 AM »
Hello Alexey,

thank you for helping me out. Your tip has already helped me to move the chunk. Unfortunately I now have a different problem.
Originally I thought that the region center would be in world space. Since the region appears to be in some sort of parenting structure I found that this is not the case.
Do you have a way for me to easily get the world position of the region center? I tried just adding the chunk translation vector to the region center vector but that's not enough as the chunk seems to be rotated.
If there's a way to get the region center world position, I'd greatly appreciate a little code-example on how to get it using agisoft python scripting.

Thanks again,
Yän

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14004
    • View Profile
Re: Best way to move a model?
« Reply #3 on: July 12, 2018, 02:07:27 PM »
Hello Yän,

To get the coordinates of the region center in the world coordinates (for georeferenced chunk) you can use the following code:

Code: [Select]
chunk.crs.project(chunk.transform.matrix.mulp(chunk.region.center))
Best regards,
Alexey Pasumansky,
Agisoft LLC