diff --git a/Sample/HardParticle/Pyramid4.cpp b/Sample/HardParticle/Pyramid4.cpp
index d72d91f09f6cacbc05ce74689d6cefe5da4da74e..4d087b858bec6671841f5066a98ddd78bb56185f 100644
--- a/Sample/HardParticle/Pyramid4.cpp
+++ b/Sample/HardParticle/Pyramid4.cpp
@@ -57,7 +57,7 @@ std::string Pyramid4::validate() const
     double b = a * (1 - r);
 
     // center of mass
-    double zcom = m_height * (1. / 4) * (6 - 8 * r + 3 * r * r) / (3 - 3 * r + r * r);
+    double zcom = m_height / 4 * (a * a + 2 * a * b + 3 * b * b) / (a * a + a * b + b * b);
 
     setPolyhedron(topology, -zcom,
                   {// base: