- Oct 27, 2017
There is an identity which relates sin(x) to the magnitude cos(x), but I think it may be almost as expensive to exploit it as to calculate them separately. I've released 'Cheap Sine & Cosine (degrees) (Bhakskara)' which does this, but currently it's a very small thermometer saving over using the individual sine and cosine components.Oh, sweet. That'll definitely help. Thank you. I'm definitely not the best at math, so I don't know, but do you think it might be possible to calculate the cosine of x from the sine of x in a way that's cheaper than calculating it directly from x? Or a way to calculate both at once in a way that's cheaper than calculating them separately?
I also fixed a bug with the sine/cosine/tangent relating to negative angles. A lot of the cost of these components right now comes down to having to handle inputs beyond a certain range (0-180 for sine, -90 to 90 for cosine, 0 to 90 for tangent). I think I might be able to improve this area a bit, but if you knew what the lower/upper limits of your potential inputs were, it might open up more optimisation potential.
Eh, I'd be a bit surprised if this was the reason, but we'll see I guess. I think they'll add it eventually in some form to be honest, too easy/obvious.
Yes, but only if you could cope with having a delay between wanting to read a value and actually reading it, which is probably viable for some cases. I've built a couple of array system in Dreams but have never really battle tested them as I've never actually needed an array. One of them is published 'Scalable Flexible Array System', and the other is more experimental but I think quite a bit cleverer, but not yet published. The principle in both case is that there are physical elements of data and 'heads' which are able to read/write to them. There's an inevitable delay between the moment that you tell the head where to move and the moment that it gives you the value it read (presumably it's just one frame). If that is an acceptable constraint, then this can definitely be done.
If this interests anyone, I could probably publish a lookup table based sin/cos pretty quickly. Would be cheaper than calculating it for sure.