Page MenuHomec4science

pendulecp2.cpp
No OneTemporary

File Metadata

Created
Fri, Dec 13, 01:45

pendulecp2.cpp

#include "pendulecp2.h"
#include <cmath>
PenduleCp2::PenduleCp2(const std::vector<double>& p, const std::vector<double>& p_p, const double& l1, const double& l2, const double& m1, const double& m2, const double& g, integral_operation op)
: Oscillateur(p, p_p, op), l1(l1), l2(l2), m1(m1), m2(m2), g(g)
{}
PenduleCp2::PenduleCp2(const Vector& p, const Vector& p_p, const double& l1, const double& l2, const double& m1, const double& m2, const double& g,integral_operation op)
: Oscillateur(p, p_p, op), l1(l1), l2(l2), m1(m1), m2(m2), g(g)
{}
double PenduleCp2::getl1() const
{
return l1;
}
double PenduleCp2::getl2() const
{
return l2;
}
double PenduleCp2::getm1() const
{
return m1;
}
double PenduleCp2::getm2() const
{
return m2;
}
double PenduleCp2::getg() const
{
return g;
}
void PenduleCp2::setl1(const double& l1)
{
this->l1=l1;
}
void PenduleCp2::setl2(const double& l2)
{
this->l2=l2;
}
void PenduleCp2::setm1(const double& m1)
{
this->m1=m1;
}
void PenduleCp2::setm2(const double& m2)
{
this->m2=m2;
}
void PenduleCp2::setg(const double& g)
{
this->g=g;
}
SVector<3> PenduleCp2::cartesiennes() const
{
return { sin(p[0]) * l1, -cos(p[0]) * l1, 0 };
}
SVector<3> PenduleCp2::cartesiennes2() const
{
SVector<3> v({ sin(p[1]) * l2, -cos(p[1]) * l2, 0 });
return cartesiennes() + v;
}
Vector PenduleCp2::equation() const
{
double dteta(p[0]-p[1]);
double p1(m2*g*cos(dteta)*sin(p[1]) - (m1+m2)*g*sin(p[0]) + m2*l1*p_prime[0]*p_prime[0]*cos(dteta)*sin(dteta) - m2*l2*p_prime[1]*p_prime[1]*sin(dteta));
double p2((m1+m2)*g*cos(dteta)*sin(p[0]) - (m1+m2)*g*sin(p[1]) + m2*l2*p_prime[1]*p_prime[1]*cos(dteta)*sin(dteta) - (m1+m2)*l1*p_prime[0]*p_prime[0]*sin(dteta));
double d(m1+m2*sin(dteta)*sin(dteta));
return {p1/(d*l1) , p2/(d*l2)};
}

Event Timeline