[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] BUG: Detecting rotation at multiples of 90
- To: pygame-users@xxxxxxxx
- Subject: [pygame] BUG: Detecting rotation at multiples of 90
- From: "Charlie Nolan" <funnyman3595@xxxxxxxxx>
- Date: Tue, 10 Jun 2008 03:03:23 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 10 Jun 2008 04:03:28 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=xa1mpZwphmvhKgbQ8IJaZlmOqEu6jNuNmyySIrDGre8=; b=Z3Rdy+d7MWIk+7VsvNJ8SX83F7JIIWfHLwOXRlO1fcbYQzZHgleFxoeu6JX5uaG1Q7 eWuteZIU4RSJaT7h3Y1sbybxV22roJPQtp4pWxaZNCeAf2CDtL//Ap84Noi9xcrM97dx q6ywRuGlNUXQHQwBBe9jW4Hq0hq5yoxs/6CkA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=aCRH/DBxrVEl+lheEsqNb/rF64n4ZBAW6y9J1N/TH6sG5C8vFXQLza88jjiawymvBd kZVMvK2dGfjqpPNTexeB76HGBKABsYdW9BZlZlUviNTJX45C8nQTIBaMjQdemVexl/RB RYxxpNfqifo28Rk9GkKrdx6XY4gDi01LglBec=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
transform.c, 574..586
if (!(((int) angle) % 90))
{
# (snip) Exact rotation for angles that are multiples of 90.
}
There's a subtle bug here, in that casting to int will eliminate the
full-precision rotation on every range (90*x, 90*x + 1). My C-fu is a
bit weak, but I think that can be fixed by changing the if statement
to:
if ( !( angle % 90.0f ) )
-FunnyMan3595 (Charlie Nolan)