Changes to FEM constraint visuals for float->double move

This commit is contained in:
jrheinlaender 2013-03-25 15:32:05 +04:30
parent bcdc353375
commit 39b2b731f8
9 changed files with 42 additions and 42 deletions

View File

@ -225,7 +225,7 @@ const bool Constraint::getPoints(std::vector<Base::Vector3d> &points, std::vecto
return true;
}
const bool Constraint::getCylinder(float& radius, float& height, Base::Vector3d& base, Base::Vector3d& axis) const
const bool Constraint::getCylinder(double &radius, double &height, Base::Vector3d& base, Base::Vector3d& axis) const
{
std::vector<App::DocumentObject*> Objects = References.getValues();
std::vector<std::string> SubElements = References.getSubValues();
@ -255,7 +255,7 @@ const bool Constraint::getCylinder(float& radius, float& height, Base::Vector3d&
}
Base::Vector3d Constraint::getBasePoint(const Base::Vector3d& base, const Base::Vector3d& axis,
const App::PropertyLinkSub& location, const float& dist)
const App::PropertyLinkSub& location, const double& dist)
{
// Get the point specified by Location and Distance
App::DocumentObject* objLoc = location.getValue();

View File

@ -60,9 +60,9 @@ protected:
protected:
/// Calculate the points where symbols should be drawn
const bool getPoints(std::vector<Base::Vector3d>& points, std::vector<Base::Vector3d>& normals) const;
const bool getCylinder(float& radius, float& height, Base::Vector3d& base, Base::Vector3d& axis) const;
const bool getCylinder(double& radius, double& height, Base::Vector3d& base, Base::Vector3d& axis) const;
Base::Vector3d getBasePoint(const Base::Vector3d& base, const Base::Vector3d& axis,
const App::PropertyLinkSub &location, const float& dist);
const App::PropertyLinkSub &location, const double& dist);
const Base::Vector3d getDirection(const App::PropertyLinkSub &direction);
};

View File

@ -70,7 +70,7 @@ void ConstraintBearing::onChanged(const App::Property* prop)
if (prop == &References) {
// Find data of cylinder
float radius, height;
double radius, height;
Base::Vector3d base, axis;
if (!getCylinder(radius, height, base, axis))
return;
@ -106,7 +106,7 @@ void ConstraintBearing::onChanged(const App::Property* prop)
}
}
float radius, height;
double radius, height;
Base::Vector3d base, axis;
if (!getCylinder(radius, height, base, axis))
return;

View File

