Re: [Soya-user] Rotating, questions about basics.

2008-06-29 Thread Christian Blouin
After a brief chat with a few on the IRC, I thought I'd further specify
what I'm trying to do:

Let this be the top view of a box (which one day may be the base of a
miniature counter).
12
||
34

I want to pivot this box around the Y axis but centered using either
vertex 1 or 2 such that after a 90 degree rotation (chosen because its
easier in ASCII):

  3--1
  |  |
  4--2

Note that 2 is at the same position as before the rotation. So, if 2's
coordinates was originally (0.5, 0, 0), the line defined by the points:

a = soya.Point(self.parent,0.5,0.0,0.0)
b = soya.Point(self.parent,0.5,1.0,0.0)
  
should intersect both 2 and the vertex under. However, the line  

self.rotate(proportion * 5.0, a, b)

doesn't rotate the box but instead make it spiral out of view. 

Interestingly, for:

a = soya.Point(self.parent,0.0,0.0,0.0)
b = soya.Point(self.parent,0.0,1.0,0.0) 

works as expected (same as rotate_y). while the almost identical 

a = soya.Point(self.parent, 0.001, 0.0, 0.0)
b = soya.Point(self.parent, 0.0,   1.0, 0.0) 

Propels the box toward in the -Z direction exptremely fast (which
suggest a very, very far away axis of rotation.) I figured that out by
multiplying proportion by 0.001 instead of 5.0.

I'm assuming that I'm missing something, but this behaviour is confusing
to me. 

Christian




___
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user


Re: [Soya-user] Rotating, questions about basics.

2008-06-29 Thread Mark Williamson
Where is the box?  Is it just at the origin of its parent world?

 After a brief chat with a few on the IRC, I thought I'd further specify
 what I'm trying to do:

 Let this be the top view of a box (which one day may be the base of a
 miniature counter).
 12

 34

 I want to pivot this box around the Y axis but centered using either
 vertex 1 or 2 such that after a 90 degree rotation (chosen because its
 easier in ASCII):

   3--1

   4--2

 Note that 2 is at the same position as before the rotation. So, if 2's
 coordinates was originally (0.5, 0, 0), the line defined by the points:

 a = soya.Point(self.parent,0.5,0.0,0.0)
 b = soya.Point(self.parent,0.5,1.0,0.0)

 should intersect both 2 and the vertex under. However, the line

 self.rotate(proportion * 5.0, a, b)


 doesn't rotate the box but instead make it spiral out of view.

It sounds really like your co-ordinates are somehow confused, as you noted 
elsewhere it seems like the origin of the rotation is far away.  If your cube 
wasn't at 0,0,0 in the parent world, that would cause this kind of problem 
for instance.

More general code, which might also fix this bug, could specify the axis of 
rotation in terms of your cube's co-ordinate system - then it would work 
anywhere.

So you'd do soya.Point(self, co-ordinates relative to cubes centre) to 
define the points on the axis of rotation.  Then wherever you move the cube 
in the parent world, you can always use this axis to rotate around that edge 
of the cube.

 Interestingly, for:

 a = soya.Point(self.parent,0.0,0.0,0.0)
 b = soya.Point(self.parent,0.0,1.0,0.0)

 works as expected (same as rotate_y). while the almost identical

OK, that does seem strange given the other results.

Cheers,
Mark

 a = soya.Point(self.parent, 0.001, 0.0, 0.0)
 b = soya.Point(self.parent, 0.0,   1.0, 0.0)

 Propels the box toward in the -Z direction exptremely fast (which
 suggest a very, very far away axis of rotation.) I figured that out by
 multiplying proportion by 0.001 instead of 5.0.

 I'm assuming that I'm missing something, but this behaviour is confusing
 to me.

 Christian




 ___
 Soya-user mailing list
 Soya-user@gna.org
 https://mail.gna.org/listinfo/soya-user



-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)

___
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user


Re: [Soya-user] Rotating, questions about basics.

2008-06-29 Thread Christian Blouin
On Sun, 2008-06-29 at 15:11 +0100, Mark Williamson wrote:
 Where is the box?  Is it just at the origin of its parent world?

(0,0,0) is halfway between 1 and 2. 

 It sounds really like your co-ordinates are somehow confused, as you noted 
 elsewhere it seems like the origin of the rotation is far away.  

You can get a spiral by changing the rotate call in basic-2.py from:

self.rotate_y(proportion * 5.0)

to:

x = 0.01
self.rotate(proportion * 5.0,soya.Point(self.parent, x, 0, 0),
soya.Point(self.parent,x,1,0))

However, for x = 0 it works normally (rotate around the centre without
spiralling). If you use x=0.01 and use self instead of parent, the sword
will fly off the screen in about 2 frames (while it really should be
spinning around almost indistinguishably from rotate_y(...) ).

I'm happy to hear of a work around, all that I want to do is to be able
to wheel the box from either front corners (1 or 2) just as antique
army units used to do to adjust their facing.

Christian



___
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user


[Soya-user] Rotating, questions about basics.

2008-06-28 Thread Christian Blouin
Hi, 

I want to rotate a model along the y axis but using another centre than
the parent's (0,0,0). To me, the following code in the class's
advance_time should do the trick (to rotate around x=0.5 and z=0):

self.rotate(proportion * 5, soya.Point(self.parent,0.5,0.0,0.0),
soya.Point(self.parent,0.5,1.0,0.0))

Instead, I get a very rapidly enlarging spiral and the model goes off
the view. The model is a simple box made in blender that was
automatically imported.

Can anyone help?

Christian


___
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user