# Need help/hint on mouse position with rotated objects

**URL:** <https://discourse.processing.org/t/need-help-hint-on-mouse-position-with-rotated-objects/22243>\
**Category:** Coding Questions\
**Created:** [June 29, 2020, 10:36am UTC](https://discourse.processing.org/t/need-help-hint-on-mouse-position-with-rotated-objects/22243 "2020-06-29T10:36:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cillo](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Cillo](https://discourse.processing.org/u/Cillo)\
**Post date:** [June 29, 2020, 10:36am UTC](https://discourse.processing.org/t/need-help-hint-on-mouse-position-with-rotated-objects/22243/1 "2020-06-29T10:36:57Z")

</div>

Hello, I’m trying to make a visualization of tracks in my spotify playlists. The goal I’m trying to reach is doing a sort of radial column chart with the 100 songs of my playlists, with lengths based on track duration. In addition, i would like to have information displayed when i press on a particular column corresponding to that track. Here is my problem, I dont understand if it’s possible or how to relate the mouse position and the rotation.

The following code results in what i try to visualize:

> pushMatrix();  
> translate(500, height/2);  
> for (int i = 0; i \< tracks\_2017.size(); i++){  
> rotate(radians(3.6));  
> rect(0, -150, 10, -tracks\_2017.get(i).duration/1400);  
> }  
> popMatrix();

And this is the result: [https://i.imgur.com/XN7Bxqe.png](https://i.imgur.com/XN7Bxqe.png)

> if (mouseX \> 500 && mouseX \< 510 && mouseY \< height/2 -150 && mouseY \> height/2 - tracks\_2017.get(i).duration/1400 && mousePressed == true)

This is what I use usually to check position on not rotated items, and don’t know how to relate it with rotations. Thanks for the eventual replies.
