Fixed worldToLocal.

closes #544
This commit is contained in:
NathanSweet 2016-04-03 18:30:35 +02:00
parent cc40f1be93
commit 6c353c1a38
4 changed files with 8 additions and 8 deletions

View File

@ -273,8 +273,8 @@ public class Bone implements Updatable {
var x:Number = world[0] - _worldX, y:Number = world[1] - _worldY;
var a:Number = _a, b:Number = _b, c:Number = _c, d:Number = _d;
var invDet:Number = 1 / (a * d - b * c);
world[0] = (x * a * invDet - y * b * invDet);
world[1] = (y * d * invDet - x * c * invDet);
world[0] = (x * d * invDet - y * b * invDet);
world[1] = (y * a * invDet - x * c * invDet);
}
public function localToWorld (local:Vector.<Number>) : void {

View File

@ -221,8 +221,8 @@ void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* local
float x = worldX - self->worldX, y = worldY - self->worldY;
float a = self->a, b = self->b, c = self->c, d = self->d;
float invDet = 1 / (a * d - b * c);
*localX = (x * a * invDet - y * b * invDet);
*localY = (y * d * invDet - x * c * invDet);
*localX = (x * d * invDet - y * b * invDet);
*localY = (y * a * invDet - x * c * invDet);
}
void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY) {

View File

@ -233,8 +233,8 @@ namespace Spine {
float x = worldX - this.worldX, y = worldY - this.worldY;
float a = this.a, b = this.b, c = this.c, d = this.d;
float invDet = 1 / (a * d - b * c);
localX = (x * a * invDet - y * b * invDet);
localY = (y * d * invDet - x * c * invDet);
localX = (x * d * invDet - y * b * invDet);
localY = (y * a * invDet - x * c * invDet);
}
public void LocalToWorld (float localX, float localY, out float worldX, out float worldY) {

View File

@ -356,8 +356,8 @@ public class Bone implements Updatable {
float x = world.x - worldX, y = world.y - worldY;
float a = this.a, b = this.b, c = this.c, d = this.d;
float invDet = 1 / (a * d - b * c);
world.x = (x * a * invDet - y * b * invDet);
world.y = (y * d * invDet - x * c * invDet);
world.x = (x * d * invDet - y * b * invDet);
world.y = (y * a * invDet - x * c * invDet);
return world;
}