java - Android OpenGL: Moving the centroid of one object to a specific point on another complex object -


i'm developing medical app involves android opengl data visualization. in app, have complex brain object (with 80000 vertices) , small sphere. i'm trying figure out way can move centroid of sphere 1 of vertices on brain.

the way see it, can broken down 2 problems (both of don't have great solutions to). first problem determining vertex want move sphere to. ideally, great if touch location on brain , select closest vertex way. i've tried converting window coordinates world coordinates using glunproject unsuccessfully. idea had take camera's location, , find closest vertex camera.

the 2nd problem determining how move sphere vertex. part thought had sound logic, isn't working correctly. have sphere's initial position. when user touches brain (for first attempt described earlier) or moves camera (for second attempt described earlier), iterated through vertices of brain, , using distance formula, found vertex minimum distance either touch location or camera. saved vertex , proceeded translate sphere. basically, translation involved taking new vertex, subtracting sphere's current position, , translating sphere amount. i'd save new current position of sphere new vertex's position.

for me, biggest headscratcher sphere doesn't translate points on brain. moves when tell to, , in right direction, it's centroid doesn't sit on of vertices

so in all, these 2 big questions:

  1. for 1st problem, have opinions on might better way of picking vertex (which 1 easier or more efficient?). if thinks 1st way better, there in depth tutorials on parameters of glunproject? i'm having trouble understanding "view" parameter.
  2. for 2nd problem, there wrong logic? once find vertex, perform linear translation on sphere , should move new vertex, correct?

never mind, turns out scale factors lost in code , didn't apply them, points sitting in right places.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -