+ Fix double to float cast
This commit is contained in:
parent
72848e0477
commit
31afafcba6
|
@ -253,9 +253,11 @@ private:
|
|||
template <class _Vec1, class _Vec2>
|
||||
inline _Vec1 convertTo(const _Vec2& v)
|
||||
{
|
||||
typedef _Vec2 vec_type;
|
||||
typedef vec_traits<vec_type> traits_type;
|
||||
typedef typename traits_type::float_type float_type;
|
||||
typedef _Vec1 out_type;
|
||||
typedef _Vec2 inp_type;
|
||||
typedef vec_traits<inp_type> traits_type;
|
||||
typedef vec_traits<out_type> traits_out;
|
||||
typedef typename traits_out::float_type float_type;
|
||||
traits_type t(v);
|
||||
return _Vec1((float_type)t.x(),(float_type)t.y(),(float_type)t.z());
|
||||
};
|
||||
|
|
|
@ -146,14 +146,14 @@ void ProjectionAlgos::execute(void)
|
|||
|
||||
}
|
||||
|
||||
std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tolerance)
|
||||
std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double tolerance)
|
||||
{
|
||||
std::stringstream result;
|
||||
SVGOutput output;
|
||||
float hfactor = 0.5f; // hidden line size factor, was 0.15f / 0.35f;
|
||||
|
||||
if (!H.IsNull() && (type & WithHidden)) {
|
||||
float width = hfactor * scale;
|
||||
double width = hfactor * scale;
|
||||
BRepMesh::Mesh(H,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -168,7 +168,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!HO.IsNull() && (type & WithHidden)) {
|
||||
float width = hfactor * scale;
|
||||
double width = hfactor * scale;
|
||||
BRepMesh::Mesh(HO,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -183,7 +183,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!VO.IsNull()) {
|
||||
float width = scale;
|
||||
double width = scale;
|
||||
BRepMesh::Mesh(VO,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -197,7 +197,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!V.IsNull()) {
|
||||
float width = scale;
|
||||
double width = scale;
|
||||
BRepMesh::Mesh(V,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -211,7 +211,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!V1.IsNull() && (type & WithSmooth)) {
|
||||
float width = scale;
|
||||
double width = scale;
|
||||
BRepMesh::Mesh(V1,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -225,7 +225,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
|
||||
float width = hfactor * scale;
|
||||
double width = hfactor * scale;
|
||||
BRepMesh::Mesh(H1,tolerance);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -248,7 +248,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, float scale, float tole
|
|||
|
||||
/* dxf output section - Dan Falck 2011/09/25 */
|
||||
|
||||
std::string ProjectionAlgos::getDXF(ExtractionType type, float scale, float tolerance)
|
||||
std::string ProjectionAlgos::getDXF(ExtractionType type, double scale, double tolerance)
|
||||
{
|
||||
std::stringstream result;
|
||||
DXFOutput output;
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
WithSmooth = 2
|
||||
};
|
||||
|
||||
std::string getSVG(ExtractionType type, float scale, float tolerance);
|
||||
std::string getDXF(ExtractionType type, float scale, float tolerance);//added by Dan Falck 2011/09/25
|
||||
std::string getSVG(ExtractionType type, double scale, double tolerance);
|
||||
std::string getDXF(ExtractionType type, double scale, double tolerance);//added by Dan Falck 2011/09/25
|
||||
|
||||
|
||||
const TopoDS_Shape &Input;
|
||||
|
|
|
@ -214,9 +214,9 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
|
|||
if (aColorTool->GetColor(aShape, XCAFDoc_ColorGen, aColor) ||
|
||||
aColorTool->GetColor(aShape, XCAFDoc_ColorSurf, aColor) ||
|
||||
aColorTool->GetColor(aShape, XCAFDoc_ColorCurv, aColor)) {
|
||||
color.r = aColor.Red();
|
||||
color.g = aColor.Green();
|
||||
color.b = aColor.Blue();
|
||||
color.r = (float)aColor.Red();
|
||||
color.g = (float)aColor.Green();
|
||||
color.b = (float)aColor.Blue();
|
||||
std::vector<App::Color> colors;
|
||||
colors.push_back(color);
|
||||
applyColors(part, colors);
|
||||
|
@ -246,9 +246,9 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
|
|||
aColorTool->GetColor(xp.Current(), XCAFDoc_ColorSurf, aColor) ||
|
||||
aColorTool->GetColor(xp.Current(), XCAFDoc_ColorCurv, aColor)) {
|
||||
int index = faces.FindIndex(xp.Current());
|
||||
color.r = aColor.Red();
|
||||
color.g = aColor.Green();
|
||||
color.b = aColor.Blue();
|
||||
color.r = (float)aColor.Red();
|
||||
color.g = (float)aColor.Green();
|
||||
color.b = (float)aColor.Blue();
|
||||
faceColors[index-1] = color;
|
||||
found_face_color = true;
|
||||
}
|
||||
|
@ -438,9 +438,9 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
|||
if (jt != myColorMap.end()) {
|
||||
int index = faces.FindIndex(xp.Current());
|
||||
App::Color color;
|
||||
color.r = jt->second.Red();
|
||||
color.g = jt->second.Green();
|
||||
color.b = jt->second.Blue();
|
||||
color.r = (float)jt->second.Red();
|
||||
color.g = (float)jt->second.Green();
|
||||
color.b = (float)jt->second.Blue();
|
||||
faceColors[index-1] = color;
|
||||
found_face_color = true;
|
||||
}
|
||||
|
|
|
@ -169,15 +169,15 @@ bool MeshTrimming::IsPolygonPointInFacet(unsigned long ulIndex, Base::Vector3f&
|
|||
A = clFacPoly[0];
|
||||
B = clFacPoly[1];
|
||||
C = clFacPoly[2];
|
||||
fDetABC = A.fX*B.fY+A.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+A.fY*B.fX+A.fX*C.fY);
|
||||
fDetABC = (float)(A.fX*B.fY+A.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+A.fY*B.fX+A.fX*C.fY));
|
||||
|
||||
for (unsigned long j=0; j<myPoly.GetCtVectors(); j++) {
|
||||
// facet contains a polygon point -> calculate the corresponding 3d-point
|
||||
if (clFacPoly.Contains(myPoly[j])) {
|
||||
P = myPoly[j];
|
||||
fDetPAC = A.fX*P.fY+A.fY*C.fX+P.fX*C.fY-(P.fY*C.fX+A.fY*P.fX+A.fX*C.fY);
|
||||
fDetPBC = P.fX*B.fY+P.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+P.fY*B.fX+P.fX*C.fY);
|
||||
fDetPAB = A.fX*B.fY+A.fY*P.fX+B.fX*P.fY-(B.fY*P.fX+A.fY*B.fX+A.fX*P.fY);
|
||||
fDetPAC = (float)(A.fX*P.fY+A.fY*C.fX+P.fX*C.fY-(P.fY*C.fX+A.fY*P.fX+A.fX*C.fY));
|
||||
fDetPBC = (float)(P.fX*B.fY+P.fY*C.fX+B.fX*C.fY-(B.fY*C.fX+P.fY*B.fX+P.fX*C.fY));
|
||||
fDetPAB = (float)(A.fX*B.fY+A.fY*P.fX+B.fX*P.fY-(B.fY*P.fX+A.fY*B.fX+A.fX*P.fY));
|
||||
u = fDetPBC / fDetABC;
|
||||
v = fDetPAC / fDetABC;
|
||||
w = fDetPAB / fDetABC;
|
||||
|
@ -224,13 +224,13 @@ bool MeshTrimming::GetIntersectionPointsOfPolygonAndFacet(unsigned long ulIndex,
|
|||
|
||||
if (clPolyLine.Intersect(clFacLine, S)) {
|
||||
bool bPushBack=true;
|
||||
float fP1P2 = (P2-P1).Length();
|
||||
float fSP1 = (P1-S).Length();
|
||||
float fSP2 = (P2-S).Length();
|
||||
float fP1P2 = (float)(P2-P1).Length();
|
||||
float fSP1 = (float)(P1-S).Length();
|
||||
float fSP2 = (float)(P2-S).Length();
|
||||
|
||||
float fP3P4 = (P4-P3).Length();
|
||||
float fSP3 = (P3-S).Length();
|
||||
float fSP4 = (P4-S).Length();
|
||||
float fP3P4 = (float)(P4-P3).Length();
|
||||
float fSP3 = (float)(P3-S).Length();
|
||||
float fSP4 = (float)(P4-S).Length();
|
||||
// compute propotion of length
|
||||
float l = fSP1 / fP1P2;
|
||||
float m = fSP2 / fP1P2;
|
||||
|
|
|
@ -252,7 +252,7 @@ App::DocumentObjectExecReturn *FixDeformations::execute(void)
|
|||
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
|
||||
std::auto_ptr<MeshObject> mesh(new MeshObject);
|
||||
*mesh = kernel->getValue();
|
||||
mesh->validateDeformations(MaxAngle.getValue());
|
||||
mesh->validateDeformations((float)MaxAngle.getValue());
|
||||
this->Mesh.setValuePtr(mesh.release());
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ App::DocumentObjectExecReturn *FillHoles::execute(void)
|
|||
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
|
||||
std::auto_ptr<MeshObject> mesh(new MeshObject);
|
||||
*mesh = kernel->getValue();
|
||||
MeshCore::ConstraintDelaunayTriangulator cTria(MaxArea.getValue());
|
||||
MeshCore::ConstraintDelaunayTriangulator cTria((float)MaxArea.getValue());
|
||||
//MeshCore::Triangulator cTria(mesh->getKernel());
|
||||
mesh->fillupHoles(FillupHolesOfLength.getValue(), 1, cTria);
|
||||
this->Mesh.setValuePtr(mesh.release());
|
||||
|
|
|
@ -61,7 +61,7 @@ short Sphere::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Sphere::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createSphere(Radius.getValue(),Sampling.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createSphere((float)Radius.getValue(),Sampling.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
@ -97,7 +97,7 @@ short Ellipsoid::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Ellipsoid::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createEllipsoid(Radius1.getValue(),Radius2.getValue(),Sampling.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createEllipsoid((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
@ -138,8 +138,8 @@ short Cylinder::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Cylinder::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCylinder(Radius.getValue(),Length.getValue(),
|
||||
Closed.getValue(),EdgeLength.getValue(),Sampling.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCylinder((float)Radius.getValue(),(float)Length.getValue(),
|
||||
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
@ -183,8 +183,8 @@ short Cone::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Cone::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCone(Radius1.getValue(),Radius2.getValue(),Length.getValue(),
|
||||
Closed.getValue(),EdgeLength.getValue(),Sampling.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCone((float)Radius1.getValue(),(float)Radius2.getValue(),(float)Length.getValue(),
|
||||
Closed.getValue(),(float)EdgeLength.getValue(),Sampling.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
@ -220,7 +220,7 @@ short Torus::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Torus::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createTorus(Radius1.getValue(),Radius2.getValue(),Sampling.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createTorus((float)Radius1.getValue(),(float)Radius2.getValue(),Sampling.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
@ -256,7 +256,7 @@ short Cube::mustExecute() const
|
|||
|
||||
App::DocumentObjectExecReturn *Cube::execute(void)
|
||||
{
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCube(Length.getValue(),Width.getValue(),Height.getValue()));
|
||||
std::auto_ptr<MeshObject> mesh(MeshObject::createCube((float)Length.getValue(),(float)Width.getValue(),(float)Height.getValue()));
|
||||
if (mesh.get()) {
|
||||
mesh->setPlacement(this->Placement.getValue());
|
||||
Mesh.setValue(mesh->getKernel());
|
||||
|
|
Loading…
Reference in New Issue
Block a user