Skip to content

Determining the distance of near earth asteroid 2023 TL4 – Part 2

(Continued from Determining the distance of near earth asteroid 2023 TL4 with python – Part 1.)

There’s nothing better than a nice diagram, graph, or chart to make something abstract into something tangible.

Using the amazing spacekit.js library, we can supply the orbital parameters of 2023 TL4 and produce a gorgeous 3D visualization.

Below is a 3D visualization of 2023 TL4‘s most recent close approach to Earth. The view is centered on Earth, and you can also see the orbit of Earth’s moon. The scene starts on 2023-10-06, two days before the asteroid 2023 TL4 was first detected. Earth is approximately to scale, however 2023 TL4 has been enlarged to make it easier to see. Both Earth and 2023 TL4 are labeled.

You can zoom out or in, and drag to rotate the camera position. Try dragging the sun into view! Once you’re ready, hit the start button to start the simulation. Let the time run until the date of first detection: 2023-10-08.


?

There you can see that by the time we detected it, 2023 TL4 had already crossed Earth’s orbital path!

In order to generate this simulation, we just need a bit of javascript. We can use the same orbital parameters from Part 1 to generate the orbit of 2023 TL4. spacekit.js comes with all the planets and many other astronomical objects out of the box, so you can construct a toy model of the solar system in a few dozen lines of code:

ASTEROID_ORBIT_COLOR = 0x551122;
JD_START = 2460224.0;

const viz = new Spacekit.Simulation(document.getElementById('main-container'), {
    basePath: 'https://typpo.github.io/spacekit/src',
    startDate: new Date(2019, 5, 21),
    startPaused: true,
    unitsPerAu: 20.0,
    jd: JD_START,
    jdPerSecond: 0.1,
    camera: {
        enableDrift: false,
    }
});

viz.createStars(); // extra stars
// Create a skybox using NASA TYCHO artwork.
viz.createSkybox(Spacekit.SkyboxPresets.NASA_TYCHO);

// Create our first object - the sun - using a preset space object.
viz.createObject('Sun', Spacekit.SpaceObjectPresets.SUN);

// Then add some planets
viz.createObject('Mercury', Spacekit.SpaceObjectPresets.MERCURY);
viz.createObject('Venus', Spacekit.SpaceObjectPresets.VENUS);
viz.createObject('Mars', Spacekit.SpaceObjectPresets.MARS);
viz.createObject('Jupiter', Spacekit.SpaceObjectPresets.JUPITER);
viz.createObject('Saturn', Spacekit.SpaceObjectPresets.SATURN);
viz.createObject('Uranus', Spacekit.SpaceObjectPresets.URANUS);
viz.createObject('Neptune', Spacekit.SpaceObjectPresets.NEPTUNE);

const earth = viz.createSphere('Earth', {
    textureUrl: '/wp-content/uploads/2023/12/earthtexture.jpg',
    radius: 6371 / 149598000, // radius in AU, so earth is shown to scale
    ephem: Spacekit.EphemPresets.EARTH,
    labelText: 'Earth',
    levelsOfDetail: [
        {
            radii: 0,
            segments: 64,
        },
        {
            radii: 30,
            segments: 16,
        },
        {
            radii: 60,
            segments: 8,
        },
    ],
    atmosphere: {
        enable: true,
    },
    rotation: {
        enable: true,
        lambdaDeg: 50,
        betaDeg: -63,
        period: 3.755067,
        yorp: 1.9e-8,
        phi0: 0,
        jd0: 2443568.0,
        speed: 1,
    },
});

// Create moon
const moon = viz.createObject('Moon', Spacekit.SpaceObjectPresets.MOON);
moon.orbitAround(earth);

// asteroid 2023 TL4
epoch = 2460259.5
eccentricity = 0.5795825434948032
ascending_node_longitude = 195.7564128248424
argument_of_periapsis = 89.13293422634766
inclination = 60.70358147359373
semi_major_axis = 1.485437733232063
mean_anomaly_at_epoch = 46.76301872793557
const ephem = new Spacekit.Ephem(
    {
        epoch: epoch,  // Epoch
        a: semi_major_axis,  // Semi-major axis
        e: eccentricity, // Eccentricity
        i: inclination,  // Inclination
        om: ascending_node_longitude, // Longitude of the Ascending Node
        w: argument_of_periapsis,  // Argument of Perifocus
        ma: mean_anomaly_at_epoch,  // Mean Anomaly
    },
    'deg',
);
const orb = new Spacekit.Orbit(ephem);
const asteroid = viz.createShape('2023 TL4', {
    ephem,
    ecliptic: {
        displayLines: true,
        lineColor: ASTEROID_ORBIT_COLOR,
    },
    labelText: '2023 TL4',
    shape: {
        // (85990) 1999 JV6 – Model 4390 (similar size)
        // https://astro.troja.mff.cuni.cz/projects/damit/asteroid_models/view/4390
        shapeUrl: '/wp-content/uploads/2023/12/shape.obj',
    },
    rotation: {
        lambdaDeg: 251,
        betaDeg: -63,
        period: 3.755067,
        yorp: 1.9e-8,
        phi0: 0,
        jd0: 2443568.0,
    },
    debug: {
        // showAxes: true,
    },
});

// Get the Spacekit version of THREE.js.
const THREE = Spacekit.THREE;

// Set up camera
const astpos = orb.getPositionAtTime(JD_START);
const earthpos = earth.getOrbit().getPositionAtTime(JD_START);
viz.getViewer().get3jsCameraControls().target = new THREE.Vector3(
    astpos[0] - 19.8,
    astpos[1] - 18,
    astpos[2] + 3.7,
);
viz.getViewer().get3jsCameraControls().rotation = -1.0 * Math.PI;
// Set up button event listeners
document.getElementById('btn-start').onclick = function () {
    viz.start();
};
document.getElementById('btn-stop').onclick = function () {
    viz.stop();
};
document.getElementById('btn-set-time').onclick = function () {
    // viz.setDate(new Date(prompt('Enter a date (YYYY-mm-dd)')));
    viz.setDate(new Date(2023, 10, 6));
};

document.getElementById('btn-faster').onclick = function () {
    viz.setJdDelta(viz.getJdDelta() * 1.5);
};

document.getElementById('btn-slower').onclick = function () {
    viz.setJdDelta(viz.getJdDelta() * 0.5);
};

const dateElt = document.getElementById('current-date');
viz.onTick = function () {
    const d = viz.getDate();
    dateElt.innerHTML = d.toLocaleString();
};

asteroid.initRotation();
asteroid.startRotation();

// Add some light.
viz.createLight([0, 0, 0]);
viz.createAmbientLight();

viz.getViewer().followObject(earth, [-0.01, -0.01, 0.01]);

You can also see the code by inspecting this page’s source code.

Conclusion

Although this is not a scientifically-precise visualization of 2023 TL4, it still gives us a sense of its orbit and its position upon detection. It’s fascinating to think that we’re in this cosmic shooting gallery and we’re still struggling to come to terms with and deal with that fact. We’ve come a long way and have many people working on detecting and studying these objects, but obviously there still remains more work to do.

Published inScience

One Comment

Leave a Reply