circle point coordinates based on distance/direction

good evening,
I have a circle SOP. I want to convert an x/y point coordinate within the circle area to a coordinate system based on 2 factors: distance from circle center(0,0) and angle of the line from center to the first point. I did a lot of forum and web research and I think I need something equivalent to atan2 ? How would I go about this?
Basically I want to assign areas of my circle to trigger things when an object ‘rolls over’ said area, and it seems like a coordinate system based on distance/direction from center is the way to go. any help much obliged.

cod

Sounds like you’re looking for the Object CHOP.

If you make a point in the center of your circle you can use that (use SOP to CHOP) as the ref point for the Object CHOP. You can use it to calculate distance and bearing angle but it sounds like all you really need is distance.

Then you could use a logic chop to trigger when the distance is below a certain threshold.

-Matt

1 Like

Bam!
Thank you sir

I actually do need BEARING as well … Not really understanding the concept of it though… would lke to have bearing translated into a 0-360 degree value. The wiki mentions something about transform CHOP in conjunction with Object Chop, but I dont quite get it… so much to learn , so little time …

in other words: how do I translate bearing into ‘absolute’ direction ?

Ive included a small example that takes the position of two objects and calculates their
distance and angle. (assuming one is at the center of a circle, the other is rotating at 1 unit away, but any two values will work).

I use the Object CHOP just to get the relative position between the two.
(This creates tx,ty,tz channels)

To get their length: just use ‘length’ on the Math CHOP
To get a 0-360 angle, use ‘atan2’ in the Function CHOP
(see attached)

Find this simpler than the Bearing functions in the Object CHOP.

Cheers.
Rob
length_and_angle.tox (1.1 KB)

1 Like

thank Rob, that was very simple and I learned a bit about functionCHOP at the same time

Threadnecro, but thanks for posting the example files, it helped with a project I’m working on now. :sunglasses: