"Value" of undefined point?

steponic shared this question 4 years ago
Answered

I've got students moving two segments around and I want to know when the segments intersect and when they do not. I've defined a point at the intersection of the two segments as N. When the segments intersect, I N gives me the coordinates of the intersection point. When they don't intersect, the point N is "undefined." All that is great!


I need to know when N is undefined, using a boolean variable Intersect. I tried something like If(N==?, SetValue(Intersect,false),SetValue(Intersect,true)). Didn't work. Neither did N==(?,?) or N==undefined.


Any suggestions? How do I "read" when a point is undefined?


Thanks!

Comments (3)

photo
2

The test N == N gives true when N is defined and undefined when it is not defined.chris

photo
2

Alternative: maybe you you want use the command

IsDefined(<object>) (the result is a boolean)

see attachment

PS:

for me and maybe only for me is <object> == <object> exotic/intransparent, and very near to a bug.

photo
1

Thank you, both! Works fine now.

© 2023 International GeoGebra Institute