Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ugh. Is my math (and logic) right?
#12
"Problem solved with a little security (last two lines added to bLine):"

I think if you subst in the first and last i to the pset values you will see the first and last point on line are already covered. Also if you want lines with transparencies doubling on first and last will show the color more like doing a circle fill with circles using alpha colors.

Try the 2 versions using alpha and see.
```Screen _NewImage(800, 600, 32)
Color &H30FFFFFF
For x = 1 To 20
cLine x + 100, 10, x + 100, 500
bLine x + 200, 10, x + 200, 500
Next

Sub cLine (x1, y1, x2, y2)
dx = x2 - x1
dy = y2 - y1
dist = Sqr(dx * dx + dy * dy)
dx = dx / dist
dy = dy / dist
For i = 0 To dist
PSet (x1 + dx * i, y1 + dy * i)
Next
PSet (x1, y1)
PSet (x2, y2)
End Sub

Sub bLine (x1, y1, x2, y2)
dx = x2 - x1
dy = y2 - y1
dist = Sqr(dx * dx + dy * dy)
dx = dx / dist
dy = dy / dist
For i = 0 To dist
PSet (x1 + dx * i, y1 + dy * i)
Next
End Sub
```
b = b + ...
Reply


Messages In This Thread
Ugh. Is my math (and logic) right? - by CharlieJV - 08-29-2023, 12:47 AM
RE: Ugh. Is my math (and logic) right? - by bplus - 08-29-2023, 01:12 AM
RE: Ugh. Is my math (and logic) right? - by bplus - 08-29-2023, 02:00 AM
RE: Ugh. Is my math (and logic) right? - by bplus - 08-29-2023, 12:26 PM



Users browsing this thread: 3 Guest(s)