X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10 Nov 2017 03:02 PM by  Ben Castellani
vector routine doesn't work
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Gamaliel Isaac



New Member


Posts:1
New Member


--
08 Nov 2017 11:40 AM
    Here is the program. Is there an error in the program or is it a bug. Each of the 2 vectors should be 1 in length and the second vector should originate at 2,2.

    pro displayVectorField

    xres = 4
    yres = 4

    dx = fltarr(xres,yres)
    dy = fltarr(xres,yres)

    dx[0,0] = 1
    dy[0,0] = 1
    dx[2,2] = 1
    dy[2,2] = 1

    v = vector(dx,dy,XRANGE=[0,4],YRANGE=[0,4],/OVERPLOT)

    end

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    10 Nov 2017 03:02 PM
    The VECTOR function is behaving as expected in this instance. Check out the DATA_LOCATION property of the VECTOR function. This defaults to 1, which centers the vector about your specified location. If you want the tail of the vector to begin at your location, set DATA_LOCATION to 0.

    v = vector(dx,dy,XRANGE=[0,4],YRANGE=[0,4],/OVERPLOT,DATA_LOCATION=0)

    Note: The units for the U and V components are arbitrary, and are not related to the units of the X and Y coordinates. The VECTOR function will compute a default length scale and head size based upon the overall number of vectors and the average magnitude of the vectors. The LENGTH_SCALE and HEAD_SCALE properties may be used to change the default size.

    If you need the vectors to have representative length, try the ARROW function --> http://www.harrisgeospatial.com/docs/ARROW.html
    You are not authorized to post a reply.