Scott David Daniels wrote:
> Your equation for y uses the new x, not the old x. Be more free with
> names. Here's one way to write it:
>
> class ...
> def rotate(self, angle):
> '''Rotate point angle radians around relPoint'''
> x, y = self.coords
> xRel, yRel = self.
Karl Max wrote:
> "Scott David Daniels" <[EMAIL PROTECTED]> ha scritto nel messaggio
>>... Your equation for y uses the new x, not the old x
> De hi hi ho. I must sleep some more hours at night... ;-)
>>Be more free with names.
>
> Well, I often report book formulas, and forget renaming varia
"Scott David Daniels" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
>> x = x * cos - y * sin - xRel * cos + yRel * sin + xRel
>> y = x * sin + y * cos - xRel * sin - yRel * cos + yRel
>> self.coords = (x,y)
>
> Your equation for y uses the new x, not the old x.
De hi hi
Karl Max wrote:
> def rotate(self, w):
> # This method belongs to the class Vertex
> # w = angle expressed in radiants
> x, y = self.coords
> xRel, yRel = self.relPoint # The rotation should be relative to this
> sin, cos = math.sin(w), math.cos(w)
> x = x * cos - y * sin - xRel * cos + yRel
> xRel, yRel = self.relPoint # The rotation should be relative to this
Shouldn't it be
x -= xRel
y -= yRel
xR = x * cos(phi) - y * sin(phi)
yR = x * sin(phi) + y * cos(phi)
then?
Regards
Franz GEIGER
"Karl Max" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi all,
>
> I
Hi all,
I'm new here. Name's Max from tuscany, and I don't speak english very well
:-) I am not veteran at coding, I am most like an "artisan coder" since
commodore 64 times.
Now the problem:
I would like to have a little 2d engine to calculate and trace segments and
poly's and their collision