Sorry, but I don't understand what it is you're asking about. I don't=20
see any rotation being carried out. Please tell us in some detail what=20
it is you're trying to do, and what you think isn't working properly. It=20
would help a lot to simplify your example to its essence, just enough to=20
demonstrate the problem, without extraneous features.
Bruce Sherwood
Stefan Paulick wrote:
> When rotating a frame inside a class, it starts to move and rotates aro=
und=20
> some mysterious center.
> I could not find out how to calculate origin for a propper offset.=20
>
> Please find attached my example. I would be glad for any hint.=20
>
> Thanks in advance,=20
>
> Mit freundlichen Gr=FC=DFen / With kindest regards=20
>
> Stefan Paulick=20
>
>
> http://www.urbeli.com
> mailto://stefan.pa...@ur...
> /*----------------------*/=20
>
> import time
> import visual=20
>
> b =3D visual.box(height =3D .1)
> c =3D visual.cylinder(pos=3D(2,2,2),axis=3D(2,0,0),radius=3D.1)
> f =3D visual.frame()
> d =3D visual.cylinder(frame=3Df,pos=3D(1,2,1),axis=3D(2,0,0),radius=3D.=
1)
> e =3D visual.cylinder(pos=3D(0,0,0),axis=3D(2,0,0),radius=3D.1)
> e.pos =3D (3,2,3)=20
>
> class cC():
> def __init__(self, pos=3D(0,0,0), axis=3D(2,0,0)):
> self.pos =3D visual.vector(pos)
> self.axis =3D visual.vector(axis)
> self.f =3D visual.frame()
> self.g =3D=20
> visual.cylinder(frame=3Df,pos=3Dself.pos,axis=3Dself.axis,radius=3D.1)
> self.g.pos =3D visual.vector(0,2,0)
>
> def wpos(self,local):
> x_axis =3D visual.norm(f.axis)
> z_axis =3D visual.norm(visual.cross(f.axis, f.up))
> y_axis =3D visual.norm(visual.cross(z_axis, x_axis))
> #return x_axis,y_axis,z_axis
> return self.f.pos+local[0]*x_axis+local[1]*y_axis+local[2]*z_axi=
s
>
> u =3D cC()=20
>
> ax =3D 0
> cnt =3D 0.=20
>
> while 1:
> print u.wpos((1,2,0))
>
> if ax =3D=3D 0:
> c.rotate(angle=3D.15, axis=3D(0,1,0), origin=3D(3,2,2))
> f.rotate(angle=3D.15, axis=3D(0,1,0), origin=3D(2,2,1))
> e.rotate(angle=3D.15, axis=3D(0,1,0), origin=3D(4,2,3))
> u.f.rotate(angle=3D.15, axis=3D(0,1,0), origin=3D(1,2,0))=20
>
> c.color =3D (1,1,0)
> elif ax =3D=3D 1:
> c.rotate(angle=3D.15, axis=3D(0,0,1), origin=3D(3,2,2))
> f.rotate(angle=3D.15, axis=3D(0,0,1), origin=3D(2,2,1))
> e.rotate(angle=3D.15, axis=3D(0,0,1), origin=3D(4,2,3))
> u.f.rotate(angle=3D.15, axis=3D(0,0,1), origin=3D(1,2,0))
> c.color =3D (1,0,0)
> elif ax =3D=3D 2:
> c.rotate(angle=3D.15, axis=3D(1,0,0), origin=3D(3,2,2))
> f.rotate(angle=3D.15, axis=3D(1,0,0), origin=3D(2,2,1))
> e.rotate(angle=3D.15, axis=3D(1,0,0), origin=3D(4,2,3))
> u.f.rotate(angle=3D.15, axis=3D(1,0,0), origin=3D(1,2,0))
> c.color =3D (0,0,1)=20
>
> cnt +=3D1
> ## print cnt,ax
> if cnt > 10:
> cnt =3D 0
> ax +=3D 1
> if ax > 2:
> ax =3D 0
> time.sleep(.1)
>
> -----------------------------------------------------------------------=
--
> Using Tomcat but need to do more? Need to support web services, securit=
y?
> Get stuff done quickly with pre-integrated technology to make your job =
easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron=
imo
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=
=3D121642
> _______________________________________________
> Visualpython-users mailing list
> Vis...@li...
> https://lists.sourceforge.net/lists/listinfo/visualpython-users
> =20
|