From 6a63c0f1e1f9b2edc6fc30db6759f4ddcb346613 Mon Sep 17 00:00:00 2001
From: Ioan Sucan <isucan@willowgarage.com>
Date: Fri, 12 Apr 2013 15:29:30 +0300
Subject: [PATCH] fix generation of mesh from cone

---
 include/fcl/shape/geometric_shape_to_BVH_model.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/fcl/shape/geometric_shape_to_BVH_model.h b/include/fcl/shape/geometric_shape_to_BVH_model.h
index 7d542151..b02c1752 100644
--- a/include/fcl/shape/geometric_shape_to_BVH_model.h
+++ b/include/fcl/shape/geometric_shape_to_BVH_model.h
@@ -278,9 +278,11 @@ void generateBVHModel(BVHModel<BV>& model, const Cone& shape, const Transform3f&
 
   for(unsigned int i = 0; i < h_num - 1; ++i)
   {
+    double h_i = h / 2 - (i + 1) * hd;
+    double rh = r * (0.5 - h_i / h);
     for(unsigned int j = 0; j < tot; ++j)
     {
-      points.push_back(Vec3f(r * cos(phi + phid * j), r * sin(phi + phid * j), h / 2 - (i + 1) * hd));
+      points.push_back(Vec3f(rh * cos(phi + phid * j), rh * sin(phi + phid * j), h_i));
     }
   }
 
-- 
GitLab