@ -225,7 +225,7 @@ void TaskFemConstraintBearing::onSelectionChanged(const Gui::SelectionChanges& m
void TaskFemConstraintBearing::onDistanceChanged(double l)
{
Fem::ConstraintBearing* pcConstraint = static_cast<Fem::ConstraintBearing*>(ConstraintView->getObject());
pcConstraint->Dist.setValue((float)l);
pcConstraint->Dist.setValue(l);
}
void TaskFemConstraintBearing::onReferenceDeleted() {

View File

@ -232,7 +232,7 @@ void TaskFemConstraintForce::onSelectionChanged(const Gui::SelectionChanges& msg
void TaskFemConstraintForce::onForceChanged(double f)
{
Fem::ConstraintForce* pcConstraint = static_cast<Fem::ConstraintForce*>(ConstraintView->getObject());
pcConstraint->Force.setValue((float)f);
pcConstraint->Force.setValue(f);
}
void TaskFemConstraintForce::onReferenceDeleted() {

View File

@ -177,19 +177,19 @@ void TaskFemConstraintGear::onSelectionChanged(const Gui::SelectionChanges& msg)
void TaskFemConstraintGear::onDiameterChanged(double l)
{
Fem::ConstraintGear* pcConstraint = static_cast<Fem::ConstraintGear*>(ConstraintView->getObject());
pcConstraint->Diameter.setValue((float)l);
pcConstraint->Diameter.setValue(l);
}
void TaskFemConstraintGear::onForceChanged(double f)
{
Fem::ConstraintGear* pcConstraint = static_cast<Fem::ConstraintGear*>(ConstraintView->getObject());
pcConstraint->Force.setValue((float)f);
pcConstraint->Force.setValue(f);
}
void TaskFemConstraintGear::onForceAngleChanged(double a)
{
Fem::ConstraintGear* pcConstraint = static_cast<Fem::ConstraintGear*>(ConstraintView->getObject());
pcConstraint->ForceAngle.setValue((float)a);
pcConstraint->ForceAngle.setValue(a);
}
void TaskFemConstraintGear::onButtonDirection(const bool pressed) {

View File

@ -109,19 +109,19 @@ TaskFemConstraintPulley::TaskFemConstraintPulley(ViewProviderFemConstraintPulley
void TaskFemConstraintPulley::onOtherDiameterChanged(double l)
{
Fem::ConstraintPulley* pcConstraint = static_cast<Fem::ConstraintPulley*>(ConstraintView->getObject());
pcConstraint->OtherDiameter.setValue((float)l);
pcConstraint->OtherDiameter.setValue(l);
}
void TaskFemConstraintPulley::onCenterDistanceChanged(double l)
{
Fem::ConstraintPulley* pcConstraint = static_cast<Fem::ConstraintPulley*>(ConstraintView->getObject());
pcConstraint->CenterDistance.setValue((float)l);
pcConstraint->CenterDistance.setValue(l);
}
void TaskFemConstraintPulley::onTensionForceChanged(double force)
{
Fem::ConstraintPulley* pcConstraint = static_cast<Fem::ConstraintPulley*>(ConstraintView->getObject());
pcConstraint->TensionForce.setValue((float)force);
pcConstraint->TensionForce.setValue(force);
}
void TaskFemConstraintPulley::onCheckIsDriven(const bool pressed)

View File

@ -119,11 +119,11 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3d(0,1,0);
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
float angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
SbVec3f b(base.x, base.y, base.z);
SbVec3f ax(axis.x, axis.y, axis.z);
@ -142,11 +142,11 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3d(0,1,0);
float dia = pcConstraint->Diameter.getValue();
float radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
float angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
SbVec3f ax(axis.x, axis.y, axis.z);
SbVec3f dir(direction.x, direction.y, direction.z);
@ -165,8 +165,8 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3d(0,1,0);
float dia = pcConstraint->Diameter.getValue();
float angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double dia = pcConstraint->Diameter.getValue();
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
SbVec3f ax(axis.x, axis.y, axis.z);
SbVec3f dir(direction.x, direction.y, direction.z);

View File

@ -116,15 +116,15 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
// This should always point outside of the cylinder
Base::Vector3d base = pcConstraint->BasePoint.getValue();
Base::Vector3d axis = pcConstraint->Axis.getValue();
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
float forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
float beltAngle = pcConstraint->BeltAngle.getValue();
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double beltAngle = pcConstraint->BeltAngle.getValue();
double rat1 = 0.8, rat2 = 0.2;
float f1 = pcConstraint->BeltForce1.getValue();
float f2 = pcConstraint->BeltForce2.getValue();
double f1 = pcConstraint->BeltForce1.getValue();
double f2 = pcConstraint->BeltForce2.getValue();
if (f1+f2 > Precision::Confusion()) {
rat1 = f1 / (f1+f2);
rat2 = f2 / (f1+f2);
@ -151,15 +151,15 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
} else if (strcmp(prop->getName(),"Diameter") == 0) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
float forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
float beltAngle = pcConstraint->BeltAngle.getValue();
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double beltAngle = pcConstraint->BeltAngle.getValue();
double rat1 = 0.8, rat2 = 0.2;
float f1 = pcConstraint->BeltForce1.getValue();
float f2 = pcConstraint->BeltForce2.getValue();
double f1 = pcConstraint->BeltForce1.getValue();
double f2 = pcConstraint->BeltForce2.getValue();
if (f1+f2 > Precision::Confusion()) {
rat1 = f1 / (f1+f2);
rat2 = f2 / (f1+f2);
@ -182,12 +182,12 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
}
} else if ((strcmp(prop->getName(), "ForceAngle") == 0) || (strcmp(prop->getName(), "BeltAngle") == 0)) {
if (pShapeSep->getNumChildren() > 0) {
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
float forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
float beltAngle = pcConstraint->BeltAngle.getValue();
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
double beltAngle = pcConstraint->BeltAngle.getValue();
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
updatePlacement(sep, 0, SbVec3f(dia/2 * sin(forceAngle+beltAngle), 0, dia/2 * cos(forceAngle+beltAngle)),
@ -198,13 +198,13 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
}
} else if ((strcmp(prop->getName(), "BeltForce1") == 0) || (strcmp(prop->getName(), "BeltForce2") == 0)) {
if (pShapeSep->getNumChildren() > 0) {
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
double radius = pcConstraint->Radius.getValue();
double dia = pcConstraint->Diameter.getValue();
if (dia < 2 * radius)
dia = 2 * radius;
double rat1 = 0.8, rat2 = 0.2;
float f1 = pcConstraint->BeltForce1.getValue();
float f2 = pcConstraint->BeltForce2.getValue();
double f1 = pcConstraint->BeltForce1.getValue();
double f2 = pcConstraint->BeltForce2.getValue();
if (f1+f2 > Precision::Confusion()) {
rat1 = f1 / (f1+f2);
rat2 = f2 / (f1+f2);