Integrate Werners & Jans double branch

Move from float to double
Further suggestions for float -> double move
Moved Tools2D from float to double
More suggestions for float->double move from Gui subdirectory
Changes to FEM constraint visuals for float->double move
Suggested changes for float -> double move
Suggestions for Part module moving float -> double
This commit is contained in:
jriegel
2013-09-22 21:55:11 +02:00
parent 78ba09a490
commit 00ea24e07e
64 changed files with 719 additions and 589 deletions

View File

@@ -68,7 +68,7 @@ PROPERTY_SOURCE(Fem::Constraint, App::DocumentObject);
Constraint::Constraint()
{
ADD_PROPERTY_TYPE(References,(0,0),"Constraint",(App::PropertyType)(App::Prop_None),"Elements where the constraint is applied");
ADD_PROPERTY_TYPE(NormalDirection,(Base::Vector3f(0,0,1)),"Constraint",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),"Normal direction pointing outside of solid");
ADD_PROPERTY_TYPE(NormalDirection,(Base::Vector3d(0,0,1)),"Constraint",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),"Normal direction pointing outside of solid");
}
Constraint::~Constraint()
@@ -129,7 +129,7 @@ void Constraint::onDocumentRestored()
App::DocumentObject::onDocumentRestored();
}
const bool Constraint::getPoints(std::vector<Base::Vector3f> &points, std::vector<Base::Vector3f> &normals) const
const bool Constraint::getPoints(std::vector<Base::Vector3d> &points, std::vector<Base::Vector3d> &normals) const
{
std::vector<App::DocumentObject*> Objects = References.getValues();
std::vector<std::string> SubElements = References.getSubValues();
@@ -148,7 +148,7 @@ const bool Constraint::getPoints(std::vector<Base::Vector3f> &points, std::vecto
if (sh.ShapeType() == TopAbs_VERTEX) {
const TopoDS_Vertex& vertex = TopoDS::Vertex(sh);
gp_Pnt p = BRep_Tool::Pnt(vertex);
points.push_back(Base::Vector3f(p.X(), p.Y(), p.Z()));
points.push_back(Base::Vector3d(p.X(), p.Y(), p.Z()));
normals.push_back(NormalDirection.getValue());
} else if (sh.ShapeType() == TopAbs_EDGE) {
BRepAdaptor_Curve curve(TopoDS::Edge(sh));
@@ -166,7 +166,7 @@ const bool Constraint::getPoints(std::vector<Base::Vector3f> &points, std::vecto
double step = (lp - fp) / steps;
for (int i = 0; i < steps + 1; i++) {
gp_Pnt p = curve.Value(i * step);
points.push_back(Base::Vector3f(p.X(), p.Y(), p.Z()));
points.push_back(Base::Vector3d(p.X(), p.Y(), p.Z()));
normals.push_back(NormalDirection.getValue());
}
} else if (sh.ShapeType() == TopAbs_FACE) {
@@ -212,10 +212,10 @@ const bool Constraint::getPoints(std::vector<Base::Vector3f> &points, std::vecto
gp_Pnt p = surface.Value(u, v);
BRepClass_FaceClassifier classifier(face, p, Precision::Confusion());
if (classifier.State() != TopAbs_OUT) {
points.push_back(Base::Vector3f(p.X(), p.Y(), p.Z()));
points.push_back(Base::Vector3d(p.X(), p.Y(), p.Z()));
props.Normal(u, v,center,normal);
normal.Normalize();
normals.push_back(Base::Vector3f(normal.X(), normal.Y(), normal.Z()));
normals.push_back(Base::Vector3d(normal.X(), normal.Y(), normal.Z()));
}
}
}
@@ -225,7 +225,7 @@ const bool Constraint::getPoints(std::vector<Base::Vector3f> &points, std::vecto
return true;
}
const bool Constraint::getCylinder(float& radius, float& height, Base::Vector3f& base, Base::Vector3f& 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();
@@ -247,21 +247,21 @@ const bool Constraint::getCylinder(float& radius, float& height, Base::Vector3f&
radius = cyl.Radius();
gp_Pnt b = cyl.Location();
base = Base::Vector3f(b.X(), b.Y(), b.Z());
base = Base::Vector3d(b.X(), b.Y(), b.Z());
gp_Dir dir = cyl.Axis().Direction();
axis = Base::Vector3f(dir.X(), dir.Y(), dir.Z());
axis = Base::Vector3d(dir.X(), dir.Y(), dir.Z());
return true;
}
Base::Vector3f Constraint::getBasePoint(const Base::Vector3f& base, const Base::Vector3f& axis,
const App::PropertyLinkSub& location, const float& dist)
Base::Vector3d Constraint::getBasePoint(const Base::Vector3d& base, const Base::Vector3d& axis,
const App::PropertyLinkSub& location, const double& dist)
{
// Get the point specified by Location and Distance
App::DocumentObject* objLoc = location.getValue();
std::vector<std::string> names = location.getSubValues();
if (names.size() == 0)
return Base::Vector3f(0,0,0);
return Base::Vector3d(0,0,0);
std::string subName = names.front();
Part::Feature* featLoc = static_cast<Part::Feature*>(objLoc);
TopoDS_Shape shloc = featLoc->Shape.getShape().getSubShape(subName.c_str());
@@ -285,7 +285,7 @@ Base::Vector3f Constraint::getBasePoint(const Base::Vector3f& base, const Base::
gp_Pnt cylbase(base.x, base.y, base.z);
GeomAPI_ProjectPointOnSurf proj(cylbase, pln);
if (!proj.IsDone())
return Base::Vector3f(0,0,0);
return Base::Vector3d(0,0,0);
gp_Pnt projPnt = proj.NearestPoint();
if ((fabs(dist) > Precision::Confusion()) && (projPnt.IsEqual(cylbase, Precision::Confusion()) == Standard_False))
@@ -296,17 +296,17 @@ Base::Vector3f Constraint::getBasePoint(const Base::Vector3f& base, const Base::
Handle_Geom_Curve crv = new Geom_Line(cylbase, cylaxis);
GeomAPI_IntCS intersector(crv, plnt);
if (!intersector.IsDone())
return Base::Vector3f(0,0,0);
return Base::Vector3d(0,0,0);
gp_Pnt inter = intersector.Point(1);
return Base::Vector3f(inter.X(), inter.Y(), inter.Z());
return Base::Vector3d(inter.X(), inter.Y(), inter.Z());
}
const Base::Vector3f Constraint::getDirection(const App::PropertyLinkSub &direction)
const Base::Vector3d Constraint::getDirection(const App::PropertyLinkSub &direction)
{
App::DocumentObject* obj = direction.getValue();
std::vector<std::string> names = direction.getSubValues();
if (names.size() == 0)
return Base::Vector3f(0,0,0);
return Base::Vector3d(0,0,0);
std::string subName = names.front();
Part::Feature* feat = static_cast<Part::Feature*>(obj);
TopoDS_Shape sh = feat->Shape.getShape().getSubShape(subName.c_str());
@@ -317,18 +317,18 @@ const Base::Vector3f Constraint::getDirection(const App::PropertyLinkSub &direct
if (surface.GetType() == GeomAbs_Plane) {
dir = surface.Plane().Axis().Direction();
} else {
return Base::Vector3f(0,0,0); // "Direction must be a planar face or linear edge"
return Base::Vector3d(0,0,0); // "Direction must be a planar face or linear edge"
}
} else if (sh.ShapeType() == TopAbs_EDGE) {
BRepAdaptor_Curve line(TopoDS::Edge(sh));
if (line.GetType() == GeomAbs_Line) {
dir = line.Line().Direction();
} else {
return Base::Vector3f(0,0,0); // "Direction must be a planar face or linear edge"
return Base::Vector3d(0,0,0); // "Direction must be a planar face or linear edge"
}
}
Base::Vector3f the_direction(dir.X(), dir.Y(), dir.Z());
Base::Vector3d the_direction(dir.X(), dir.Y(), dir.Z());
the_direction.Normalize();
return the_direction;
}

View File

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

View File

@@ -50,9 +50,9 @@ ConstraintBearing::ConstraintBearing()
ADD_PROPERTY(AxialFree,(0));
ADD_PROPERTY(Radius,(0.0));
ADD_PROPERTY(Height,(0.0));
ADD_PROPERTY_TYPE(BasePoint,(Base::Vector3f(0,0,0)),"ConstraintBearing",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(BasePoint,(Base::Vector3d(0,0,0)),"ConstraintBearing",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Base point of cylindrical bearing seat");
ADD_PROPERTY_TYPE(Axis,(Base::Vector3f(0,1,0)),"ConstraintBearing",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0,1,0)),"ConstraintBearing",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Axis of bearing seat");
}
@@ -70,8 +70,8 @@ void ConstraintBearing::onChanged(const App::Property* prop)
if (prop == &References) {
// Find data of cylinder
float radius, height;
Base::Vector3f base, axis;
double radius, height;
Base::Vector3d base, axis;
if (!getCylinder(radius, height, base, axis))
return;
Radius.setValue(radius);
@@ -106,8 +106,8 @@ void ConstraintBearing::onChanged(const App::Property* prop)
}
}
float radius, height;
Base::Vector3f base, axis;
double radius, height;
Base::Vector3d base, axis;
if (!getCylinder(radius, height, base, axis))
return;
base = getBasePoint(base + axis * height/2, axis, Location, Dist.getValue());

View File

@@ -53,12 +53,12 @@ PROPERTY_SOURCE(Fem::ConstraintFixed, Fem::Constraint);
ConstraintFixed::ConstraintFixed()
{
ADD_PROPERTY_TYPE(Points,(Base::Vector3f()),"ConstraintFixed",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintFixed",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Points where symbols are drawn");
ADD_PROPERTY_TYPE(Normals,(Base::Vector3f()),"ConstraintFixed",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintFixed",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Normals where symbols are drawn");
Points.setValues(std::vector<Base::Vector3f>());
Normals.setValues(std::vector<Base::Vector3f>());
Points.setValues(std::vector<Base::Vector3d>());
Normals.setValues(std::vector<Base::Vector3d>());
}
App::DocumentObjectExecReturn *ConstraintFixed::execute(void)
@@ -73,8 +73,8 @@ void ConstraintFixed::onChanged(const App::Property* prop)
Constraint::onChanged(prop);
if (prop == &References) {
std::vector<Base::Vector3f> points;
std::vector<Base::Vector3f> normals;
std::vector<Base::Vector3d> points;
std::vector<Base::Vector3d> normals;
if (getPoints(points, normals)) {
Points.setValues(points);
Normals.setValues(normals);

View File

@@ -48,12 +48,12 @@ ConstraintForce::ConstraintForce()
ADD_PROPERTY_TYPE(Direction,(0),"ConstraintForce",(App::PropertyType)(App::Prop_None),
"Element giving direction of constraint");
ADD_PROPERTY(Reversed,(0));
ADD_PROPERTY_TYPE(Points,(Base::Vector3f()),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Points where arrows are drawn");
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3f(0,0,1)),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3d(0,0,1)),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Direction of arrows");
naturalDirectionVector = Base::Vector3f(0,0,1);
Points.setValues(std::vector<Base::Vector3f>());
naturalDirectionVector = Base::Vector3d(0,0,1);
Points.setValues(std::vector<Base::Vector3d>());
}
App::DocumentObjectExecReturn *ConstraintForce::execute(void)
@@ -68,14 +68,14 @@ void ConstraintForce::onChanged(const App::Property* prop)
Constraint::onChanged(prop);
if (prop == &References) {
std::vector<Base::Vector3f> points;
std::vector<Base::Vector3f> normals;
std::vector<Base::Vector3d> points;
std::vector<Base::Vector3d> normals;
if (getPoints(points, normals)) {
Points.setValues(points); // We don't use the normals because all arrows should have the same direction
Points.touch(); // This triggers ViewProvider::updateData()
}
} else if (prop == &Direction) {
Base::Vector3f direction = getDirection(Direction);
Base::Vector3d direction = getDirection(Direction);
if (direction.Length() < Precision::Confusion())
return;
naturalDirectionVector = direction;

View File

@@ -60,7 +60,7 @@ protected:
virtual void onChanged(const App::Property* prop);
private:
Base::Vector3f naturalDirectionVector;
Base::Vector3d naturalDirectionVector;
};
} //namespace Fem

View File

@@ -50,9 +50,9 @@ ConstraintGear::ConstraintGear()
ADD_PROPERTY_TYPE(Direction,(0),"ConstraintGear",(App::PropertyType)(App::Prop_None),
"Element giving direction of gear force");
ADD_PROPERTY(Reversed,(0));
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3f(1,1,1).Normalize()),"ConstraintGear",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3d(1,1,1).Normalize()),"ConstraintGear",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
"Direction of gear force");
naturalDirectionVector = Base::Vector3f(1,1,1).Normalize();
naturalDirectionVector = Base::Vector3d(1,1,1).Normalize();
}
App::DocumentObjectExecReturn *ConstraintGear::execute(void)
@@ -65,7 +65,7 @@ void ConstraintGear::onChanged(const App::Property* prop)
ConstraintBearing::onChanged(prop);
if (prop == &Direction) {
Base::Vector3f direction = getDirection(Direction);
Base::Vector3d direction = getDirection(Direction);
if (direction.Length() < Precision::Confusion())
return;
naturalDirectionVector = direction;

View File

@@ -61,7 +61,7 @@ protected:
virtual void onChanged(const App::Property* prop);
private:
Base::Vector3f naturalDirectionVector;
Base::Vector3d naturalDirectionVector;
};
} //namespace Fem

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

