03-19-2024, 09:10 PM
Code: (Select All)
Screen _NewImage(1000, 1000, 32)
cx = 500 'center x and center y
cy = 500
m = 200 'X radius
n = 100 'y radius
Dim col As _Unsigned Long
For oy = 250 To 750 'ox, oy points in rectangle. If the point is part of an ellipse, it will be white, otherwise it will be black
For ox = 250 To 750
aa = ((ox - cx) ^ 2) / m ^ 2
bb = ((oy - cy) ^ 2) / n ^ 2
If aa + bb < 1 Then col = _RGB32(255) Else col = _RGB32(0)
PSet (ox, oy), col
Next
Next
I often use point detection in a circle, this can easily be modified to detect a point in an ellipse. Maybe it will be useful for someone.