Get Cartesian coordinates from isometric coordinates

Coordenadas: X:140 Y:279
Coor Isometricas:128/69
X: 2  Y: 1.


CoordenadasConversas does not work. The function I use is CoordenadaAIsometrico() - see below.

I applied the formula to convert from isometric to Cartesian, but it does not seem to work.

float cartesianX = (2.0f * isometricY + isometricX) * 0.5f;
float cartesianY = (2.0f * isometricY - isometricX) * 0.5f;


function Isometrico(){

ctx.save();

ctx.translate(0, 300);

ctx.scale(1, 0.5);

}

function CorIsometrico(xI,yI){

yI=yI-300;

yI=yI*2;
var angle = ((-45 * Math.PI /180) * -1)
var x2 = xI;

var y2 = yI;
var cos = Math.cos(angle);
var sin = Math.sin(angle);

var xI2 = Math.floor(x2 * cos - y2 * sin);
var yI2 = Math.floor(x2 * sin + y2 * cos);

console.log("Coor Isometricas:" + xI2  + "/"+  + yI2 );

}

var Xcc = (2 * Yc + Xc) * 0.5;

var Ycc = (2 * Yc - Xc) * 0.5;

//Xc=Xc-50;
//Yc=Yc+300;

console.log("CoordenadasConversas: " + Xcc + ":" +  Ycc);
}


• This seems very similar to your previous question. If you're still solving the same issue, I'd recommend editing your original question to update it with your progress / clarifications, rather than posting a near-duplicate. – DMGregory May 22 '19 at 10:41
• It is not the same. Before I was able to get the isometric coordinates by clicking with the mouse to find out which cell I'm pressing. Now it is to reverse that in order to apply a search algorithm and be able to move a character for each cell. Before Cartesian to isometric coordinates, now from isometric to Cartesian. – Albert May 22 '19 at 14:01

function IsometricoACartesiano(xI5,yI5){
var angle2 = ((45 * Math.PI /180) * -1);
var x22 = xI5;
var y22 = yI5;
var cos = Math.cos(angle2);
var sin = Math.sin(angle2);

var xI2 = Math.floor(x22 * cos - y22 * sin);
var yI2 = Math.floor(x22 * sin + y22 * cos);
yI2=yI2/2;
yI2=yI2+300;
console.log("U: " + xI2 + "/" + yI2 );
context.restore();
context.drawImage(habbo, xI2, yI2,ancho,alto);
}