Login  Register

Re: mouse input

Posted by elect on Mar 03, 2016; 11:57am
URL: https://forum.jogamp.org/SOLVED-mouse-input-tp3504609p4036418.html

Calculate the center of gravity

p_c(x, y, z)

in model space and transform it in windows space.

When you select your rectangle, if p_min is your minimum point and p_max the maximum, take one point on the upper line, such as

pUp(p_max.x - p_min.x, p_max.y)

and one point on the lower line, such as

pDown(p_max.x - p_min.x, p_min.y)

and then unproject these two points using the p_c.z coordinate. It'd be like selecting your cylinder at the slice that correspond to its p_c