-
Hi Marco, Cheers |
Beta Was this translation helpful? Give feedback.
Answered by
marcomusy
Jul 19, 2022
Replies: 1 comment
-
Yes :) from vedo import Grid, Points, Arrows, show
import numpy as np
np.random.seed(2)
surf = Grid([0,0,0], res=[25,25])
idxs = np.random.randint(0, surf.npoints, 10) # pick 10 indices
pts = surf.points(idxs)
ptsource, pttarget = [], []
for pt in pts:
pt1 = pt + [0, 0, np.random.randn(1)[0] * 0.1]
pt2 = surf.closest_point(pt1)
ptsource.append(pt2)
pttarget.append(pt1)
warped = surf.warp(ptsource, pttarget, mode='2d')
warped.color("b4").lc('light blue').wireframe(False).lw(1)
apts = Points(pttarget, r=15, c="r")
arrs = Arrows(ptsource, pttarget, c='k')
show(warped, apts, arrs, axes=1, viewup="z").close() Note that this is more of a "splining" than a fitting, for a fitting you must need to provide a model. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
marcomusy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes :)
You can use
warp
:Note that this is more of a "splining" than …