These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
Previous page123
 

Devsite Blog: Adding Bookmarks to the API

First post
Author
CCP Tellus
C C P
C C P Alliance
#41 - 2015-10-16 13:15:44 UTC
Captain Thunk wrote:
This is not working as expected.

Oh my, you're right! Here's the corrected implementation:

import math
import random

def warpin(id, x, y, z, r):
    j = (random.Random(id).random() - 1.0) / 3.0
    t = math.asin(x/abs(x) * (z/math.sqrt(x**2 + z**2))) + j
    s = 20.0 * (1.0/40.0 * (10 * math.log10(r/10**6) - 39))**20.0 + 1.0/2.0
    s = max(0.5, min(s, 10.5))
    d = r*(s + 1) + 1000000

    return (x + d * math.sin(t), y + 1.0/2.0 * r * math.sin(j), z - d * math.cos(t))


Note that x, y, z, and r need to be floats and not integers when passed into that function.
Captain Thunk
Explode. Now. Please.
Alliance. Now. Please.
#42 - 2015-10-16 13:22:39 UTC
Ahh yes, Python isn't my native language.

You truly are awesome, it wouldn't have been unreasonable to assume it could be days or weeks for a reply, yet you've delivered in mere minutes.

Thanks a lot.


CCP #1
Previous page123