Hi there
I’m currently working on a simple alignment script that is pretty similar to PerspectiveMatch
for when we have a photogrammetry model of a site and a satellite photo. What I’d like to do is to set a x amount of vectors between points on the Photogrammetry mesh and between the Satellite photo and then calculate the average of all the vectors and to move the mesh accordingly, this would allow for a slightly better alignment than by doing it by eye as we currently do.
I’ve run into two issues within this.
- How do I create an average vector from a list of vectors?
- How do I make it possible for the user to set x amount of vectors, preferably live, like in
PerspectiveMatch
Here’s where I’m at currently:
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
import math
drone = rs.GetObject("Select Mesh")
num = 3
vecPairs = []
for x in range(num):
line = rs.GetLine(1,message1 = "Select Point on Mesh", message3 = "select Point on SAT")
vecDir = line[1] - line[0]
vecPairs.append(vecDir)
trans = sum(vecPairs) / ln(vecPairs)
rs.MoveObject(drone, trans)
1 post - 1 participant