0

I am trying to render an image with return values from an attractor calculation and need to map the output to the screen.

a and b values are generated randomly between -3 and 3

c and d values are generated randomly between -.5 and 1.5

Then the X and Y coordinates are set using

self.xCoord = sin(self.yCoord * b) + c * sin(self.xCoord * b);
self.yCoord = sin(self.xCoord * a) + d * sin(self.yCoord * a);

The x and y coordinates always returning as decimal numbers and I am not sure what range is outputted from the formula.

I need to convert the number to the screen range so I can draw it.

Is there a way to calculate a range for a formula?

some_id
  • 371

1 Answers1

1

The range for $\sin x$ is $$-1\le\sin \theta\le1$$ So $$-c\le c\sin\theta\le c$$ $$-d\le d\sin\theta\le d$$ Therefore $$1-c\le \sin \phi+c\sin \theta\le 1+c$$ $$1-d\le \sin \phi+d\sin \theta\le 1+d$$

E.O.
  • 6,942