#include <BRepAdaptor_Curve.hxx>
#include <Prs3d_LineAspect.hxx>
-IMPLEMENT_STANDARD_HANDLE (HYDROGUI_Polyline, AIS_Shape)
IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_Polyline, AIS_Shape)
Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth );
TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
+ Bnd_Box BB;
+ BRepBndLib::AddClose(myshape, BB);
+ double xmin, xmax, ymin, ymax, zmin, zmax;
+ double devCoeff = 0.05;
+ if (!BB.IsVoid())
+ {
+ BB.Get(xmin, ymin, zmin, xmax, ymax, zmax); //ignore Z coord
+ double minSide = Min(Abs(xmax - xmin), Abs(ymax - ymin));
+ devCoeff = minSide > 50 ? 0.05 : minSide / 3000;
+ }
for ( ; Exp1.More(); Exp1.Next() )
{
TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
- Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
+ Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, devCoeff );
if( !anArray.IsNull() )
{
aGroup->SetPrimitivesAspect( anAspect );
gp_Pnt aPnt1 = C->Value (aMaxRatioStep);
gp_Vec aDir;
- if (!UseD1) {
+ if (!UseD1)
+ {
GCPnts_AbscissaPoint aAbsPoint(aAdC, -aArrLen, aMaxRatioStep);
double aParam = aAbsPoint.Parameter();
gp_Pnt aPnt2 = C->Value (aParam);
D.Subtract (aPnt2.XYZ());
aDir = D;
}
- else
+
+ if (UseD1 || aDir.IsEqual (gp_Vec(0,0,0), Precision::Confusion(), Precision::Angular()))
C->D1(aMaxRatioStep, aPnt1, aDir);
if ( anEdge.Orientation() == TopAbs_REVERSED )