exploring the Line Fractal
VictK
0:00 / 0:00
exploring the Line Fractal
75 просмотров · 2 нед. назад
VictK
169 подписчиков
75 просмотров · 2 нед. назад
my program
made with c++ and sfml
the function pseudocode (a, b, c, d and maxIteration are the function inputs):
currentAngle = 0
points = {(0, 0), (c, 0)}
for i from 0 to maxIteration {
newPoint = (c, 0) rotated by currentAngle+a
ifIntersect = false
for j from 1 to points.size-1 {
if lines (points[j-1], points[j]) and (points.last, newPoint) intersect {
ifIntersect = true
break
}
}
if not ifIntersect {
currentAngle += a
points.push(newPoint)
continue
}
newPoint = (d, 0) rotated by currentAngle+b
for j from 1 to points.size-1 {
if lines (points[j-1], points[j]) and (points.last, newPoint) intersect {
return i
}
}
currentAngle += b
points.push(newPoint)
continue
}
return -1
the function is then applied to every pixel with inputs (based on pixel.x, based on pixel.y, 1, 1, iteration number)