From 9164c685244490770dc95bed1fae589e48b46bb9 Mon Sep 17 00:00:00 2001 From: Bastian Rieck Date: Sat, 19 Feb 2011 20:11:51 +0100 Subject: [PATCH] Fixed `vertex::calc_rms_curvature()` If the result of the curvature calculation is less than zero, a curvature value of zero is returned. --- vertex.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vertex.cpp b/vertex.cpp index ffd935f..af331d4 100644 --- a/vertex.cpp +++ b/vertex.cpp @@ -741,7 +741,11 @@ double vertex::calc_rms_curvature() const double H = this->calc_mean_curvature(); double K = this->calc_gaussian_curvature(); - return(sqrt(4*H*H-2*K)); + double squared_curvature = 4*H*H-2*K; + if(squared_curvature < 0) + return(0.0); + else + return(sqrt(squared_curvature)); }