Jump to content

[noob vex] how to access single component of matrix3?


haveahapyday

Recommended Posts

correct me if i shouldn't be doing things this way, but basically in a wrangle sop rather than creating a bunch of separate control channels, i want to make one matrix3 and then access the individual components.

here's a couple ways i've tried:

matrix3 testMatrix = ch3("testMatrix");

f@testValA = testMatrix[0][0];
f@testValB = getcomp(testMatrix, 0, 0);
f@testValC = testMatrix[0:0];

i apologize if this is beyond n00b, but i've tried over an hour to figure this out and got no where.

thanks!

Edited by haveahapyday
fixed code example
Link to comment
Share on other sites

well your matrix is called testMatrix but you ask for indices or getcomp() of something called limits

getcomp() works just fine and from the docs "The square-brackets operator also works on vectors. You can use it with matrices as well using a pair of brackets: float a = m3[0][1];" (couldnt make it work in 16.5, maybe new feature in 17)

Edited by 3dome
Link to comment
Share on other sites

7 hours ago, 3dome said:

well your matrix is called testMatrix but you ask for indices or getcomp() of something called limits

whoops, was confusing the example i wrote up with what i was actually using. edited the original post to make the example accurate.

7 hours ago, 3dome said:

getcomp() works just fine and from the docs "The square-brackets operator also works on vectors. You can use it with matrices as well using a pair of brackets: float a = m3[0][1];" (couldnt make it work in 16.5, maybe new feature in 17)

i was using H16 at home when i was trying that so maybe that could be the issue? getcomp() works in V17, but float testValA = testMatrix[0][0]; throws this error:

"Call to undefined array index operator 'matrix3[int]', returning one of vector4, vector2, vector, float[], int[], vector4[] or vector[]."

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...