@@ -118,9 +118,9 @@ void ViewProviderFemConstraintBearing::updateData(const App::Property* prop)
pShapeSep->removeAllChildren();
// This should always point outside of the cylinder
Base::Vector3f normal = pcConstraint->NormalDirection.getValue();
Base::Vector3f base = pcConstraint->BasePoint.getValue();
float radius = pcConstraint->Radius.getValue();
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d base = pcConstraint->BasePoint.getValue();
double radius = pcConstraint->Radius.getValue();
base = base + radius * normal;
SbVec3f b(base.x, base.y, base.z);
@@ -132,9 +132,9 @@ void ViewProviderFemConstraintBearing::updateData(const App::Property* prop)
} else if (strcmp(prop->getName(),"AxialFree") == 0) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
Base::Vector3f normal = pcConstraint->NormalDirection.getValue();
Base::Vector3f base = pcConstraint->BasePoint.getValue();
float radius = pcConstraint->Radius.getValue();
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d base = pcConstraint->BasePoint.getValue();
double radius = pcConstraint->Radius.getValue();
base = base + radius * normal;
SbVec3f b(base.x, base.y, base.z);

View File

@@ -131,16 +131,16 @@ void ViewProviderFemConstraintFixed::updateData(const App::Property* prop)
// Note: Points and Normals are always updated together
pShapeSep->removeAllChildren();
const std::vector<Base::Vector3f>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3f>& normals = pcConstraint->Normals.getValues();
std::vector<Base::Vector3f>::const_iterator n = normals.begin();
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
std::vector<Base::Vector3d>::const_iterator n = normals.begin();
/*
SoMultipleCopy* cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0));
cp->matrix.setNum(points.size());
int idx = 0;
*/
for (std::vector<Base::Vector3f>::const_iterator p = points.begin(); p != points.end(); p++) {
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
SbVec3f base(p->x, p->y, p->z);
SbVec3f dir(n->x, n->y, n->z);
SbRotation rot(SbVec3f(0,-1,0), dir);

View File

@@ -132,24 +132,24 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
pShapeSep->removeAllChildren();
// This should always point outside of the solid
Base::Vector3f normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
// Get default direction (on first call to method)
Base::Vector3f forceDirection = pcConstraint->DirectionVector.getValue();
Base::Vector3d forceDirection = pcConstraint->DirectionVector.getValue();
if (forceDirection.Length() < Precision::Confusion())
forceDirection = normal;
SbVec3f dir(forceDirection.x, forceDirection.y, forceDirection.z);
SbRotation rot(SbVec3f(0,1,0), dir);
const std::vector<Base::Vector3f>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
/*
SoMultipleCopy* cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0));
cp->matrix.setNum(points.size());
int idx = 0;*/
for (std::vector<Base::Vector3f>::const_iterator p = points.begin(); p != points.end(); p++) {
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
SbVec3f base(p->x, p->y, p->z);
if (forceDirection.GetAngle(normal) < M_PI_2) // Move arrow so it doesn't disappear inside the solid
base = base + dir * ARROWLENGTH;
@@ -166,15 +166,15 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
}
} else if (strcmp(prop->getName(),"DirectionVector") == 0) { // Note: "Reversed" also triggers "DirectionVector"
// Re-orient all arrows
Base::Vector3f normal = pcConstraint->NormalDirection.getValue();
Base::Vector3f forceDirection = pcConstraint->DirectionVector.getValue();
Base::Vector3d normal = pcConstraint->NormalDirection.getValue();
Base::Vector3d forceDirection = pcConstraint->DirectionVector.getValue();
if (forceDirection.Length() < Precision::Confusion())
forceDirection = normal;
SbVec3f dir(forceDirection.x, forceDirection.y, forceDirection.z);
SbRotation rot(SbVec3f(0,1,0), dir);
const std::vector<Base::Vector3f>& points = pcConstraint->Points.getValues();
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
/*
SoMultipleCopy* cp = static_cast<SoMultipleCopy*>(pShapeSep->getChild(0));
@@ -182,7 +182,7 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
*/
int idx = 0;
for (std::vector<Base::Vector3f>::const_iterator p = points.begin(); p != points.end(); p++) {
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
SbVec3f base(p->x, p->y, p->z);
if (forceDirection.GetAngle(normal) < M_PI_2)
base = base + dir * ARROWLENGTH;

View File

@@ -114,16 +114,16 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
// Remove and recreate the symbol
pShapeSep->removeAllChildren();
Base::Vector3f base = pcConstraint->BasePoint.getValue();
Base::Vector3f axis = pcConstraint->Axis.getValue();
Base::Vector3f direction = pcConstraint->DirectionVector.getValue();
Base::Vector3d base = pcConstraint->BasePoint.getValue();
Base::Vector3d axis = pcConstraint->Axis.getValue();
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3f(0,1,0);
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
direction = Base::Vector3d(0,1,0);
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);
@@ -138,15 +138,15 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
} else if (strcmp(prop->getName(),"Diameter") == 0) {
if (pShapeSep->getNumChildren() > 0) {
// Change the symbol
Base::Vector3f axis = pcConstraint->Axis.getValue();
Base::Vector3f direction = pcConstraint->DirectionVector.getValue();
Base::Vector3d axis = pcConstraint->Axis.getValue();
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3f(0,1,0);
float dia = pcConstraint->Diameter.getValue();
float radius = pcConstraint->Radius.getValue();
direction = Base::Vector3d(0,1,0);
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);
@@ -161,12 +161,12 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
// Note: "Reversed" also triggers "DirectionVector"
if (pShapeSep->getNumChildren() > 0) {
// Re-orient the symbol
Base::Vector3f axis = pcConstraint->Axis.getValue();
Base::Vector3f direction = pcConstraint->DirectionVector.getValue();
Base::Vector3d axis = pcConstraint->Axis.getValue();
Base::Vector3d direction = pcConstraint->DirectionVector.getValue();
if (direction.Length() < Precision::Confusion())
direction = Base::Vector3f(0,1,0);
float dia = pcConstraint->Diameter.getValue();
float angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
direction = Base::Vector3d(0,1,0);
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

@@ -114,17 +114,17 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
pShapeSep->removeAllChildren();
// This should always point outside of the cylinder
Base::Vector3f base = pcConstraint->BasePoint.getValue();
Base::Vector3f axis = pcConstraint->Axis.getValue();
float radius = pcConstraint->Radius.getValue();
float dia = pcConstraint->Diameter.getValue();
Base::Vector3d base = pcConstraint->BasePoint.getValue();
Base::Vector3d axis = pcConstraint->Axis.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);

View File

@@ -162,7 +162,7 @@ bool FemFace::isSameFace (FemFace &face)
PROPERTY_SOURCE(FemGui::ViewProviderFemMesh, Gui::ViewProviderGeometryObject)
App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0f,64.0f,1.0f};
App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0,64.0,1.0};
ViewProviderFemMesh::ViewProviderFemMesh()
{
@@ -455,8 +455,8 @@ std::vector<Base::Vector3d> ViewProviderFemMesh::getSelectionShape(const char* E
return std::vector<Base::Vector3d>();
}
void ViewProviderFemMesh::setHighlightNodes(const std::set<long>& HighlightedNodes)
{
void ViewProviderFemMesh::setHighlightNodes(const std::set<long>& HighlightedNodes)
{
if(HighlightedNodes.size()){
const Fem::PropertyFemMesh* mesh = &(dynamic_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh);
@@ -475,11 +475,11 @@ void ViewProviderFemMesh::setHighlightNodes(const std::set<long>& HighlightedNod
pcAnoCoords->point.setNum(0);
}
}
void ViewProviderFemMesh::resetHighlightNodes(void)
{
pcAnoCoords->point.setNum(0);
}
}
void ViewProviderFemMesh::resetHighlightNodes(void)
{
pcAnoCoords->point.setNum(0);
}
PyObject * ViewProviderFemMesh::getPyObject()
{