Skip to content
ForCADDocumentation
Browse guide contents ↓

Reverse a parameter direction

Reverse a line so that increasing U traverses it from its former end to its former start. This is useful when two profiles describe the same edge in opposite directions.

program reverse_a_patch
    use forcad, only: rk, nurbs_curve
    implicit none
    type(nurbs_curve) :: edge, reversed
    real(rk) :: forward(2), backward(2)

    call edge%set(Xc=reshape([0._rk,6._rk,0._rk,2._rk],[2,2]))
    if (.not. edge%err%ok) error stop "Could not define the line"
    reversed = edge%reverse()
    if (.not. reversed%err%ok) error stop "Could not reverse the line"

    forward = edge%cmp_Xg(0.75_rk)
    backward = reversed%cmp_Xg(0.25_rk)
    print '(2f7.2)', forward, backward
end program

Both lines print 4.50 1.50. On an interval , the reversed curve at follows the original at inside a continuous span. The result keeps the same interval. To reverse just one axis on a surface or volume, pass dir=1 for U, dir=2 for V, or dir=3 for W on a volume.

To change the numerical bounds of an interval, use Set a parameter domain.