Page 4 of 4

Re: Boolean function for intersection between circular segment and circle

Posted: Sun Aug 15, 2021 2:51 pm
by Ref
Hi pgimeno!
Sorry for late reply but have suffered a major power outage.
Discovered that the edge case failures in my code was related to " relational operator" failure.
When determining if circle was within radius of sector, the conditional statement occasional fails.

dis = distance of circle circle to center of arc => using sqrt distance calculation
lng = radius of segment
rad = radius of circle
condition: dis < (lng + rad)
test: print( dis, lng, rad, dis<(lng+rad) )
failure prints: "260,250,10,true"
If I round the distance (math.round(dis,3), I don't get the failure.
?

Re: Boolean function for intersection between circular segment and circle

Posted: Mon Aug 16, 2021 8:49 pm
by pgimeno
Ref wrote: Sun Aug 15, 2021 2:51 pm Hi pgimeno!
Sorry for late reply but have suffered a major power outage.
Discovered that the edge case failures in my code was related to " relational operator" failure.
When determining if circle was within radius of sector, the conditional statement occasional fails.

dis = distance of circle circle to center of arc => using sqrt distance calculation
lng = radius of segment
rad = radius of circle
condition: dis < (lng + rad)
test: print( dis, lng, rad, dis<(lng+rad) )
failure prints: "260,250,10,true"
If I round the distance (math.round(dis,3), I don't get the failure.
?
Uh? Can you give a complete function? Also, math.round is not standard lua, so please include it as well.

But my understanding is that the failures have to do with the angle comparisons, not with the distance comparisons.

Re: Boolean function for intersection between circular segment and circle

Posted: Wed Aug 25, 2021 9:38 pm
by Gunroar:Cannon()
pgimeno wrote: Wed Aug 11, 2021 5:49 pm edit: nvm, too off-topic
Oh, no!! I missed this. My OCD :?