Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Polar spherical compression algorithm

Author
Message
Programmer X
18
Years of Service
User Offline
Joined: 14th Nov 2007
Location:
Posted: 8th Feb 2014 23:33
The idea is to compress using the floor of the simple polar helix function and the z value to represent all the points inside and on a sphere from [256,-256]. Unfortunately it doesn't work. any advice? Code is attached.

XXX
Programmer X
18
Years of Service
User Offline
Joined: 14th Nov 2007
Location:
Posted: 8th Feb 2014 23:38
Basically a helix in Polar coordinates from the center of the intersection of a plane and sphere.

XXX
Programmer X
18
Years of Service
User Offline
Joined: 14th Nov 2007
Location:
Posted: 9th Feb 2014 05:45
I made some progress and now it works for 1-~8 but not for higher values any insight

XXX
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 9th Feb 2014 21:12
I'd pretend this isn't way over my head if I thought I stood a chance of sounding believable
Good luck, and I hope someone who knows more than me can help
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 11th Feb 2014 16:19
Maybe a graphical representation would help? I understand helix, polar co-ordinate and sphere/plane intersection but I'm afraid I'm not quite certain what it is you're trying to achieve. Admittedly, my maths A-Level feels like an eternity ago now though, so it may just be my lack of understanding rather than wording but I'll help if I can!

On a side-note, it may just be how it opened for me from the RTF, but a little indenting may help. I'll tidy it up a bit and see if I can work out what you're going for from that in case a graphical representation isn't possible.


Previously TEH_CODERER.
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 11th Feb 2014 19:19 Edited at: 11th Feb 2014 19:20
Well, I've taken a look at the code now. Beyond the complete lack of formatting, there seems to be quite a lack of consistency in terms of casing. I can't remember if DBPro is case-sensitive with variable names or not. If it is then your code definitely won't do as you expect as you would be basically referencing an new uninitialised variable each time you change the casing you reference it by and hence getting a 0 value. For example, your code has "reducerB" and "reducerb".

You also seem to be declaring a lot of "contants", by which I don't mean that you are using the "#constant" syntax but that you have hard-coded numeric values which without descriptions mean nothing to me really. The only one you have given a name to is misleading because you've defined "pi" as "576" which again doesn't make much sense.

In case someone else is willing to take a look, I've tried to format and standardise the casing as much as I could without spending too long on this and have put it in code tags below for people that can't be bothered to download an RTF file just to look at some code (understandably).



If you're able to give more description or a graphical representation then I'll take a look for you again but I'm afraid I'm a bit lost from the wording and code example given so far.

P.S - Just for reference, the current output of the code is:
3200
124
124
3200
3
3
128

[Edit] Setting language of code tag. [/Edit]


Previously TEH_CODERER.

Login to post a reply

Server time is: 2026-07-07 06:24:09
Your offset time is: 2026-07-07 06:24:09