Forum

Author Topic: Offset region to forward  (Read 1347 times)

Vladimir Denisov

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Offset region to forward
« on: June 02, 2021, 11:20:15 AM »
How to offset region to forward in region local coords to x units, where x is chunk.size.x of region? (Python)

Vladimir Denisov

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: Offset region to forward
« Reply #1 on: June 02, 2021, 11:33:31 AM »
I found multiply operation in matrix)


Code: [Select]

import Metashape
chunk = Metashape.app.document.chunk
# Store position
old_pos = chunk.region.center
# Get offset by x size
x_offset = Metashape.Vector([chunk.region.size.x, 0, 0])
# Rotate offset vector
new_x_offset = Metashape.Matrix.Rotation(chunk.region.rot).mulv(x_offset)
# Make offset of reconstruction regionchunk.region.center = old_pos + new_x_offset
« Last Edit: June 03, 2021, 01:00:07 PM by Vladimir Denisov »