first good build. Part, PartFrame, Matrix
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include "Constraint.h"
|
||||
namespace MbD {
|
||||
class AbsConstraint :
|
||||
public Constraint
|
||||
class AbsConstraint : public Constraint
|
||||
{
|
||||
//axis iqXminusOnePlusAxis
|
||||
int axis;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "Item.h"
|
||||
|
||||
namespace MbD {
|
||||
class CartesianFrame :
|
||||
public Item
|
||||
class CartesianFrame : public Item
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/CylindricalJoint.cpp
Normal file
1
MbDCode/CylindricalJoint.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "CylindricalJoint.h"
|
||||
9
MbDCode/CylindricalJoint.h
Normal file
9
MbDCode/CylindricalJoint.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
|
||||
namespace MbD {
|
||||
class CylindricalJoint : public Joint
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MbD {
|
||||
void setMarkerFrame(MarkerFrame* markerFrm);
|
||||
|
||||
MarkerFrame* markerFrame;
|
||||
FullColumn<double>* rOeO = new FullColumn<double>(3);
|
||||
FullColDptr rOeO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOe = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ namespace MbD {
|
||||
public:
|
||||
EndFrameqc();
|
||||
FullMatDptr prOeOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullMatrix<FullColumn<double>>* pprOeOpEpE = new FullMatrix<FullColumn<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOepE = new FullColumn<FullMatrix<double>>(4);
|
||||
FullMatrix<FullMatrix<double>>* ppAOepEpE = new FullMatrix<FullMatrix<double>>(4, 4);
|
||||
//std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> pprOeOpEpE = std::make_shared<FullMatrix<std::shared_ptr<FullColumn<double>>>>(3, 4);
|
||||
std::shared_ptr<FullColumn<std::shared_ptr<FullMatrix<double>>>> pAOepE = std::make_shared<FullColumn<std::shared_ptr<FullMatrix<double>>>>(4);
|
||||
//std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> ppAOepEpE = std::make_shared<FullMatrix<std::shared_ptr<FullMatrix<double>>>>(4, 4);
|
||||
//FullMatrix<FullColumn<double>>* pprOeOpEpE1 = new FullMatrix<FullColumn<double>>(3, 4);
|
||||
//FullColumn<FullMatrix<double>>* pAOepE1 = new FullColumn<FullMatrix<double>>(4);
|
||||
//FullMatrix<FullMatrix<double>>* ppAOepEpE1 = new FullMatrix<FullMatrix<double>>(4, 4);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include "EndFrameqc.h"
|
||||
namespace MbD {
|
||||
class EndFrameqct :
|
||||
public EndFrameqc
|
||||
class EndFrameqct : public EndFrameqc
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,14 +3,3 @@
|
||||
#include "FullColumn.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
std::string FullColumn<double>::toString() {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "FullColumn { ";
|
||||
for (int i = 0; i < this->size() - 1; i++) {
|
||||
ss << this->at(i) << ", ";
|
||||
}
|
||||
ss << this->back() << " }";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "Vector.h"
|
||||
#include "FullMatrix.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class FullColumn : public Vector<T>
|
||||
{
|
||||
public:
|
||||
FullColumn(int i) : Vector<T>(i) {}
|
||||
FullColumn(std::initializer_list<T> list) : Vector<T>{ list } {}
|
||||
std::string toString();
|
||||
};
|
||||
template <typename T>
|
||||
class FullColumn : public Vector<T>
|
||||
{
|
||||
public:
|
||||
FullColumn(int i) : Vector<T>(i) {}
|
||||
FullColumn(std::initializer_list<T> list) : Vector<T>{ list } {}
|
||||
std::string toString()
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "FullColumn { ";
|
||||
for (int i = 0; i < this->size() - 1; i++) {
|
||||
ss << this->at(i) << ", ";
|
||||
}
|
||||
ss << this->back() << " }";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<FullColumn<double>> FullColDptr;
|
||||
//typedef std::shared_ptr<FullColumn<std::shared_ptr<FullMatrix<double>>>> FullColFMptr;
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullColumn<double>> FullColDptr;
|
||||
|
||||
@@ -2,10 +2,3 @@
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
FullMatrix<double>::FullMatrix(int m, int n) {
|
||||
for (int i = 0; i < m; i++) {
|
||||
auto row = std::make_shared<FullRow<double>>(n);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
MbDCode/FullMatrix.cpp.bak
Normal file
5
MbDCode/FullMatrix.cpp.bak
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "FullMatrix.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "RowTypeMatrix.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class FullMatrix : public RowTypeMatrix<std::shared_ptr<FullRow<T>>>
|
||||
{
|
||||
public:
|
||||
FullMatrix() {
|
||||
// constructor code here
|
||||
}
|
||||
FullMatrix(int m, int n);
|
||||
//FullMatrix(std::initializer_list<T> list) : RowTypeMatrix<FullRow<T>>{ list } {}
|
||||
};
|
||||
//class FullColumn<double>;
|
||||
|
||||
template <typename T>
|
||||
class FullMatrix : public RowTypeMatrix<std::shared_ptr<FullRow<T>>>
|
||||
{
|
||||
public:
|
||||
FullMatrix() {}
|
||||
FullMatrix(int m, int n) {
|
||||
for (int i = 0; i < m; i++) {
|
||||
auto row = std::make_shared<FullRow<T>>(n);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
FullMatrix(std::initializer_list<std::initializer_list<T>> list2D) {
|
||||
for (auto rowList : list2D)
|
||||
{
|
||||
auto row = std::make_shared<FullRow<T>>(rowList);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::initializer_list<std::initializer_list<double>> ListListD;
|
||||
typedef std::shared_ptr<FullMatrix<double>> FullMatDptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FullMatFCptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> FullMatFMptr;
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullMatrix<double>> FullMatDptr;
|
||||
|
||||
29
MbDCode/FullMatrix.h.bak
Normal file
29
MbDCode/FullMatrix.h.bak
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "RowTypeMatrix.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
//class FullColumn<double>;
|
||||
|
||||
template <typename T>
|
||||
class FullMatrix : public RowTypeMatrix<std::shared_ptr<FullRow<T>>>
|
||||
{
|
||||
public:
|
||||
FullMatrix() {}
|
||||
FullMatrix(int m, int n) {
|
||||
for (int i = 0; i < m; i++) {
|
||||
auto row = std::make_shared<FullRow<T>>(n);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
FullMatrix(std::initializer_list<std::initializer_list<T>> list) : RowTypeMatrix<FullRow<T>>{ list } {}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<FullMatrix<double>> FullMatDptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FullMatFCptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> FullMatFMptr;
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
#include "Joint.h"
|
||||
|
||||
MbD::Joint::Joint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Item.h"
|
||||
#include "EndFramec.h"
|
||||
#include "Constraint.h"
|
||||
|
||||
namespace MbD {
|
||||
class Joint :
|
||||
public Item
|
||||
class EndFramec;
|
||||
class Constraint;
|
||||
|
||||
class Joint : public Item
|
||||
{
|
||||
//frmI frmJ constraints friction
|
||||
public:
|
||||
Joint();
|
||||
std::shared_ptr<EndFramec> frmI;
|
||||
std::shared_ptr<EndFramec> frmJ;
|
||||
std::vector<std::shared_ptr<Constraint>> constraints;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "MarkerFrame.h"
|
||||
#include "EndFramec.h"
|
||||
#include "EndFrameqc.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
@@ -25,7 +27,7 @@ void MarkerFrame::setaApm(FullMatDptr x)
|
||||
{
|
||||
aApm->copy(x);
|
||||
}
|
||||
void MarkerFrame::addEndFrame(std::shared_ptr<EndFrameqc> endFrm)
|
||||
void MarkerFrame::addEndFrame(std::shared_ptr<EndFramec> endFrm)
|
||||
{
|
||||
endFrm->setMarkerFrame(this);
|
||||
endFrames.push_back(endFrm);
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "PartFrame.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
#include "EndFrameqc.h"
|
||||
#include "EndFramec.h"
|
||||
|
||||
namespace MbD {
|
||||
class PartFrame;
|
||||
class EndFrameqc;
|
||||
class EndFramec;
|
||||
|
||||
class MarkerFrame : public CartesianFrame
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace MbD {
|
||||
void setPartFrame(PartFrame* partFrm);
|
||||
void setrpmp(FullColDptr x);
|
||||
void setaApm(FullMatDptr x);
|
||||
void addEndFrame(std::shared_ptr<EndFrameqc> x);
|
||||
void addEndFrame(std::shared_ptr<EndFramec> x);
|
||||
|
||||
PartFrame* partFrame;
|
||||
FullColDptr rpmp = std::make_shared<FullColumn<double>>(3);
|
||||
@@ -28,7 +28,7 @@ namespace MbD {
|
||||
FullMatDptr aAOm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullMatDptr prOmOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOmpE = new FullColumn<FullMatrix<double>>(4);
|
||||
std::vector<std::shared_ptr<EndFrameqc>> endFrames;
|
||||
std::vector<std::shared_ptr<EndFramec>> endFrames;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
#include "Part.h"
|
||||
#include "Joint.h"
|
||||
#include "CylindricalJoint.h"
|
||||
#include "RevoluteJoint.h"
|
||||
#include "ZRotation.h"
|
||||
#include "MbDCode.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -18,8 +22,7 @@ int main()
|
||||
FullColDptr rpmp;
|
||||
FullMatDptr aApm;
|
||||
FullRowDptr fullRow;
|
||||
auto elements = { 0.0, 0.0, 0.0, 1.0 };
|
||||
auto row = std::make_shared<FullRow<double>>(elements);
|
||||
auto row = std::make_shared<FullRow<double>>(ListD{ 0.0, 0.0, 0.0, 1.0 });
|
||||
fullRow = std::make_shared<FullRow<double>>(4);
|
||||
fullRow->copy(row);
|
||||
//
|
||||
@@ -27,10 +30,8 @@ int main()
|
||||
str = "Assembly1";
|
||||
assembly1->setName(str);
|
||||
std::cout << "assembly1->getName() " << assembly1->getName() << std::endl;
|
||||
elements = { 0, 0, 0 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0, 0, 0, 1 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0, 1 });
|
||||
assembly1->setqX(qX);
|
||||
assembly1->setqE(qE);
|
||||
std::cout << "assembly1->getqX() " << assembly1->getqX()->toString() << std::endl;
|
||||
@@ -40,38 +41,26 @@ int main()
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
rpmp = std::make_shared<FullColumn<double>>(elements);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>();
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 0, 1 },
|
||||
{ 0, -1, 0 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
elements = { 0.0, 0.0, 0.0 };
|
||||
rpmp = std::make_shared<FullColumn<double>>(elements);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.0 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>();
|
||||
elements = { 1.0, 0.0, 0.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
elements = { 0.0, 1.0, 0.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
elements = { 0.0, 0.0, 1.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
@@ -79,34 +68,114 @@ int main()
|
||||
auto part1 = std::make_shared<Part>();
|
||||
str = "Part1";
|
||||
part1->setName(str);
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.0, 0.0, 1.4248456266393e-10, 1.0 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 1.4248456266393e-10, 1.0 });
|
||||
part1->setqX(qX);
|
||||
part1->setqE(qE);
|
||||
TheSystem.parts.push_back(part1);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part1->partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part1->partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part2 = std::make_shared<Part>();
|
||||
str = "Part2";
|
||||
part2->setName(str);
|
||||
elements = { 0.38423366582893, 0.49215308269277, 0.048029210642807 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.0, 0.0, 0.89871701272344, 0.4385290538168 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 0.49215308269277, 0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 });
|
||||
part2->setqX(qX);
|
||||
part2->setqE(qE);
|
||||
TheSystem.parts.push_back(part2);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{1.0, 2.7755575615629e-16, 0.0},
|
||||
{-2.7755575615629e-16, 1.0, 0.0},
|
||||
{0.0, 0.0, 1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part2->partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{1.0, 2.4980018054066e-16, 2.2204460492503e-16},
|
||||
{-2.4980018054066e-16, 1.0, 4.1633363423443e-17},
|
||||
{-2.2204460492503e-16, -4.1633363423443e-17, 1.0}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part2->partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part3 = std::make_shared<Part>();
|
||||
str = "Part3";
|
||||
part3->setName(str);
|
||||
elements = { -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.70710678118655, 0.70710678118655, 0.0, 0.0 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 });
|
||||
part3->setqX(qX);
|
||||
part3->setqE(qE);
|
||||
TheSystem.parts.push_back(part3);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{9.2444637330587e-33, 1.0, 2.2204460492503e-16},
|
||||
{1.0, -9.2444637330587e-33, -1.0785207688569e-32},
|
||||
{-1.0785207688569e-32, 2.2204460492503e-16, -1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part3->partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{6.9388939039072e-18, -6.4146353042213e-50, 1.0},
|
||||
{1.0, -6.9388939039072e-18, 6.9388939039072e-18},
|
||||
{-6.9388939039072e-18, 1.0, -7.4837411882581e-50}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part3->partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto cylJoint4 = std::shared_ptr<CylindricalJoint>();
|
||||
auto revJoint3 = std::shared_ptr<RevoluteJoint>();
|
||||
auto revJoint2 = std::shared_ptr<RevoluteJoint>();
|
||||
auto revJoint1 = std::shared_ptr<RevoluteJoint>();
|
||||
auto rotMotion1 = std::shared_ptr<ZRotation>();
|
||||
}
|
||||
@@ -131,6 +131,7 @@
|
||||
<ClCompile Include="Array.cpp" />
|
||||
<ClCompile Include="CartesianFrame.cpp" />
|
||||
<ClCompile Include="Constraint.cpp" />
|
||||
<ClCompile Include="CylindricalJoint.cpp" />
|
||||
<ClCompile Include="DiagonalMatrix.cpp" />
|
||||
<ClCompile Include="EndFramec.cpp" />
|
||||
<ClCompile Include="EndFrameqc.cpp" />
|
||||
@@ -146,17 +147,25 @@
|
||||
<ClCompile Include="NewtonRaphson.cpp" />
|
||||
<ClCompile Include="Part.cpp" />
|
||||
<ClCompile Include="PartFrame.cpp" />
|
||||
<ClCompile Include="PrescribedMotion.cpp" />
|
||||
<ClCompile Include="RevoluteJoint.cpp" />
|
||||
<ClCompile Include="RowTypeMatrix.cpp" />
|
||||
<ClCompile Include="Solver.cpp" />
|
||||
<ClCompile Include="SparseColumn.cpp" />
|
||||
<ClCompile Include="SparseMatrix.cpp" />
|
||||
<ClCompile Include="SparseRow.cpp" />
|
||||
<ClCompile Include="SparseVector.cpp" />
|
||||
<ClCompile Include="System.cpp" />
|
||||
<ClCompile Include="SystemSolver.cpp" />
|
||||
<ClCompile Include="Vector.cpp" />
|
||||
<ClCompile Include="ZRotation.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AbsConstraint.h" />
|
||||
<ClInclude Include="Array.h" />
|
||||
<ClInclude Include="CartesianFrame.h" />
|
||||
<ClInclude Include="Constraint.h" />
|
||||
<ClInclude Include="CylindricalJoint.h" />
|
||||
<ClInclude Include="DiagonalMatrix.h" />
|
||||
<ClInclude Include="EndFramec.h" />
|
||||
<ClInclude Include="EndFrameqc.h" />
|
||||
@@ -172,11 +181,18 @@
|
||||
<ClInclude Include="NewtonRaphson.h" />
|
||||
<ClInclude Include="Part.h" />
|
||||
<ClInclude Include="PartFrame.h" />
|
||||
<ClInclude Include="PrescribedMotion.h" />
|
||||
<ClInclude Include="RevoluteJoint.h" />
|
||||
<ClInclude Include="RowTypeMatrix.h" />
|
||||
<ClInclude Include="Solver.h" />
|
||||
<ClInclude Include="SparseColumn.h" />
|
||||
<ClInclude Include="SparseMatrix.h" />
|
||||
<ClInclude Include="SparseRow.h" />
|
||||
<ClInclude Include="SparseVector.h" />
|
||||
<ClInclude Include="System.h" />
|
||||
<ClInclude Include="SystemSolver.h" />
|
||||
<ClInclude Include="Vector.h" />
|
||||
<ClInclude Include="ZRotation.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -84,6 +84,33 @@
|
||||
<ClCompile Include="EndFrameqct.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Vector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SparseColumn.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SparseMatrix.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SparseRow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SparseVector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RevoluteJoint.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CylindricalJoint.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PrescribedMotion.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ZRotation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Array.h">
|
||||
@@ -155,5 +182,32 @@
|
||||
<ClInclude Include="MbDCode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Vector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SparseColumn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SparseMatrix.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SparseRow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SparseVector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RevoluteJoint.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CylindricalJoint.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PrescribedMotion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZRotation.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include "Solver.h"
|
||||
namespace MbD {
|
||||
class NewtonRaphson :
|
||||
public Solver
|
||||
class NewtonRaphson : public Solver
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/PrescribedMotion.cpp
Normal file
1
MbDCode/PrescribedMotion.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "PrescribedMotion.h"
|
||||
9
MbDCode/PrescribedMotion.h
Normal file
9
MbDCode/PrescribedMotion.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
|
||||
namespace MbD {
|
||||
class PrescribedMotion : public Joint
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/RevoluteJoint.cpp
Normal file
1
MbDCode/RevoluteJoint.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "RevoluteJoint.h"
|
||||
8
MbDCode/RevoluteJoint.h
Normal file
8
MbDCode/RevoluteJoint.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
namespace MbD {
|
||||
class RevoluteJoint : public Joint
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/SparseColumn.cpp
Normal file
1
MbDCode/SparseColumn.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "SparseColumn.h"
|
||||
14
MbDCode/SparseColumn.h
Normal file
14
MbDCode/SparseColumn.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "SparseVector.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class SparseColumn : public SparseVector<T>
|
||||
{
|
||||
public:
|
||||
SparseColumn() {}
|
||||
SparseColumn(std::initializer_list<std::pair<const int, T>> list) : SparseVector<T>{ list } {}
|
||||
SparseColumn(std::initializer_list<std::initializer_list<T>> list) : SparseVector<T>{ list } {}
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/SparseMatrix.cpp
Normal file
1
MbDCode/SparseMatrix.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "SparseMatrix.h"
|
||||
22
MbDCode/SparseMatrix.h
Normal file
22
MbDCode/SparseMatrix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "RowTypeMatrix.h"
|
||||
#include "SparseRow.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class SparseMatrix : public RowTypeMatrix<std::shared_ptr<SparseRow<T>>>
|
||||
{
|
||||
public:
|
||||
SparseMatrix(std::initializer_list<std::initializer_list<std::initializer_list<double>>> list2D) {
|
||||
for (auto rowList : list2D)
|
||||
{
|
||||
auto row = std::make_shared<SparseRow<T>>(rowList);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::SparseMatrix<double>> SpMatDptr;
|
||||
typedef std::initializer_list<std::initializer_list<std::initializer_list<double>>> ListListPairD;
|
||||
|
||||
1
MbDCode/SparseRow.cpp
Normal file
1
MbDCode/SparseRow.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "SparseRow.h"
|
||||
18
MbDCode/SparseRow.h
Normal file
18
MbDCode/SparseRow.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
|
||||
#include "SparseVector.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class SparseRow : public SparseVector<T>
|
||||
{
|
||||
public:
|
||||
SparseRow() {}
|
||||
SparseRow(std::initializer_list<std::pair<const int, T>> list) : SparseVector<T>{ list } {}
|
||||
SparseRow(std::initializer_list<std::initializer_list<T>> list) : SparseVector<T>{ list } {}
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::SparseRow<double>> SpRowDptr;
|
||||
1
MbDCode/SparseVector.cpp
Normal file
1
MbDCode/SparseVector.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "SparseVector.h"
|
||||
27
MbDCode/SparseVector.h
Normal file
27
MbDCode/SparseVector.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class SparseVector : public std::map<int, T>
|
||||
{
|
||||
public:
|
||||
SparseVector() {}
|
||||
SparseVector(std::initializer_list<std::pair<const int, T>> list) : std::map<int, T>{ list } {}
|
||||
SparseVector(std::initializer_list<std::initializer_list<T>> list) {
|
||||
for (auto pair : list) {
|
||||
int i = 0;
|
||||
int index;
|
||||
T value;
|
||||
for (auto element : pair) {
|
||||
if (i == 0) index = (int)std::round(element); ;
|
||||
if (i == 1) value = element;
|
||||
i++;
|
||||
}
|
||||
this->insert(std::pair<const int, double>(index, value));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ MbD::System::System() {
|
||||
parts = std::vector<std::shared_ptr<Part>>();
|
||||
jointsMotions = std::vector<std::shared_ptr<Joint>>();
|
||||
systemSolver = std::make_shared<SystemSolver>(*this);
|
||||
//std::vector<std::shared_ptr<Part>> parts;
|
||||
//std::vector<std::shared_ptr<Joint>> jointsMotions;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
namespace MbD {
|
||||
class Part;
|
||||
class Joint;
|
||||
class SystemSolver;
|
||||
|
||||
class System : public Item
|
||||
{
|
||||
//ToDo: Needed members admSystem namedItems mbdTime parts jointsMotions forcesTorques sensors variables hasChanged mbdSystemSolver
|
||||
|
||||
@@ -6,8 +6,10 @@ namespace MbD {
|
||||
class Vector : public Array<T>
|
||||
{
|
||||
public:
|
||||
Vector() {}
|
||||
Vector(int i) : Array<T>(i) {}
|
||||
Vector(std::initializer_list<T> list) : Array<T>{ list } {}
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::initializer_list<double> ListD;
|
||||
|
||||
14
MbDCode/Vector.h.bak
Normal file
14
MbDCode/Vector.h.bak
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "Array.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class Vector : public Array<T>
|
||||
{
|
||||
public:
|
||||
Vector() {}
|
||||
Vector(int i) : Array<T>(i) {}
|
||||
Vector(std::initializer_list<T> list) : Array<T>{ list } {}
|
||||
};
|
||||
}
|
||||
|
||||
1
MbDCode/ZRotation.cpp
Normal file
1
MbDCode/ZRotation.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "ZRotation.h"
|
||||
9
MbDCode/ZRotation.h
Normal file
9
MbDCode/ZRotation.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "PrescribedMotion.h"
|
||||
|
||||
namespace MbD {
|
||||
class ZRotation : public PrescribedMotion
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user