#include <GEOMImpl_ITransformOperations.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
Handle(GEOM_Function) aVector = TI.GetVector();
gp_Vec Vec = gp::DX();
if (!aVector.IsNull()) {
- TopoDS_Shape aV = aVector->GetValue();
- if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
- Vec = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec = GEOMUtils::GetVector( aVector->GetValue(), Standard_False );
Vec.Normalize();
}
gp_Vec Vec2 = gp::DY();
if (!aVector.IsNull()) {
- TopoDS_Shape aV = aVector->GetValue();
- if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
- Vec1 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec1 = GEOMUtils::GetVector( aVector->GetValue(), Standard_False );
Vec1.Normalize();
}
if (!aVector2.IsNull()) {
- TopoDS_Shape aV = aVector2->GetValue();
- if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
- Vec2 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec2 = GEOMUtils::GetVector( aVector2->GetValue(), Standard_False );
Vec2.Normalize();
}
// angular step
double diag = sqrt((Xmax-Xmin)*(Xmax-Xmin) + (Ymax-Ymin)*(Ymax-Ymin));
double d = sqrt((0.5*(Xmax+Xmin))*(0.5*(Xmax+Xmin)) + (0.5*(Ymax+Ymin))*(0.5*(Ymax+Ymin)));
- myAng = floor(2.0 * atan(diag/d) * 180.0 / M_PI);
+ if ( fabs(d) > 1.e-16 )
+ myAng = floor(2.0 * atan(diag/d) * 180.0 / M_PI);
GroupArgs->SpinBox_DX1->setValue(myAng);
// radial step
createPathPreview(myVectorU.get());
createPathPreview(myVectorV.get());
anObj = anOper->MultiTranslate2D(myBase.get(),
- myVectorU.get(), myStepU, myNbTimesU,
- myVectorV.get(), myStepV, myNbTimesV);
+ myVectorU.get(), myStepU, myNbTimesU,
+ myVectorV.get(), myStepV, myNbTimesV);
if (!IsPreview()) {
aParameters << GroupDimensions->SpinBox_DX1->text();
aParameters << GroupDimensions->SpinBox_DY1->text();
ShapeAnalysis_Edge aShapeAnal;
TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge );
TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge );
+ if ( BRep_Tool::Pnt(aFirst).IsEqual( BRep_Tool::Pnt(aLast), Precision::Confusion() ) ) return;
TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
const char* aName = "tmpVector";
Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
-
+
// add Prs to preview
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));