
Tue, 09/16/2025 - 11:08
Forums:
I am using the following code -
BRep_ListIteratorOfListOfCurveRepresentation itcr; Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) & edge.TShape()); const TopLoc_Location& Eloc = edge.Location(); const BRep_ListOfCurveRepresentation& aLCR = TE->Curves(); TopoDS_Vertex v1a, v1b; TopExp::Vertices(edge, v1a, v1b); gp_Pnt pnt1a = BRep_Tool::Pnt(v1a); gp_Pnt pnt2a = BRep_Tool::Pnt(v1b); // itcr.Initialize(aLCR); gp_Pnt2d aPC2D1, aPC2D2; gp_Pnt aPC3D1, aPC3D2; for (; itcr.More(); itcr.Next()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); const TopLoc_Location& loc = cr->Location(); TopLoc_Location L = (Eloc * loc); if (cr->IsCurve3D()) { const Handle(Geom_Curve)& aC3D = cr->Curve3D(); // if (aC3D.IsNull()) { continue; } Standard_Real aParam1, aParam2; aParam1 = BRep_Tool::Parameter(v1a, edge); aPC3D1 = aC3D->Value(aParam1); aParam2 = BRep_Tool::Parameter(v1b, edge); aPC3D2 = aC3D->Value(aParam2); } else if (cr->IsCurveOnSurface()) { const Handle(Geom2d_Curve)& aC2D = cr->PCurve(); if (aC2D.IsNull()) { continue; } const Handle(Geom_Surface)& aS = cr->Surface(); Standard_Real aParam1, aParam2; aParam1 = BRep_Tool::Parameter(v1a, edge, aS, L); aPC2D1 = aC2D->Value(aParam1); aParam2 = BRep_Tool::Parameter(v1b, edge, aS, L); aPC2D2 = aC2D->Value(aParam2); } }
Here are the values that I get -
aPC2D1 : { x = 0.014740, y = 16.048112 } [gp_Pnt2d]
aPC2D2 : { x = 0.412034, y = 16.459913 } [gp_Pnt2d]
aPC3D1 : { x = 0.014740, y = 16.048112, z = 0.000000 } [gp_Pnt]
aPC3D2 : { x = 0.412034, y = 16.459913, z = 0.000000 } [gp_Pnt]
pnt1a : { x = 0.013663, y = 16.049987, z = 0.000000 } [gp_Pnt]
pnt2a : { x = 0.411037, y = 16.461870, z = 0.000000 } [gp_Pnt]
As you can see, when points are calculated from edge, they are slightly different than the ones calculated from curves. (x = 0.013663 vs x = 0.014740) Is this expected? I am getting wrong results in my algorithm due to this difference.