Python 3D Graphics Tutorial 12: Understanding Orientation and Axis Parameters

  Рет қаралды 8,181

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 69
@bharatideshmukh3104
@bharatideshmukh3104 3 жыл бұрын
Hi Pawl sir.I am 11 years old and I may the youngest child who has sawn your all Arduino python and robotics videos. Do reply to this comment.You are the best programmer l have seen.Thankyou.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Congratulations. Keep up the hard work and you will go far in life
@pokerface68
@pokerface68 2 жыл бұрын
I enjoyed this lesson very much, but I had an odd issue. My pointer arrow was twice as long as the x, y, and z arrows. I tried writing it on my own, and then I carefully copied your solution and in each case the pntArrow was twice the length of the arms. I had to "pntArrow=arrow(axis=vector(arrowL*np.cos(theta), arrowL*np.sin(theta), 0), color=color.orange, length=arrowL/2, shaftwidth=pntT)" to make the pntArrow the same length as the arms. I must admit I have been studying this for some time and cannot find a solution, but mine works when I use arrowL/2. Haha got my mind working, and I will keep looking into it. Thank you, Steve
@waltmetcalf5354
@waltmetcalf5354 3 жыл бұрын
Spent 7 hours chasing a typo but I finally got it. Thanks for the lessons. They keep my mind sharp (sharper).
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent!
@patfacunla1687
@patfacunla1687 2 жыл бұрын
Wow, You're amazing!
@chrisb7250
@chrisb7250 9 ай бұрын
I love these lessons. Clear concise instructions and doable homework assignments. What more can a guy ask for? The number of cat videos I watch has steadily decreased as I do more and more Paul McWhorter lessons 😃
@arghachatterjee1353
@arghachatterjee1353 3 жыл бұрын
Thanks for these tutorials ....I have learnt more engineering from you than my engineering institute
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
That's awesome!
@alfredcalleja450
@alfredcalleja450 Жыл бұрын
Thanks again for another great tutorial: I got the homework to work beautifully thanks to your tuition.
@jabcek
@jabcek 3 жыл бұрын
Hi, thanks for the lession. Homework was really easy in this one ;) P.s. if we are using length in axis vector we dont need to use it after. So: customArrow.axis=vector(arrowL*np.cos(alfa),arrowL*np.sin(alfa),0) or: customArrow.axis=vector(np.cos(alfa),arrowL*np.sin(alfa),0) customArrow.length=arrowL Regards
@zaqk2
@zaqk2 3 жыл бұрын
True. I was thinking the same thing and tried it only after reading your comment :)
@chris993361
@chris993361 2 жыл бұрын
I too came to say that. If we just used the sin and cos in our axis then the length would be necessary but that math has already been taken care of in our axis call.
@danstachelski9185
@danstachelski9185 3 жыл бұрын
Another great tutorial. After getting "lost in the science" (over complicated code) I was able to recalibrate and figure this homework out. I am legend. Keep up the good work!
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent!
@eduardovelez9960
@eduardovelez9960 2 жыл бұрын
Siguiendo a Paul y revisando Vpython
@cbrombaugh
@cbrombaugh 3 жыл бұрын
I AM LEGEND! Thanks for the most excellent lesson, Paul. This homework was pretty straightforward.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Glad you liked it!
@daviddirac5942
@daviddirac5942 3 жыл бұрын
Thanks for your instructive lessons. I am legend.
@aman-sood
@aman-sood 2 жыл бұрын
Homework appears easy enough, will give it a shot.
@profcrabbe
@profcrabbe 2 жыл бұрын
This is my 12th video in this series today. After 11 cups of coffee, I’m switching to red wine.
@pralaymajumdar1206
@pralaymajumdar1206 3 жыл бұрын
Outstanding lesson as u always.. Thank u sir.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
So nice of you
@keithlohmeyer
@keithlohmeyer 3 жыл бұрын
Thanks for another great video. FYI as I mentioned in the live chat most numpy functions are in vPython but I found that linspace is not so we need numpy imported. Home work was just copy paste twice and move the sin and cos equations to other vector spots. I did not make a vid for that. Thanks again.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Great tip!
@FrancisHodoh
@FrancisHodoh 2 ай бұрын
This is incredible
@Sikuq
@Sikuq 3 жыл бұрын
Very interesting, Paul. Thanks.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Glad you think so!
@profcrabbe
@profcrabbe 2 жыл бұрын
There is a mistake at about 32 minutes when you say that you need to reset the length of the moving axis on line 13. You do not because you already embedded the length of the axis in the formulae l*cos(T) and l*sin(T). That's the l part, the length of the vector. if you use just cos(T) and sin(T), then you are creating the vector on the unit circle and the axis is too short. You can see that the length is embedded in the vector by simply deleting that line and noting it still works, but try: Ptrarrow.axis=vector(arrowL*np.cos(theta),arrowL*np.sin(theta),0) Ptrarrow2.axis=vector(arrowL*np.cos(-theta),arrowL*np.sin(-theta),0) Ptrarrow2.length=arrowL for a fun demonstration. The lesson is you do not have to change the length when you change the vector *if* you get the length correct in the vector itself.
@bosshogg8621
@bosshogg8621 2 жыл бұрын
Seems that an axis arg passed to the -init- overrides the length even in the init. THAT IS: arrow(axis=vector(1,0,0),length=1000) IS THE SAME AS arrow=(axis=vector(1,0,0)) There both just 1 long like the vector states. ….hope I didn’t comment too early…. Thanks for this excellent series : )
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Yes, annoying, but once you realize it, it is easy to manage.
@steveholt8991
@steveholt8991 3 ай бұрын
Being lazy I might have used sine waves offset by Pi/2 but it wouldn't have looked as good as Paul's solution.
@Bubby9767
@Bubby9767 Жыл бұрын
BOOM, your amazing
@LEECHINLEONG0705
@LEECHINLEONG0705 3 жыл бұрын
Cool 😎
@arnaudmasse7839
@arnaudmasse7839 2 жыл бұрын
Everything works great but for some unknown reason I can't manage to change the arrow length and shaftWidth. Anybody know why? the axis and the color can be changed, I triple checked everything for typos...
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Try doing it AFTER you set the axis.
@billstrain1
@billstrain1 3 жыл бұрын
I got mine to work but the rotation arrow is twice as long and the arrow head is twice as big. It seams to be when I use the angle functions. I copied your code and it does the same thing. I even tried to set the size and it did not work...If there is a coding error I can't find it.
@neilausten9404
@neilausten9404 3 жыл бұрын
Same with me.
@jeas29
@jeas29 3 жыл бұрын
I had the same problem and I found a typo : I wrote "Length" (uppercase) instead of "length" (lowercase). Despite this error, there was no error message but the length of the vectors was false.
@martinlewis645
@martinlewis645 2 жыл бұрын
@@jeas29 Thank you!. I had the same problem and this was the fix.
@MrElFRanz
@MrElFRanz 3 жыл бұрын
Hello Paul. I have made a correction in order to remove the jump. kzbin.info/www/bejne/lXyTd4Wdfat1j7M I added a 0.5pi movement in the x axis direction after the pointer reaches (0,0,1). After this, until the pointer is at (1,0,0), the pointer seems to move faster, but I hadn't changed the the rate and the number of steps. Kind regards.
@johnplowright6421
@johnplowright6421 3 жыл бұрын
Great lesson as usual Paul. My first run of the homework was alright but I didn't like the way the arrow jumped from the x pointer to the z pointer before completing the z rotation. It took a bit of time and calculations, plus a rounding to 2 places but I like the end result: kzbin.info/www/bejne/p3jEfq2HbJ6Sbrc
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent, and yes, an elegant solution is to not have the arrow 'jump' to the other axis. One way is what you did, which was smoothly rotate it over. Another is to go around another 1/4 rotation (pi/2) on each axis and you can smoothly transition to each new plane. Nice job!
@billstrain1
@billstrain1 3 жыл бұрын
This copy of the code from vpython import * import numpy as np arrowL=2 arrowT=.02 theta=np.pi/4 xarrow=arrow(axis=vector(1,0,0),color=color.red, Length=arrowL,shaftwidth=arrowT) yarrow=arrow(axis=vector(0,1,0),color=color.green, Length=arrowL,shaftwidth=arrowT) zarrow=arrow(axis=vector(0,0,1),color=color.blue, Length=arrowL,shaftwidth=arrowT) pntarrow=arrow(axis=vector(arrowL*np.cos(theta),arrowL*np.sin(theta),0),color=color.orange, Length=arrowL, shaftwidth=arrowT) while True: for myAngle in np.linspace(0,2*np.pi,1000): rate(50) pntarrow.axis=vector(arrowL*np.cos(myAngle),arrowL*np.sin(myAngle),0) pntarrow.length=arrowL for myAngle in np.linspace(0,2*np.pi,1000): rate(50) pntarrow.axis=vector(0,arrowL*np.cos(myAngle),arrowL*np.sin(myAngle)) pntarrow.length=arrowL for myAngle in np.linspace(0,2*np.pi,1000): rate(50) pntarrow.axis=vector(arrowL*np.cos(myAngle),0,arrowL*np.sin(myAngle)) pntarrow.length=arrowL
@airwavested
@airwavested 3 жыл бұрын
My homework is here at kzbin.info/www/bejne/ppq3eZ2eob-gq8U And thank you so much Paul for all the work you do!
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Really nice one. Wish in the one place you did not have your vector hyperspace to another location. Cool to try to do it without transporting vector to a different axis.
@airwavested
@airwavested 3 жыл бұрын
@@paulmcwhorter Ah! Yes I see the problem. I've try addressing this by having the arrow rotate 1 1/4 turns, rather than 3/4 of a turn, and do it on all the axes for consistency which also allows it to run in a continuous loop. kzbin.info/www/bejne/qqvXk5upo7p6hqs
@bigbogeyface
@bigbogeyface 3 жыл бұрын
Here's My Homework: kzbin.info/www/bejne/gJuaaql7q5l9qJI 👍
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Most excellent. Student outdoes teacher, news at 11:00
@bigbogeyface
@bigbogeyface 3 жыл бұрын
@@paulmcwhorter 😁✌
@bigbogeyface
@bigbogeyface 3 жыл бұрын
@@paulmcwhorter What we should probably bear in mind is: What takes you 1 hour, takes me 10 🤷 I bet if you spent 10 hours on a program, it would be mind blowing 🤯 👍
@berryblades
@berryblades Жыл бұрын
I am legend! My attempt: kzbin.info/www/bejne/oWWvZnSpit-kibM Thank you again Paul, its good practice for my brain to be switching between vPython and OpenCV on a regular basic following your playlist!
@kenstephens221
@kenstephens221 3 жыл бұрын
Here's my video of my homework output. kzbin.info/www/bejne/eoncZqqldr5-etE Thanks
Python 3D Graphics Tutorial 4: Understanding 3D Graphic Parameters
32:16
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 79 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39
Python Tutorial 19: Python Classes and Methods Homework Examples
57:57
Python 3D Graphics Tutorial 15: Three Dimensional Clock Animation
39:36
Python 3D Graphics Tutorial 8: NonBlocking Dual Animations in Vpython
24:35
Python 3D Graphics Tutorial 7: Vpython Model of a Thermometer
26:59
Paul McWhorter
Рет қаралды 14 М.
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 79 МЛН