-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
native animations #180
Comments
Oh shit, this could make animation so much better than the hack I have in place now! Dude, you're improving all of this way faster than I can keep up. Nice work. |
physics: import numpy as np
from solid import *
ball_radius = 100
def get_bouncing_ball_data(pos=np.array([0.0, 0.0, 0.0]), vel=np.array([5.0, 5.0, 200.0])):
data = []
gravity = np.array([0.0, 0.0, -8.0])
for t in range(1000):
vel = (vel + gravity) * 0.995
pos += vel
if pos[2] < ball_radius:
vel[2] = vel[2] * -1
pos[2] = ball_radius
data.append(pos.tolist())
return data
ball_data = f'bouncing_ball_data = {get_bouncing_ball_data()};'
ball_pos_over_time = scad_inline("bouncing_ball_data[$t * 1000]")
ball = translate(ball_pos_over_time)(sphere(ball_radius))
floor = background(cube([2000, 2000, 0.01]))
scad_render_to_file(ball + floor, file_header=ball_data) No clue what this could be good for, but....... I guess it might be possible to plug a -- more complex :-p -- physics engine into it and render animated movies.... All of this is implemented and working with exp_solid and these snippets are in the examples, check it out... (but this should also work with master with little effort -> scad_inline from #178) PS: anybody an idea where to get the vitamins for a 4d printer? 😛 |
yeah!
Works with expsolid should work with master too.
(you need scad_inline from #178)
The text was updated successfully, but these errors were encountered: