Skip to content

Commit

Permalink
Unify resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
KmolYuan committed Aug 11, 2020
1 parent f33a5f7 commit eb7463f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyslvs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def __gen_fitting(self) -> ndarray:
else:
path = self.path
tck = splprep((path[:, 0], path[:, 1]), per=is_close)
u = linspace(0, 1, num, endpoint=True)
path = array(splev(u, tck[0])).T
path = array(splev(linspace(0, 1, num, endpoint=True), tck[0])).T
else:
path = efd_fitting(self.path, num)
if is_close:
Expand Down
11 changes: 6 additions & 5 deletions pyslvs_ui/synthesis/dimensional_synthesis/dialogs/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
_Coord = Tuple[float, float]
_Range = Tuple[float, float, float]
_TargetPath = Dict[int, Sequence[_Coord]]
_U = 0.1


class _DynamicCanvas(AnimationCanvas):
Expand Down Expand Up @@ -304,9 +305,9 @@ def __cc_plot(self):
c2 = curvature(target[p])
p1 = path_signature(c1)
p2 = path_signature(c2, 100 - 100 / (len(target[p]) + 1))
cc = cross_correlation(p1, p2)
cc = cross_correlation(p1, p2, _U)
cc_argmax = cc.argmax()
p2[:, 0] += cc_argmax * 0.1
p2[:, 0] += cc_argmax * _U
m_p1 = p1.copy()
m_p1[:, 0] += p1.max()
p1 = concatenate((p1, m_p1), axis=0)
Expand All @@ -320,11 +321,11 @@ def __cc_plot(self):
ax[1].set_title("Path Signature")
ax[1].plot(p1[:, 0], p1[:, 1], label=f"Point{p}")
ax[1].plot(p2[:, 0], p2[:, 1], label=f"Target Path")
ax[1].plot(cc_argmax * 0.1, p2[0, 1], 'ro', label=f"Shift Origin")
ax[1].plot(cc_argmax * _U, p2[0, 1], 'ro', label=f"Shift Origin")
ax[1].legend()
ax[2].set_title(f"Cross Correlation of Point{p}")
ax[2].plot(linspace(0, len(cc) * 0.1, len(cc)), cc)
ax[2].plot(cc_argmax * 0.1, cc[cc_argmax], 'ro')
ax[2].plot(linspace(0, len(cc) * _U, len(cc)), cc)
ax[2].plot(cc_argmax * _U, cc[cc_argmax], 'ro')
dlg.set_margin(0.2)
dlg.show()
dlg.exec_()
Expand Down

0 comments on commit eb7463f

Please sign in to comment.