Jump to content

Function Call in Array?


Adam Ferestad

Recommended Posts

Here is a what I am trying to do:

float sumPow(int nbhd[]; float powerX; float powerY; float powerZ) {
        sum = 0;
        for(int i=0; i<len(nbhd); i+=1) {
                vector P = point(0, "P", nbhd[i]);
                sum += pow(P[0], powerx)*pow(P[1], powerY)*pow(P[2], powerZ);
        }
        return sum;
}

void calcParaboloid(point pt) {
        int nbhd[] = point(0, "nbhd", pt);
        float row1[] = {sumPow(nbhd, 4, 0, 0), sumPow(nbhd, 3, 1, 0), sumPow(nbhd, 2, 2, 0), sumPow(nbhd, 3, 0, 0), sumPow(nbhd, 2, 1, 0), sumPow(nbhd, 2, 0, 0)};
        float A[] = {
                   {sumPow(nbhd, 4, 0, 0), sumPow(nbhd, 3, 1, 0), sumPow(nbhd, 2, 2, 0), sumPow(nbhd, 3, 0, 0), sumPow(nbhd, 2, 1, 0), sumPow(nbhd, 2, 0, 0)},
                   {sumPow(nbhd, 3, 1, 0), sumPow(nbhd, 2, 2, 0), sumPow(nbhd, 1, 3, 0), sumPow(nbhd, 2, 1, 0), sumPow(nbhd, 1, 2, 0), sumPow(nbhd, 1, 1, 0)},
                   {sumPow(nbhd, 2, 2, 0), sumPow(nbhd, 1, 3, 0), sumPow(nbhd, 0, 4, 0), sumPow(nbhd, 1, 2, 0), sumPow(nbhd, 0, 3, 0), sumPow(nbhd, 0, 2, 0)},
                   {sumPow(nbhd, 3, 0, 0), sumPow(nbhd, 2, 1, 0), sumPow(nbhd, 1, 2, 0), sumPow(nbhd, 2, 0, 0), sumPow(nbhd, 1, 1, 0), sumPow(nbhd, 1, 0, 0)},
                   {sumPow(nbhd, 2, 1, 0), sumPow(nbhd, 1, 2, 0), sumPow(nbhd, 0, 3, 0), sumPow(nbhd, 1, 1, 0), sumPow(nbhd, 0, 2, 0), sumPow(nbhd, 0, 1, 0)},
                   {sumPow(nbhd, 2, 0, 0), sumPow(nbhd, 1, 1, 0), sumPow(nbhd, 0, 2, 0), sumPow(nbhd, 1, 0, 0), sumPow(nbhd, 0, 1, 0), sumPow(nbhd, 0, 0, 0)}
                  };
}

Which for all I can tell, it SHOULD work, but I am getting an "unexpected identifier" error on the first function call of either row1[] or A[].  What is going on here?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...