Created
December 10, 2023 15:15
-
-
Save RichardEllicott/48d91dca344c57aae7a1a8875e066c25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## using chat gp, asked for python (this gives an egg shape wtf?) | |
## https://chat.openai.com/c/0269574d-acb5-4f88-ac65-0a2c27e016df | |
static func get_keppler_position(semi_major_axis: float = 8.0, eccentricity: float = 0.9, theta: float = 0.0) -> Vector3: | |
var semi_minor_axis: float = semi_major_axis * sqrt(1.0 - eccentricity**2) # Calculate the semi-minor axis | |
var pos: Vector3 = Vector3(semi_major_axis * cos(theta), 0.0, semi_minor_axis * sin(theta)) | |
var rotation_angle = atan2(pos.z, pos.x) | |
## this but from chat gp, it doesn't seem a pure rotation, it seems to transform the parametric to keppler | |
pos = Vector3( | |
pos.x * cos(rotation_angle) - pos.z * sin(rotation_angle), | |
0.0, | |
pos.x * sin(rotation_angle) + pos.z * cos(rotation_angle) | |
) | |
return pos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment