# Inaccurate principal curvature near peaks

**URL:** https://discourse.vtk.org/t/inaccurate-principal-curvature-near-peaks/5603
**Category:** Support
**Created:** [April 21, 2021, 4:30pm UTC](https://discourse.vtk.org/t/inaccurate-principal-curvature-near-peaks/5603 "2021-04-21T16:30:37Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![cbhushan](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d9b06d/32.png) [@cbhushan](https://discourse.vtk.org/u/cbhushan)
#### Post date: [April 21, 2021, 6:42pm UTC](https://discourse.vtk.org/t/inaccurate-principal-curvature-near-peaks/5603/10 "2021-04-21T18:42:09Z")

</div>

> [@Yohann\_Bearzi](#):
>
> How do you treat the case H^2 - K \< 0 with your numpy script? Because there is a square root involved. VTK catches a H^2 - K \< 0 at the locations of the discontinuity points you have on your data.

I am setting those points to zero. Code snippet below. I do not think those points belong to the case of H^2 - K \< 0

```auto
    AA = np.square(curvature_np['Mean_Curvature']) - curvature_np['Gauss_Curvature']
    if not np.alltrue(AA>=0):
        logging.warning(f'{np.count_nonzero(AA<0)} values below-sqrt is not non-negative!')
    BB = np.sqrt(AA)
    BB[AA<0] = 0
    curvature_np['Max_Curv_NP'] = curvature_np['Mean_Curvature'] + BB
    curvature_np['Min_Curv_NP'] = curvature_np['Mean_Curvature'] - BB

```

---

_[View the full topic](https://discourse.vtk.org/t/inaccurate-principal-curvature-near-peaks/5603)._
