# Cycylic equal

the “=” node need a cyclic pin, to check if rotations are (almost) equal. otherwise a rotation of 0.9999 can not be compared to a rotation of 0.0001 and be declared equal.

eno.

hi eno, to do this with current version, you have to transform the values into a cyclic space with circular spread or another sine or cosine function, then compare the ouput of the function with = …

CyclicCompare.v4p (5.1 kB)

sorrily there is an error in this patch: e.g. 0.5 = 0.
and i believe the circularspread is not the right metaphor for this problem, because it translates one real number into a point in two dimensional space.
however we don’t need to compare the positions of two points on a circle, we just need to compare the two angles (with 360°=0°).

since in vvvv angles go from 0 to 1, i would rather use two frac nodes and compare the real parts of the two rotations.

if you want to bring values into cyclic spaces other than [0…1[ , you might use mod nodes instead of the frac. then you can enter the modulus or size of one cycle…

maybe we just need another operator node like ≡, where ≡ means congruent with respect to the modulus.

(or this cyclic pin could be invisible at first. hm. possible)

have fun!
gregsn

math:

ok, i c…

but modular arithmetic cant help here because its not a continous function…

so you have to compare both outputs of the CircularSpread:

CyclicCompareFixed.v4p (9.5 kB)

tank you tonfilm,
this kind of works … although its still not a very elegant way of detecting, if a point comes close to a second one on a sphere surface.
and some points can be reached with different combinations of rotations. but it limits the collissions a bit.

and gregor, i didnt get your ide comparing angles. you just transfer the problem to a different spot …

thanks anyways, guys,
eno.

in 3d case, replace CircularSpread with Cartesian(3d)…

jetzt hab ichs schon zweimal geschrieben. so ein schmarrn. irgendwie funktioniert das posten nicht. arggh

hi! soooorry, yes i missed this epsilon issue.
posted two other solutions for initial problem. (cyclic =)

however if you want to compare distances of 2 points on a sphere it is better to measure distance in 3d, because longitude degrees are appoaching at hte poles and because of this a comparison of longitude angles will always behave different depending on their latidude.

however making use of quaternions could be another solution.

cyclicEQ.v4p (15.0 kB)