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 Godot; | |
using System; | |
// try this: | |
// https://graphics.stanford.edu/~mdfisher/Code/MarchingCubes/MarchingCubes.cpp ??? same port issue back to first? |
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( |
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
import matplotlib.pyplot as plt | |
import numpy as np | |
def plot_kepler_orbit(semi_major_axis, eccentricity, num_points=1000): | |
# Calculate the semi-minor axis | |
semi_minor_axis = semi_major_axis * np.sqrt(1 - eccentricity**2) | |
# Generate theta values (angle from the positive x-axis) | |
theta = np.linspace(0, 2*np.pi, num_points) | |
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
## get existing or create new child node, works in tool mode to show in editor | |
static func get_or_create_child(_parent, _name, type = Node3D) -> Node: | |
var child = _parent.get_node_or_null(_name) | |
if not child: | |
child = type.new() | |
child.name = _name | |
_parent.add_child(child) | |
if Engine.is_editor_hint(): # if in editor we need to do this to show in editor | |
child.set_owner(_parent.get_tree().edited_scene_root) # new, allows static | |
return child |
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
# function that takes array of Vector3, returns a spline between them (as a Curve3D) | |
static func spline_positions_to_curve(marker_positions: Array, curve_strength: float) -> Curve3D: | |
var curve3D: Curve3D = Curve3D.new() | |
for i in marker_positions.size(): | |
var pos = marker_positions[i] # curve pos |
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
""" | |
FINISHED 03/12/2022 | |
HUGE drag drop modue, supports dragging cards about and throws signals | |
if set to check depth as 1, stacks of cards will become one object, no bugs! | |
check depth 2 allows dragging cards out of packs, is buggy still | |
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
""" | |
takes an input ODS file | |
runs through each sheet taking the top row as the keys and building json data of the other rows | |
the result json is a list of all rows on all sheets in json format, saved as a file with the orginal filename appended .json | |
https://pypi.org/project/pyexcel-ods3/ |
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
""" | |
"MultiMeshLineDrawer" object by Richard Ellicott 30/05/2022 (license: public domain or MIT) | |
script includes auto-setup function that will set up it's own multimesh | |
This object can draw multiple lines from a stretching and arranging multimesh instances |
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
""" | |
"MultiMeshLineDrawer" object by Richard Ellicott 30/05/2022 (license: public domain or MIT) | |
script includes auto-setup function that will set up it's own multimesh | |
This object can draw multiple lines from a stretching and arranging multimesh instances |
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
func calc_final_transform(_mag_vector,_offset,_width): | |
""" | |
this calculates a final transform to rotate a cylinder | |
this cylinder goes from (0,0,0) to (1,0,0) | |
so it is basicly 1 unit long along the x axis |
NewerOlder