Notifications
Clear all

To all SSC Station occupants

Thank you for the donations over the past year (2024), it is much appreciated. I am still trying to figure out how to migrate the forums to another community software (probably phpbb) but in the meantime I have updated the forum software to the latest version. SSC has been around a while so their is some very long time members here still using the site, thanks for making SSC home and sorry I haven't been as vocal as I should be in the forums I will try to improve my posting frequency.

Thank you again to all of the members that do take the time to donate a little, it helps keep this station functioning on the outer reaches of space.

-D1-

How does this calculation work?

(@fluffyfreak)
Noble Member

Can someone explain to me what these line is doing?

Quote:
m_humanProx = fixed(3,1) / isqrt(9 + 10*(m_path.sectorX*m_path.sectorX + m_path.sectorY*m_path.sectorY + m_path.sectorZ*m_path.sectorZ));

I see a distance calculation, that is then mul'd by 10 and the result has 9 added, before we find the square root... so that looks a bit like a distance calculation with some kind of scaling???

Then we divide by fixed(3,1) which appears to be another arbitrary huge value in integer terms but the divide might not be doing a straight integer div, in fact I think it's doing it in fixed terms.

Quote
Topic starter Posted : November 13, 2011 09:47
(@unclebob)
Estimable Member

Some more of Brianetta's fearfully crazy math, maybe? 😆

ReplyQuote
Posted : November 13, 2011 10:08
(@s2odan)
Noble Member

Hey,

It looks to be: 3 / sqrt(9+10 *(x^2+y^2+z^2))

so for sector 1,1,1:

3/ (isqrt(9+10*(1+1+1)) = 3/isqrt(39) = 3/6 = fixed(1,2) or 0.5

So... that gives a number from 1.0 down to something really small depending on how far away you are from Earth.

the 9 is so that sector 0,0,0 provides a 1.0 value for human proximity. Sqrt of 9 is.. 🙂

Unless I'm mistaken the use of fixed() is to ensure different platforms always arrive at the same result, its used a lot in galaxy generation to ensure each system is identical on every platform.

ReplyQuote
Posted : November 13, 2011 12:58
(@fluffyfreak)
Noble Member

Cheers dan 🙂

my hangover maths isn't what it used to be!

ReplyQuote
Topic starter Posted : November 13, 2011 13:53
(@brianetta)
Prominent Member
UncleBob wrote:
Some more of Brianetta's fearfully crazy math, maybe? 😆

It's actually related (-:

ReplyQuote
Posted : November 14, 2011 00:25
(@s2odan)
Noble Member
fluffyfreak wrote:
Cheers dan 🙂

my hangover maths isn't what it used to be!

hehe, yw 🙂

Quote:

Some more of Brianetta's fearfully crazy math, maybe? 😆

Tomm's, he wrote the 3d galaxy.

ReplyQuote
Posted : November 14, 2011 08:16
 robn
(@robn)
Noble Member
s2odan wrote:

Quote:

Some more of Brianetta's fearfully crazy math, maybe? 😆

Tomm's, he wrote the 3d galaxy.

Actually that's ancient sysgen code, but Tomm did write that too 🙂

ReplyQuote
Posted : November 14, 2011 10:46