Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Matching two Meshes

See original GitHub issue

Previously and upon you assist me in this: https://github.com/marcomusy/vtkplotter/issues/83#issuecomment-574625775 now what I have to ask, if I have two meshes, and I need to make matching between them, we already have interest points, and from these points, and after applying few strategies, I got matching between meshes, So now, instead of having: `a = [1,4,7,2,9,10,50,33,25]` I got a new array having for example: `b = [1,50,33,25]` and this the common points between the two meshes My question would it be possible to show the two meshes, showing the main interest points, as well make lines that refer to matching depending on b like the image obtained by someone, and the color of the line will be later, depending on whether this match is correct or not. Would it be possible to do this using this library, please?

### Issue Analytics

• State:
• Created 4 years ago

1reaction
marcomusycommented, Oct 9, 2020
1. Then you don’t need a scalarbar. Try
``````from vedo import *
import numpy as np

mesh2 = mesh1.clone().x(3).c('v')

pts1, pts2 = mesh1.points(), mesh2.points()

good_matches = [  0,100,200]

good_lns = Lines(pts1[good_matches], pts2[good_matches], lw=3, c='g')
``````

1. possible solution:
``````########################## find index from coordinate
#print(pts1[good_matches])
pp = [[ 1.03942804e-01,  1.83283873e-02, -9.15606380e-01],
[ 0, -3.48307818e-01, -9.15e-01],
[-6.23666346e-01, -1.09974377e-01, -9.41993356e-01]]

def find_index(array, p):
array = np.asarray(array)
if not utils.isSequence(p): p = [p]
idxs = [np.sum((array-q)**2, axis=1).argmin() for q in p]
return idxs

print(find_index(pts1, pp))
``````
1reaction
marcomusycommented, Jun 3, 2020

You are shifting the second mesh inside the `show()`, that deosn’t make much sense to me… check out my version of your example:

``````from vtkplotter import *

pts1, pts2 = mesh1.points(), mesh2.points()

matches1 = [  0,100,200]
matches2 = [300,400,500]

lns = Lines(pts1[matches1], pts2[matches2], lw=4)
scal = mag(pts1[matches1] - pts2[matches2])
rpts1 = Points(pts1[matches1], r=10, c='white')
rpts2 = Points(pts2[matches2], r=10, c='blue')

show(mesh1, mesh2, lns, rpts1, rpts2, axes=1)
screenshot('a.png')
``````

• if you have lines to indicate wrong matches you can use a different `Line()` object with a fixed color.
• you can save the image with `screenshot()`

#### Top Results From Across the Web

Matching identical objects in two models
You can do this: set the origins of these identical objects to geometry -> In object mode choose the first object in the...
To Compare Two Meshes | Netfabb 2018
From the main menu, choose Analyze > Compare two meshes. In the appearing dialog, select another part from the Comparison drop-down menu.
Compare two meshes for difference in values - MathWorks
I have two 'mesh grids' with assigned values in mx4 and nx4 arrays. I would like to compare the result values, column 4,...
Comparing 2 meshes created with different techniques
I am trying to compare several .stl I've created with photogrammetry and structured light scanners, and I would like to see if CC...
compare two 3Dmesh - algorithm - Stack Overflow
I thinked about this problem and I formulated this algorithm: To compare 2 mesh O1 and O2. move both centre to origin, now...

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free