def test(
        xshift=0.,
        xb=0.,  #1st vertex: x value
        xe=12.,  #last vertex: x value
        yb=12.,
        ye=0.,
        area=72.,
        xc=4.,
        yc=4.):

    xb = xb + xshift
    xe = xe + xshift

    alphab = 0.  #tangent at the start of the curve
    Cab_given = 0.  #curvature desired at the beggining

    alphae = 0.  #tangent at the end of the curve
    Cae_given = 0.  #curvature desired at the end

    ## Curve Integral parameters:

    ini_CV = InitializeControlVertices(xb, yb, xe, ye, alphab, alphae,
                                       Cab_given, Cae_given, area, xc, yc)

    curve = Bspline(ini_CV.vertices, 4, 50)
    plot(ini_CV)

    curve.compute_area()
    curve.MomentMatrices()
    curve.compute_moments()
    curve.computeXc()

    print '\n\nArea interval Finding....'
    print 'area: ', curve.area

    print '\nXC interval Finding....'

    print 'using x3=6.+{} and actual area:'.format(xshift)
    eXc = ini_CV.calc_xc(6. + xshift, curve.area)
    print 'est Xc = ', eXc
    print 'actual Xc = ', curve.Xc
    print 'diff = ', curve.Xc - eXc

    #"""
    #self = ini_CV
    xcini = ia(5., 9.)
    area = ia(71., 73.)
    print '\nNow use ...'
    print 'area = 72., ', xcini, ' Xc = ', ini_CV.calc_xc(xcini, curve.area)
    print 'area = IA(), ', xcini, ' Xc = ', ini_CV.calc_xc(ia(0., 12.), area)

    area = ia(50., 90.)
    print 'area = IA(big), ', xcini, ' Xc = ', ini_CV.calc_xc(xcini, area)
    #"""
    print '\n\n'

    return curve, ini_CV
    def compute_entrance_SAC(self):
        k = SAC.k
        nump = SAC.nump
        nCV = 7
        xb = SAC.xb
        xe = xb + self.Lr
        yb = self.Amax
        ye = 0.
        yap = self.Aap
        Xc = self.Xr
        ab = 0.
        ae = 0.
        ini_v = InitializeControlVertices(xb,
                                          yb,
                                          xe,
                                          ye,
                                          alphae=ae,
                                          alphab=ab,
                                          Cab_given=0.,
                                          Cae_given=0.,
                                          nCV=7,
                                          slope='down')
        curve = spline.Bspline(ini_v.vertices, k, nump)

        interval_data, small = interval_bounds(curve)

        FPD = FormParameterDict(curve)
        #FPD.add_AreaConstraint(kind='equality', value = curve_area)
        FPD.add_AngleConstraint(kind='equality', value=0., location=0.)
        FPD.add_AngleConstraint(kind='equality', value=0., location=1.)
        FPD.add_CurvatureConstraint(kind='equality', value=0., location=0.)
        FPD.add_CurvatureConstraint(kind='equality', value=0., location=1.)
        FPD.add_XcConstraint(kind='equality', value=3.5)
        FPD.add_E1(kind='LS', weight=1.)
        FPD.add_E2(kind='LS', weight=1.)
        FPD.add_E3(kind='LS', weight=1.)
        FPD.add_ArcLengthApprox(kind='LS', weight=1.)
        L = Lagrangian(FPD)

        interval_data, small = lagrangian_bounds(L, interval_data, small, 1.e4)
        Lspline = IntervalLagrangeSpline(curve, L, data=interval_data)

        Lspline.compute_lagrangian()
        Lspline.display(mytitle='SAC_fwd_ini',
                        x_axis_name='x',
                        y_axis_name='z')
        Lspline.optimize()
        Lspline.display(mytitle='SAC_fwd', x_axis_name='x', y_axis_name='z')
        return Lspline
 xe = 12.
 ye = 0.
 alphab = 0.#-5.
 alphae = 0.#-15.
 Cab_given = 0.
 Cae_given = 0.
 xc = 4.
 yc = 4.
 curve_area = 72.#84.#
 slope = 'down'
 
 ae = alphae
 ab = alphab
 
 ini_v = InitializeControlVertices(alphae=ae, alphab=ab,
                                   Cab_given=0.,Cae_given=0.,
                                                       nCV = 7)
 curve = spline.Bspline(ini_v.vertices, k, nump)  
 wi = 3.5 #2.5#
 w  = .5 #.65
 ep = 1.e-10
 sp = 1.e-4
 x = ini_v.vertices[:,0]
 y = ini_v.vertices[:,1]
 interval_data={}
 #interval_data, small = interval_bounds(curve)
 # Max March 2015 ultimate test -Mod used August 2015
 """
 interval_data['xmin'] = [ 0.0,   0.01, 0.1, 0.2, 0.000000001, 0.000000001, 11.999999999 ] 
 interval_data['xmax'] = [ 0.0000000001,   11.9, 11.9, 11.9, 11.99, 11.99, 12.0000000001 ]
 interval_data['ymin'] = [11.9999999999,   0.01, 0.01, 0.0, 0.,0.,0.]# -0.000000001, -0.000000001, -0.000000001  ] #
Beispiel #4
0
        ye = 12.
        alphab = 0.#-5.
        alphae = 0.
        Cab = 0.
        Cae = 0.
        xc = 4.
        yc = 4.
        curve_area = 72.
        slope = 'up'
        
        ae = alphae
        ab = alphab
        
        numcv = 9 #8 #10
        ini_v = InitializeControlVertices(xb,yb,xe,ye,alphae=ae, alphab=ab,
                                          Cab_given=Cab,Cae_given=Cae,
                                           nCV = numcv, slope = 'up')

        
        curve = spline.Bspline(ini_v.vertices, k, nump)  
        curve.plotcurve_detailed()
        curve.plot_area_to_x_shiftaxis(shift_axis=12.)
        box1.plot()
        
        
        
        #intersect c.p.'s
        #
        ilist = []
        i=3
        for j in range(1,4+1):
            xb = 0.
            yb = 5.  #12.
            xe = 5.  #12.
            ye = 0.

            alphae = 0.
            alphab = 0.
            Cab_given = 0.
            Cae_given = 0
            xc = 2.  #4.
            yc = 2.  #4.
            curve_area = 12.  #72.
            slope = 'down'

            ini_v = InitializeControlVertices(alphae=0.,
                                              alphab=0.,
                                              Cab_given=0.,
                                              Cae_given=0.)

            curve = spline.Bspline(ini_v.vertices, k, nump)
            ae = alphae
            ab = alphab

            ini_v = InitializeControlVertices(xb=0.,
                                              yb=5.,
                                              xe=5.,
                                              ye=0.,
                                              alphae=ae,
                                              alphab=ab,
                                              Cab_given=0.,
                                              Cae_given=0.,
                                              nCV=7)