Re: issues with rotations

Bruce Sherwood <[email protected]> Fri, 28 Dec 2012 08:35:18 -0700
Newsgroups gmane.comp.python.visualpython.user
Message-ID <CAFDG03hz5W30nwFe6rTMGoBQSFCUb0JeQ51zq5Yr7tz-J8dz0A@mail.gmail.com>
Your ball is rotating about the default origin, which is the ball's pos.
Change your rotate statement to say origin=(2,0,0) instead of pos=(2,0,0).

It's better form to say rate(5) rather than sleep, for subtle reasons.

Bruce Sherwood


On Fri, Dec 28, 2012 at 6:55 AM, Zittlow, Mike <
mzittlow-8ZADTxCf15/[email protected]> wrote:

> I wrote a little program to get an understanding of the rotation of
> objects and have not been able to get things to work as I would like. I
> cannot get objects rotate about their centers. Believe is some code where I
> am trying to get a sphere to rotate about the x-axis while maintaining a 2
> unit distance from the yz-plane.
>
>
> Any assistance would be greatly appreciated.
>
> from visual import *
> from time import sleep
>
> #create a set of axes for a visual reference when rotating
> xaxis=cylinder(pos=(0,0,0), axis=(5,0,0), color=(1,0,0), radius=0.2)
> yaxis=cylinder(pos=(0,0,0), axis=(0,5,0), color=(0,1,0), radius=0.2)
> zaxis=cylinder(pos=(0,0,0), axis=(0,0,5), color=(0,0,1), radius=0.2)
>
> #create the ball to be rotated
> ball = sphere(pos=(2,2,0), radius = 0.5)
>
> #set rotation angle for 1/20 of a rotation
> rotationAngle = 6.28/20.0
>
> #have the ball rotate about the x-axis while
> #maintaining 2 units from the xy-plane
>
> for i in range(20):
>     ball.rotate(angle=rotationAngle, pos=(2,0,0), axis=(1,0,0))
>     sleep(0.2)
>
> thanks again,
>
> Mike
>
> --
> Michael Zittlow
> Mathematics Department Chairperson
> Southern Door High School
> Brussels, WI 54204
>
>
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> Visualpython-users mailing list
> Visualpython-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/visualpython-users
>
>

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812

_______________________________________________
Visualpython-users mailing list
Visualpython-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/visualpython-users