Thursday, November 23, 2023

Visualizing Precession in Schwarzschild Spacetime in AutoCAD

 

A Thanksgiving treat

 EinsteinPy source

 

import PyRx as Rx
import PyGe as Ge
import PyGi as Gi
import PyDb as Db
import PyAp as Ap
import PyEd as Ed
import traceback
 
import numpy as np
from einsteinpy.geodesic import Timelike
 
def PyRxCmd_doit():
    try:
        position = [40., np.pi / 2, 0.]
        momentum = [0., 0., 3.83405]
        a = 0.
        steps = 5500
        delta = 1.
       
        geod = Timelike(
            metric="Schwarzschild",
            metric_params=(a,),
            position=position,
            momentum=momentum,
            steps=steps,
            delta=delta,
            return_cartesian=True)
       
        db = Db.curDb()
        model = Db.BlockTableRecord(db.modelSpaceId(), Db.OpenMode.kForWrite)

        for pm in geod.trajectory[1]:
            p = Db.Point(Ge.Point3d(pm[1],pm[2],0))
            model.appendAcDbEntity(p)
           
    except Exception as err:
        traceback.print_exception(err)

 


No comments:

Post a Comment

TraceBoundary sample in Python for AutoCAD

    import traceback from pyrx_imp import Rx from pyrx_imp import Ge from pyrx_imp import Gi from pyrx_imp import Db from pyrx_imp...