Skip to content

Commit

Permalink
updating Forces
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZurrin committed Feb 26, 2022
1 parent 500c499 commit 9b3b3ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 22 additions & 6 deletions Forces.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,30 @@ class Forces
* @param theta2 angle side 2 in degrees
* @returns tension in Newtons
*/
static vector<long double> tensionOnMultipleStrandsHangingObject(const long double mass, const long double theta1, const long double theta2)
static vector<long double>
tensionOnMultipleStrandsHangingObject(const long double mass, const long double theta1,
const long double theta2, bool print = false)
{
vector<long double> result = { 0.0, 0.0, 0.0 };
result[0] = cos(theta1 * RADIAN) * (mass * GA);
result[1] = cos(theta2 * RADIAN) * (mass * GA);
result[2] = result[0] + result[1];
auto mg = mass * GA;
auto T1x = cos(theta1 * RADIAN);
auto T1y = sin(theta1 * RADIAN);
auto T2x = cos(theta2 * RADIAN);
auto T2y = sin(theta2 * RADIAN);
auto T2 = T1x/T2x;
auto temp = T2y*T2+T1y;
auto T1_tot = mg/temp;
auto T2_tot = T1_tot*T2;
result[0] = T1_tot;
result[1] = T2_tot;
result[2] = T1_tot + T2_tot;

if (print)
{
cout << "Tension on side 1: " << result[0] << endl;
cout << "Tension on side 2: " << result[1] << endl;
cout << "Tension on both sides: " << result[2] << endl;
}
return result;
}
/**
Expand Down Expand Up @@ -471,8 +489,6 @@ class Forces
}




Forces operator+(const Forces& other) const
{
Forces result;
Expand Down
4 changes: 2 additions & 2 deletions testFactore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ int main(int argc, char* argv[])
//_________________________________________________________________________
//add test code between starred areas
//*************************************************************************
Forces::acceleration2masses(75.0, 12.0, 63.0, 38.0, true);

//Forces::acceleration2masses(75.0, 12.0, 63.0, 38.0, true);
Forces::tensionOnMultipleStrandsHangingObject(1.02, 60.0, 30.0 , true);


//********************************************************************** ***
Expand Down

0 comments on commit 9b3b3ed

Please sign in to comment.