clamp mouse coords to simple jit.gen snorm circle

Dante's icon

Hello I am trying to have mouse coordinates only go as far as a simple snorm circle via jit.gen. So I've created a mask, but can't seem to figure out how to clip the x,y coordinates. So the mouse coords are restricted to the white area of the mask.

SnormMousePos.maxpat
Max Patch

Rob Ramirez's icon

i'm not quite clear on what your end goal is. can you restate?

Dante's icon

I am using coordinates to control some particles. I would like the particles to be limited to the ellipse shape I have created in jit.gen, but this was turning into a shader thing(and was too complicated for me to accomplish) So I thought I could just create a simple ellipse mask, but what I am tracking is close to the edges of the frame so I was trying to keep the tracking coordinate inside the ellipse.

I though I could do this is in gen by putting the coords in a matrix and cliping or sampling the mask, but wasn't having luck. I then heard that this could be accomplished with cartopol or by again by shaders.

While I work out the basics I am using mouse coordinates from jit.world, but I intend to use CV or color tracking in the end.

Dante's icon

sorry heres a patch updated, using cartopol in gen. This is as close as I've got.

SnormMousePos.maxpat
Max Patch