Python 3D Graphics Tutorial 13: Understanding Orientation in Three Dimensional Parameter Space

  Рет қаралды 7,764

Paul McWhorter

Paul McWhorter

2 жыл бұрын

You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In this video we show step-by-step instructions on how to understand Orientations and Axis parameters in Vpython. We have already learned how to translate an object in space, and in this lesson we begin to look at rotations. I do not assume you are an expert, so these lessons are designed for complete beginners.
#Python
#Lessons
#Graphics

Пікірлер: 103
@steveholt8991
@steveholt8991 18 күн бұрын
I am legend, but it's a team effort as usual between me and Paul, who is the best teacher I have had.
@paulmcwhorter
@paulmcwhorter 18 күн бұрын
LEGEND!
@shatterism3329
@shatterism3329 4 ай бұрын
I am Legend!!! I couldn't make it work without your teaching skills. Thank you, I learned a lot!
@paulmcwhorter
@paulmcwhorter 4 ай бұрын
LEGEND!
@thebrector3823
@thebrector3823 11 ай бұрын
I AM LEGEND!! One point to notice is when you set the steps to 1000 in the last for loop (returning back to the starting point) the speed will be a little slower because the distance traveled is lesser (three-fourths of 2 pi), so I set the steps to 750. Thank you for all these lessons!
@gordonspond
@gordonspond 2 жыл бұрын
Ek is nog steeds 'n legende. The lawn chairs were so impressed, they started spinning.
@YM-qf8iz
@YM-qf8iz 11 ай бұрын
You are a great teacher! I learned Python from you, sketchup with which I designed my house... there is no one like you.
@jeas29
@jeas29 2 жыл бұрын
I am Legend. Thank you, Paul, you are really a great teacher ! I did my clock in a minimalist mode, but it works. What you said about parameters design and radius was very useful to me. So I did it in such a way that it does not break even if the radius is changed: clockFace = cylinder(axis=vector(0, 0, -.01), radius=1) rd = clockFace.radius for nbTicks, size in ((13, .1), (61, .04)): for theta in np.linspace(0, 2*np.pi, nbTicks): ax = vector(rd*cos(theta), rd*sin(theta), 0) box(axis=ax, pos=ax*.9, size=vector(rd*size, rd*.015, .01), color=color.black)
@cbrombaugh
@cbrombaugh 2 жыл бұрын
I AM LEGEND! It took a while, but I finally made a clock. Thanks for the most excellent lessons, Paul. I can't wait for more!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Legend!
@ecassar1975
@ecassar1975 2 жыл бұрын
I am legend. Managed to do the homework. Thanks for being such an excellent teacher.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Great job!
@leeg.1402
@leeg.1402 2 жыл бұрын
Thanks for another great lesson Paul. It took me a little time, but I finally figured it out. These "old" brain cells are a little rusty!!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Glad to help!
@wayneswan3092
@wayneswan3092 2 жыл бұрын
I had a lot of fun with this one! I commented out all the arrows and just watched the ball draw the trails in empty space. pretty cool! Thank you very much!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Great job!
@pokerface68
@pokerface68 2 жыл бұрын
This was a very interesting lesson, I really enjoyed learning and seeing the way vpython allows us to play like this! Haha now I am dreading trying to figure out how to make the clock face you asked for - at least I am old enough to know what an analog clock looks like! This is an interesting project, so off to figure it out. Thank you once again.
@daviddeegan1740
@daviddeegan1740 4 ай бұрын
I am legend ! Such a great lesson looking forward to the next :)
@jabber2824
@jabber2824 28 күн бұрын
I am LEGEND. Great lesson!
@harrison4687
@harrison4687 2 жыл бұрын
I am legend. Thanks for another great lesson. :)
@chris993361
@chris993361 2 жыл бұрын
I was pretty sure that jump was going to be an issue and I actually made mine go 5pi/2 for each of my motions to smoothly transition between planes. Also, the trail option is awesome!
@josueruiz8166
@josueruiz8166 Жыл бұрын
you are the best teacher i love you mister
@kekekeernest8920
@kekekeernest8920 2 жыл бұрын
U are the baddest, just too more than good, I which u could teach us website development
@ritwikkaushik4026
@ritwikkaushik4026 2 жыл бұрын
I an LEGEND!!
@Sikuq
@Sikuq 2 жыл бұрын
Excellent lecture. Missed your chat.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Got a surprise visit from the env. police right as the premier was started, so had to go and deal with that. Sorry I missed the chat.
@Godsbeloved05
@Godsbeloved05 2 жыл бұрын
I am legend and I also made mine look beautiful like yours without the ugly jumping on axis. Great lessons
@Bubby9767
@Bubby9767 Жыл бұрын
I fixed by actually starting at np.linspace(np.pi/2,2*np.pi,1000) in the XY. then i drove back to XZ to YZ with another for loop when I got to this point, np.linspace(0,np.pi/2,250) brought me back full circle to start while loop again.
@JoLo-vx1nb
@JoLo-vx1nb 2 жыл бұрын
Thank you for your great videos.Since I am new to your channel, I am not sure if you have ever shown where you obtain all the Python and VPython commands that are available. In this video you introduced ( make_trail ). Please tell us where the source of all the commands that are available is obtainable. THANK YOU.
@wayneswan3092
@wayneswan3092 2 жыл бұрын
I got it to work, but I was not able to make it drive to the next arrow repeatedly. No matter how I worked it out to go to the next arrow, I just kept pushing the jump over to the next round. I couldn't get it to flow symmetrically on every rotation for infinite play. (Edit: yeah. I don't know why I didn't think to add another "for" loop. I just kept trying to modify the linspace of the 3 "for" loops I had.
@woodpython8588
@woodpython8588 2 жыл бұрын
I'm a Legend. Back here after finally catching with the AI classes.
@arlo4051
@arlo4051 2 жыл бұрын
I almost got it all, had it right up until the loop with smooth transitions but could not figure out how to start it on the Z plane. I used 2.5* np.linspace to drive it beyond the X plane and it worked so I guess the chair only half way folded.
@arnaudmasse7839
@arnaudmasse7839 Жыл бұрын
I am LEGEND !!!
@billstrain1
@billstrain1 2 жыл бұрын
Got it OK
@latifaref9476
@latifaref9476 2 жыл бұрын
Thank you Paul for the amazing tutorials. I have learned a lot from you. Now I am starting to enjoy programming with python. Now I believe that miracles are real...!! You just have to practice over and over. I had a hard time changing the rate of movements. Finally, I figured out that I am putting it outside the "for" loop just right after the "while True: " !! LOL or I had a hard time naming the "shaftwidth" ! Does it really have to be like the exact spelling? Cause nothing else worked for me. for example: Shaftwidth, shaftWidth ...(upper and lower cases I mean, or naming it something else at all), but it is not sensitive for "Length" or "length". Am I doing something wrong? myArrow=arrow(axis=vector(1,0,0), color=color.orange, length=arrowL, shaftwidth=pntT)
@keithlohmeyer
@keithlohmeyer 2 жыл бұрын
Hi Paul, Just wondering if you are going to do more on clocks/time in the next lesson. After doing the assigned homework I went ahead and made a working clock. I don't want to jump the gun and post a video of it if you are going to work on the clock in next weeks lesson. I can just post the assigned HW. Thanks for all you do.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
We are working our way towards a clock. I fear mine is going to be woefully lacking compared to what I expect you and BBF are going to do. You guys are really excelling at this stuff.
@keithlohmeyer
@keithlohmeyer 2 жыл бұрын
@@paulmcwhorter Sounds good. I continue to learn from each of your lessons. I realize you make them for a wider audience so I will just follow along. Both of your current courses are pushing me to explore new interests. Thanks for that and keep the lessons coming.
@bigbogeyface
@bigbogeyface 2 жыл бұрын
I'm just working on the pendulum and escapement mechanism now 👍
@keithlohmeyer
@keithlohmeyer 2 жыл бұрын
@@bigbogeyface Now that's just over the top (LOL) you win.
@neilausten9404
@neilausten9404 2 жыл бұрын
Also have the same problem as Walt below. Arrow length twice the axes length. Only way I could fix was to create separate variable pointL=1 and use that for my Parrow length.
@kevinmeeker6548
@kevinmeeker6548 Жыл бұрын
I am Legend! (thump, thump!)
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@madsci6807
@madsci6807 Жыл бұрын
I was able to get this one to work, but my arrows were going backwards. Despite having taken all the way through dif eq in college, I seem to have forgotten all my math, and I got my trig functions backwards. I had to do some extra math to make in run pretty, but got through it. However, your solution was much simpler and easier to get the arrows synchronized.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Problem is they dont teach college math in a way you remember it, since they do not show why it is important with real examples.
@codecage9333
@codecage9333 2 жыл бұрын
I am LEGEND with a double chest bump! But I am way behind on the lessons. Both these and the AI for Everyone series.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Welcome back have not heard from you in a while
@codecage9333
@codecage9333 2 жыл бұрын
@@paulmcwhorter October was taken up with putting on an amateur radio hamfest that the chairman walked away from 3 weeks before the show. So I wound up taking over. Then at that hamfest, with over 2000 attendees, I contracted Covid. Guess not enough people were wearing masks. Just now getting over that. Glad to be back but a lot of catching up to do!
@Godsbeloved05
@Godsbeloved05 2 жыл бұрын
For the ball position I did ball.pos=pointer.axis.
@neilausten9404
@neilausten9404 2 жыл бұрын
Was able to rotate arrow around the 3 axes but only by doing 3 separate programs. I guess that was a failure.
@alfredcalleja450
@alfredcalleja450 Жыл бұрын
I am Legend!!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@JackVersey
@JackVersey 2 ай бұрын
I am Legend This was one of the easier home works (IMHO) from Paul's good self. Made one error when I put the rate before the for loop (the arrow didn't look like it was moving! Whoops!). Once that was diagnosed, all went well. 🙂 from vpython import * import numpy as np arrowL = 2 arrowT = 0.02 theta = 0 xarrow = arrow(color = color.red, length = arrowL, shaftwidth = arrowT, axis = vector(1, 0, 0)) yarrow = arrow(color = color.green, length = arrowL, shaftwidth = arrowT, axis = vector(0, 1, 0)) zarrow= arrow(color = color.blue, length = arrowL, shaftwidth = arrowT, axis = vector(0, 0, 1)) ptrarrow = arrow(color = color.orange, length = arrowL, shaftwidth = arrowT, axis = vector(0, 1, 0)) while True: for angle in np.linspace(0, 3*pi/2, 1800): rate(180) ptrarrow.axis = vector(arrowL*sin(angle), arrowL*cos(angle), 0) for angle in np.linspace(0, 3*pi/2, 1800): rate(180) ptrarrow.axis = vector(arrowL*-(cos(angle)), 0, arrowL*sin(-angle)) for angle in np.linspace(0, 3*pi/2, 1800): rate(180) ptrarrow.axis = vector(0 , arrowL*(-sin(angle)), arrowL*cos(angle))
@paulmcwhorter
@paulmcwhorter 2 ай бұрын
LEGEND!
@JackVersey
@JackVersey 2 ай бұрын
@@paulmcwhorter Many thanks, always appreciate the fact that you reply to comments! Out of interest, I don't seem to have to declare the arrow.length after altering the arrow.axis vector, is this due to a newer version of python since the time of recording perhaps? Also, my way of maintaining the ball.position at the tip of the ptrarrow.axis is simply to declare them at the sam time to equal to the same vector:- for angle in np.linspace(0, 3*pi/2, 1800): # xy plane rate(180) ball.pos = ptrarrow.axis = vector(arrowL*sin(angle), arrowL*cos(angle), 0) for angle in np.linspace(0, 3*pi/2, 1800): # xz plane rate(180) ball.pos = ptrarrow.axis = vector(arrowL*-(cos(angle)), 0, arrowL*sin(-angle)) for angle in np.linspace(0, 3*pi/2, 1800): # yz plane rate(180) ball.pos = ptrarrow.axis = vector(0, arrowL*(-sin(angle)), arrowL*cos(angle)) Would this be considered bad practice or is this an ok thing to do ( I simply find it simpler to onlly have to have the axis declared once in each for loop to prevent, or rather minimise, my own confusion..... 🙂
@yuval9197
@yuval9197 5 ай бұрын
I am legend 👊👊
@petefontana1958
@petefontana1958 2 жыл бұрын
I am Legend. My pointer program was not as clean as yours. Now to the clock.
@kenstephens221
@kenstephens221 2 жыл бұрын
Who is the person on your shoulders on your wallpaper?
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
I am not sure which picture you are looking at, but on my profile picture it is a Maasai warrior
@bigbogeyface
@bigbogeyface 2 жыл бұрын
Thought I would do this an entirely different way 💁 Here it is: kzbin.info/www/bejne/fJ2YiYmVbNRqm6M It's kinda cool, as it allowed me to have lines for hour marks, however, I think the lighting is out of kilter 🤷
@bassman2162
@bassman2162 2 жыл бұрын
I got it to work, but mine jumped to blue. I like the driving the pointer to the next plane better than jumping there.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Yes the pointer jumping between planes defies physics and I worry might tear the fabric of the universe if we are not careful.
@zaqk2
@zaqk2 2 жыл бұрын
Hi Paul, i am not sure if i understood the homework about the clock correctly, but this is what i came up with : kzbin.info/www/bejne/g6qwZ5SwptyEsM0 I am sure i am missing something here. Plz correct me. Also, for some reason this "Lesson 13" is not showing in your vPython tutorial playlist.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
OK, I fixed it.
@keithlohmeyer
@keithlohmeyer 2 жыл бұрын
Looking good. You said "I am sure i am missing something here" ...looks like you got it covered and only a dozen lines of code. Cool.
@zaqk2
@zaqk2 2 жыл бұрын
@@keithlohmeyer Yes, because of less lines of code, i thought i must have missed something. I am glad to learn that it was right. :) ... Although, i tried moving an arrow along like a "seconds" hand, its positions became very inaccurate. So that led me to think that i must have made some mistake. kzbin.info/www/bejne/sIuUXqSgd7t-sKc The more time passed, the higher the error got... :(
@starRunnerX
@starRunnerX 2 жыл бұрын
I am Legend.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
LEGEND!
@mahanmotaghiraad1790
@mahanmotaghiraad1790 6 ай бұрын
i am legend, with double chest pump🎉
@paulmcwhorter
@paulmcwhorter 6 ай бұрын
LEGEND!
@philluvschips3787
@philluvschips3787 5 ай бұрын
kzbin.info/www/bejne/Z5KamGmai86NnNk Made the arrow go slightly different so I didn't get a 'jump' at the end, but I think the result gets to the 'point'.
@paulmcwhorter
@paulmcwhorter 5 ай бұрын
LEGEND!
@zyrix86
@zyrix86 3 ай бұрын
I AM LEGEND
@paulmcwhorter
@paulmcwhorter 3 ай бұрын
LEGEND!
@ernestomendoza4862
@ernestomendoza4862 2 жыл бұрын
I am legend
@itsmeintorrespain2714
@itsmeintorrespain2714 2 жыл бұрын
Finally caught up with this course. My clockface (and a bit more) :- kzbin.info/www/bejne/npy0iautqNaKpNU
@floridian080
@floridian080 2 жыл бұрын
My homework: kzbin.info/www/bejne/nYqrdniKjcelZ5Y Great lesson. For the homework, I took a couple of tips from Keith's posting so I can't really claim to be Legend.
@waltmetcalf5354
@waltmetcalf5354 2 жыл бұрын
got it working somewhat but the pointer arrow is twice the length of the other arrows.???
@billstrain1
@billstrain1 2 жыл бұрын
I had the same problem. I set the arrow length to 1 and it was then the same length as the axis.
@waltmetcalf5354
@waltmetcalf5354 2 жыл бұрын
Oh ok thanks
@GCRickerNH
@GCRickerNH 2 жыл бұрын
Your homework is getting harder and harder. I finally figured it out. I'm unsure how to show results here in comments. It won't allow me to paste the image.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
upload to your youtube and post link to the video in comments
@kevingriffin55
@kevingriffin55 2 жыл бұрын
I am LEGEND. As always my simple homework solution kzbin.info/www/bejne/b6G0oXWmf7eqrs0
@freshengineers1806
@freshengineers1806 2 жыл бұрын
Why always black coffee
@turuus5215
@turuus5215 2 жыл бұрын
Sugarless black coffee not only gives you a jolt of energy, but it's also excellent for your heart. It's as if you're "killing two birds with one stone." Our teacher is a smart guy.
@YM-qf8iz
@YM-qf8iz 11 ай бұрын
I did it with three for loop only: while True: for myAngle in np.linspace(0, 2*np.pi+np.pi/2, 1000): rate(speed) pointArrow.axis = vector(arrowL * np.cos(myAngle), arrowL * np.sin(myAngle), 0) pointArrow.length = arrowL for myAngle in np.linspace(0, 2*np.pi+np.pi/2, 1000): rate(speed) pointArrow.axis = vector(0, arrowL * np.cos(myAngle), arrowL * np.sin(myAngle)) pointArrow.length = arrowL for myAngle in np.linspace(0, 2*np.pi+np.pi/2, 1000): rate(speed) pointArrow.axis = vector(arrowL * np.sin(myAngle), 0, arrowL * np.cos(myAngle)) pointArrow.length = arrowL
@danielsaenz5570
@danielsaenz5570 2 жыл бұрын
I AM A LEGENDARY lawn chair...🪑🪑It was a quite difficult, snice I do not know Trigonometry at all. (I'm only in 8th grade) but you did show the basics about it, but I just could not find an algorithm for the Homework. Thanks Paul!! 👍👍
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Keep watching, and you will pick up some simple Trig.
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Pleased the disabled person! #shorts
00:43
Dimon Markov
Рет қаралды 31 МЛН
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 8 МЛН
(Turkish) LUNA2000-(5-30)-S0 Kurulum Videosu
4:17
Huawei FusionSolar
Рет қаралды 2
Python 3D Graphics Tutorial 4: Understanding 3D Graphic Parameters
32:16
Python 3D Graphics Tutorial 9: Mixing Colors in Vpython
12:32
Paul McWhorter
Рет қаралды 8 М.
Let's code 3D Engine in Python from Scratch
14:55
Coder Space
Рет қаралды 381 М.
Python 3D Graphics Tutorial 8: NonBlocking Dual Animations in Vpython
24:35
#samsung #retrophone #nostalgia #x100
0:14
mobijunk
Рет қаралды 14 МЛН
Bluetooth connected successfully 💯💯
0:16
Blue ice Comedy
Рет қаралды 1,6 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 65 МЛН
📱магазин техники в 2014 vs 2024
0:41
djetics
Рет қаралды 667 М.