View Issue Details

IDProjectCategoryView StatusLast Update
0028154CommunityOCCT:Modeling Algorithmspublic2016-11-25 21:55
Reporterdevocctgp Assigned Tomsv 
PrioritynormalSeverityminor 
Status closedResolutionno change required 
Summary0028154: Geom_OffsetCurve generated selfintersect curve
DescriptionGeom_OffsetCurve generated selfintersect curve
Tested in opencascade 7.1.0 beat
Steps To Reproducevoid DesignBaseCurve(
    double baseLeft, double baseTop,
    Handle(Geom_Curve)& result)
{
    gp_Pln work_pln(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0)));

    // proe_relative point
    TColgp_Array1OfPnt2d proe_p(1, 6);
    proe_p(1) = gp_Pnt2d(-17.600000, 0.000000);
    proe_p(2) = gp_Pnt2d(-17.121576, 11.117883);
    proe_p(3) = gp_Pnt2d(-14.934486, 20.654035);
    proe_p(4) = gp_Pnt2d(-10.896013, 27.921102);
    proe_p(5) = gp_Pnt2d(-6.992463, 31.258007);
    proe_p(6) = gp_Pnt2d(0.000000, 32.800000);
    gp_XY proe_p_d(proe_p(6).XY() - proe_p(1).XY());

    TColgp_Array1OfPnt2d bspline_p_rel(2, 5);
    for (int i = bspline_p_rel.Lower(); i <= bspline_p_rel.Upper(); i++)
    {
        gp_XY d = proe_p(i).XY() - proe_p(1).XY();
        double dx_rel = d.X() / proe_p_d.X();
        double dy_rel = d.Y() / proe_p_d.Y();
        bspline_p_rel(i) = gp_Pnt2d(dx_rel, dy_rel);
    }

    // calc real point data
    TColgp_HArray1OfPnt2d bspline_p(1, 6);
    bspline_p(1) = gp_Pnt2d(-baseLeft, 0);
    bspline_p(6) = gp_Pnt2d(0, baseTop);

    gp_XY real_p_d(bspline_p(6).XY() - bspline_p(1).XY());
    for (int i = 2; i <= 5; i++)
    {
        double real_x = bspline_p(1).X() + bspline_p_rel(i).X() * real_p_d.X();
        double real_y = bspline_p(1).Y() + bspline_p_rel(i).Y() * real_p_d.Y();
        bspline_p(i) = gp_Pnt2d(real_x, real_y);
    }

    //
    TColgp_Array1OfVec2d tangent_2d(1, 2);
    tangent_2d(1) = gp_Vec2d(0, 1);
    tangent_2d(2) = gp_Vec2d(1, 0);

    // ~ OK ~ let's go now
    Handle(TColgp_HArray1OfPnt2d) h_v_2d = new TColgp_HArray1OfPnt2d(bspline_p);
    Geom2dAPI_Interpolate interp_2d(h_v_2d, Standard_False, 1e-6);
    interp_2d.Load(tangent_2d(1), tangent_2d(2));
    interp_2d.Perform();
    Handle(Geom2d_BSplineCurve) curve_2d = interp_2d.Curve();
    Handle(Geom_Curve) curve_3d = GeomAPI::To3d(curve_2d, work_pln);
    
    result = curve_3d;
}

void Test()
{
        Handle(Geom_Curve) base_curve;
    DesignBaseCurve(17.600, 32.800, base_curve);

    TopoDS_Edge base_curve_e = BRepBuilderAPI_MakeEdge(base_curve);
    //AddDrawShape(base_curve_e, "base", NextColor());

    Handle(Geom_OffsetCurve) base_curve_off = new Geom_OffsetCurve(base_curve, 15, gp_Dir(0, 0, 1));
    TopoDS_Edge base_curve_off_e = BRepBuilderAPI_MakeEdge(base_curve_off);
    //AddDrawShape(base_curve_off_e, "off", NextColor());

}
TagsNo tags attached.
Test case number

Attached Files

Activities

devocctgp

2016-11-25 15:02

developer  

offsetcurveSelfIntersect.png (19,929 bytes)   

msv

2016-11-25 15:17

developer   ~0060776

This result is expected. Geom_OffsetCurve is not an algorithm, but just a storage of data, which may be incorrect. In order to resolve self-intersections, you need to perform the algorithm BRepOffsetAPI_MakeOffset.

devocctgp

2016-11-25 21:17

developer   ~0060786

ok, thank you

Issue History

Date Modified Username Field Change
2016-11-25 15:02 devocctgp New Issue
2016-11-25 15:02 devocctgp Assigned To => msv
2016-11-25 15:02 devocctgp File Added: offsetcurveSelfIntersect.png
2016-11-25 15:03 devocctgp Summary Geom_OffsetCurve generated selfintersect curve => Geom_OffsetCurve generated selfintersect curve
2016-11-25 15:03 devocctgp Description Updated
2016-11-25 15:17 msv Note Added: 0060776
2016-11-25 15:18 msv Assigned To msv => devocctgp
2016-11-25 15:18 msv Status new => feedback
2016-11-25 15:18 msv Resolution open => no change required
2016-11-25 21:17 devocctgp Note Added: 0060786
2016-11-25 21:17 devocctgp Assigned To devocctgp => msv
2016-11-25 21:17 devocctgp Status feedback => resolved
2016-11-25 21:55 abv Status resolved => closed
2016-11-25 21:55 abv Target Version Unscheduled =>