Adam Ferestad Posted April 4, 2016 Share Posted April 4, 2016 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? Quote Link to comment Share on other sites More sharing options...
f1480187 Posted April 4, 2016 Share Posted April 4, 2016 Only constants allowed in curly-braced constructors, use array() and set() functions for arrays and vector types. Multidimensional arrays (A[]) are not supported by VEX, so, you need to manage code differently. Also variable sum undeclared. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.