Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplification of sphere calculation and connection added to hyperbolic #5

Merged
merged 2 commits into from Feb 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions bspline/geometry/hyperbolic.py
Expand Up @@ -40,6 +40,12 @@ def dexpinv(self, P1, V1, W2):
return (W2+s*P1)/sinhc(arg)+s*self.g(arg)*V1

@classmethod
def connection(self, P, V):
cross = V.reshape(-1,1)*P
A = cross -cross.T
A[:,1:]=-A[:,1:]
return A

def random_direction(self, size):
pp = np.random.randn(size)
p = np.insert(pp, 0, np.sqrt(1+np.linalg.norm(pp)**2))
Expand Down
2 changes: 1 addition & 1 deletion bspline/geometry/sphere.py
Expand Up @@ -105,4 +105,4 @@ def Adexpinv(self, P1, V1, W2):
angle = np.linalg.norm(V1)
vw = np.inner(V1, W2)
pw = np.inner(P1, W2)
return W2 + P1*((np.cos(angle)-1)*pw+sinc(angle)*vw) + V1*(self.h(angle)* vw-sinc(angle)*pw)
return W2 -P1*pw + V1*(self.h(angle)* vw-sinc(angle)*pw)
4 changes: 2 additions & 2 deletions tests/test_interpolator.py
Expand Up @@ -75,8 +75,8 @@ def test_control_points(interpolator, cls):
pytest.xfail("Exponential algorithm for Grassmannian not implemented")
if isinstance(geo, geometry.Projective) and cls != Riemann:
pytest.xfail("Only Riemann for projective geometry so far")
if isinstance(geo, geometry.Hyperbolic) and cls != Riemann:
pytest.xfail("Only Riemann for hyperbolic geometry so far")
if isinstance(geo, geometry.Hyperbolic) and cls == Symmetric:
pytest.xfail("Symmetric for hyperbolic geometry not implemented")
spline = cls(interpolator['points'], make_boundaries(*interpolator['boundary']), geometry=interpolator['geometry']).compute_spline()
expected = interpolator['Rspline'].control_points
npt.assert_almost_equal(spline.control_points, expected)
Expand Down