Skip to content
Snippets Groups Projects
Commit 7b2be41d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Pyramid2 ditto

parent 31a96fed
No related branches found
No related tags found
1 merge request!1187adapt to changes in libff: factory functions moved to ff/Make
......@@ -49,23 +49,21 @@ std::string Pyramid2::validate() const
if (!errs.empty())
return jointError(errs);
const double cot_alpha = Math::cot(m_alpha);
double r = cot_alpha * 2 * m_height / m_length;
double s = cot_alpha * 2 * m_height / m_width;
if (r > 1)
errs.push_back("parameters violate condition 2 * ctg(alpha) <= m_height / m_length");
if (s > 1)
errs.push_back("parameters violate condition 2 * ctg(alpha) <= m_height / m_width");
const double D = m_length / 2;
const double W = m_width / 2;
const double R = m_height * Math::cot(m_alpha);
if (R > D)
errs.push_back("parameters violate condition H * ctg(alpha) <= m_length / 2");
if (R > W)
errs.push_back("parameters violate condition H * ctg(alpha) <= m_width / 2");
if (!errs.empty())
return jointError(errs);
double D = m_length / 2;
double d = m_length / 2 * (1 - r);
double W = m_width / 2;
double w = m_width / 2 * (1 - s);
// center of mass
double zcom = m_height * 0.5 * (6 - 4 * (r + s) + 3 * r * s) / (6 - 3 * (r + s) + 2 * r * s);
double zcom = m_height / 2 * (6 * W * D - 4 * (W + D) * R + 3 * R * R)
/ (6 * W * D - 3 * (W + D) * R + 2 * R * R);
const double d = D - R;
const double w = W - R;
setPolyhedron(topology, -zcom,
{// base:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment