-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for SimplexSpline.__call__ using both cartesian and
barycentric coordinates. Made a modification to __call__ in order to support evaluation at single points.
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
|
||
from SSplines import barycentric_coordinates | ||
|
||
|
||
def test_barycentric_coordinates(): | ||
triangle = np.array([ | ||
[0, 0], | ||
[1, 0], | ||
[0, 1] | ||
]) | ||
x = np.array([0.5, 0.5]) | ||
|
||
b_numerical = barycentric_coordinates(triangle, x, exact=False) | ||
b_exact = barycentric_coordinates(triangle, x, exact=True) | ||
|
||
for num, exac in zip(b_numerical, b_exact): | ||
np.testing.assert_almost_equal(num, exac) |