How to access the 2nd dimension

Discussion in 'Questions (Windows Mobile)' started by hung, Aug 14, 2007.

  1. hung

    hung Member Licensed User

    I have declare array as below:

    dim type (x, y) shape(1000, 500)
    first dimension is points in a polygon shape, e.g. shape(0, 1) to shape(1000,1) , that I use to draw polygon. shape(0, 2) to shape(1000,2) refers to another polygon.

    when draw polygon, I use the code below:

    for jj = 0 to cntshape - 1
    for ii = 0 to cntpt(jj) - 1
    ptstmp(ii).x = shape(ii, jj).x
    ptstmp(ii).y = shape(ii, jj).y
    form1.polygon(ptstmp(), 0, cntpt(jj) - 1, cBlack, F)

    I found that in PPC, the above for ii loop takes time (i.e. slow as one second when draw over 10 shapes).

    If I can refer to one of the dimension I should be able to avoid the for ii loop.
    form1.polygon(shape(,jj), 0, cntpt(jj) -1 , cBlack, F)

    Or any other way to do so?
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can't "take" a part of a multi dimension array.
    You should try to use a one dimension array from the start, or use ArrayLists instead.
    This feature will be available in a future update (version 6.00).
  3. hung

    hung Member Licensed User

    Thanks :)

    I am planning to keep a series of shapes that each shape is a series of points.

    I can not define like

    dim type (x, y) pts(500)
    dim shape(1000) as pts

    So I have to two dimensions array.

    It would be great if the version 6.0 allows variable decaration using self defined type like pts (points).
  4. Erel

    Erel Administrator Staff Member Licensed User

    You could define:
    Dim Type(x,y) pts(500000)
    And now store the shapes in one sequence and draw each shape with something like:
    Form1.Polygon(pst(),ShapeNumber * 1000,LengthOfShape,...)
    That way there is no need to copy the points each time.
  5. hung

    hung Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice