Geom_Curve periodicity not Copy()ed ?


I have a Handle(Geom_BSplineCurve) c, c->IsClosed()==true. Now, I do c->SetPeriodic(), OK. Then, however, I reparametrize the curve by saying c->Segment(u1,u1+c->Period()), where 0

Looking into Geom_TrimmedCurve.cxx, this exception is raised only for non-periodic basisCurve=Handle(Curve)::DownCast(C->Copy()) in the constructor. Am I right thinking that Geom_Curve::Copy does not preserve periodicity? How can I use segments crossing period boundary?

Thanks for any hints. Regards, VS

Roman Lygin's picture

Hi Vaclav,

I guess the point is not in Copy(), which just clones the curve but in ->SetPeriodic() which did not produce a periodic curve. Not any closed BSpline can be made periodic – for instance if its boundary knots has multiplicity = degree + 1, this certainly won’t work (since continuity condition is violated). Check SetPeriodic() by inspecting source code and you can always check its result by querying IsPeriodic().


Vaclav Smilauer's picture

Roman, thanks for your reply, documentation indeed metions that knots table needs to be periodic. In that contrary case, however, I think SetPeriodic _should_ throw, just like it does for non-closed curves. I found that ShapeConstruct_Curve::ConvertToPeriodic might take care of all that business seamlessly (have not tried it yet).

Vaclav Smilauer's picture

ShapeConstruct_Curve::ConvertToPeriodic works fine. I make a period-long segment that starts at e.g. u=0.43, then such curve has parametrization [0.43;1.43]. Now the problem is that GeomAdaptor_Curve does not apparently know anything about LastParameter()>1 and UniformDeflection does not return any point beyond u=1, even if parameter range passed to the constructor is correct. Any ideas?

Regards, Vaclav