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

preview_player
Показать описание
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:

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
Рекомендации по теме
Комментарии
Автор

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.

bharatideshmukh
Автор

Thanks for these tutorials ....I have learnt more engineering from you than my engineering institute

arghachatterjee
Автор

Spent 7 hours chasing a typo but I finally got it. Thanks for the lessons. They keep my mind sharp (sharper).

waltmetcalf
Автор

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

pokerface
Автор

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 😃

chrisb
Автор

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!

danstachelski
Автор

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

jabcek
Автор

Homework appears easy enough, will give it a shot.

aman-sood
Автор

Thanks again for another great tutorial: I got the homework to work beautifully thanks to your tuition.

alfredcalleja
Автор

This is my 12th video in this series today. After 11 cups of coffee, I’m switching to red wine.

profcrabbe
Автор

I AM LEGEND! Thanks for the most excellent lesson, Paul. This homework was pretty straightforward.

cbrombaugh
Автор

Thanks for your instructive lessons. I am legend.

daviddirac
Автор

Outstanding lesson as u always.. Thank u sir.

pralaymajumdar
Автор

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 : )

bosshogg
Автор

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.

keithlohmeyer
Автор

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.

profcrabbe
Автор

Being lazy I might have used sine waves offset by Pi/2 but it wouldn't have looked as good as Paul's solution.

steveholt
Автор

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...

arnaudmasse
Автор

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.

billstrain
Автор

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:

johnplowright