-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Explicit imports added. Folder reorganization.
- Loading branch information
Estefania Barreto-Ojeda
authored
Jul 6, 2021
1 parent
687d869
commit 3e87eec
Showing
5 changed files
with
61 additions
and
56 deletions.
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
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,54 @@ | ||
import numpy as np | ||
|
||
|
||
def gaussian_curvature(Z): | ||
""" | ||
Calculate gaussian curvature from Z cloud points. | ||
Parameters | ||
---------- | ||
Z : Numpy array, cloud of points. | ||
Returns | ||
------- | ||
K : 2d-array | ||
Returns 2-dimensional array object with values of mean curvature. | ||
""" | ||
|
||
Zy, Zx = np.gradient(Z) | ||
Zxy, Zxx = np.gradient(Zx) | ||
Zyy, _ = np.gradient(Zy) | ||
|
||
K = (Zxx * Zyy - (Zxy ** 2)) / (1 + (Zx ** 2) + (Zy ** 2)) ** 2 | ||
|
||
return K | ||
|
||
|
||
def mean_curvature(Z): | ||
""" | ||
Calculates mean curvature from Z cloud points. | ||
Parameters | ||
---------- | ||
Z : Numpy array, cloud of points. | ||
Returns | ||
------- | ||
H : 2d-array | ||
Returns 2-dimensional array object with values of gaussian curvature. | ||
""" | ||
|
||
Zy, Zx = np.gradient(Z) | ||
Zxy, Zxx = np.gradient(Zx) | ||
Zyy, _ = np.gradient(Zy) | ||
|
||
H = (Zx**2 + 1) * Zyy - 2 * Zx * Zy * Zxy + (Zy**2 + 1) * Zxx | ||
H = -H / (2 * (Zx**2 + Zy**2 + 1)**(1.5)) | ||
|
||
return H |
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