Closed HadjerSahariYassir closed 1 year ago
Hi hadjersh97, Today I found time to check your issue. The following code works for me:
const tdDiagram = tdTermo.diagram;
const tdGroup = tdDiagram.svgNode.group();
tdDiagram.on('mousemove', ({ diagramPres, diagramTmpk }) => {
tdGroup.clear();
const thetaeAtPointer = equiPotentialTempByTempAndDewpointAndPres(diagramTmpk, diagramTmpk, diagramPres);
const y0 = 0;
const y1 = tdDiagram.coordinateSystem.height;
const x0 = tdDiagram.coordinateSystem.getXByYEquiPotTemp(y0, thetaeAtPointer);
const x1 = tdDiagram.coordinateSystem.getXByYEquiPotTemp(y1, thetaeAtPointer);
const thetaePolyline = [[x0, y0]];
const yInterval = 10;
for (let y=y0+yInterval; y<y1; y+=yInterval) {
thetaePolyline.push([
tdDiagram.coordinateSystem.getXByYEquiPotTemp(y, thetaeAtPointer),
y
]);
}
thetaePolyline.push([x1, y1]);
tdGroup
.polyline(thetaePolyline.map(point => {
point[1] = tdDiagram.coordinateSystem.height - point[1];
return point;
}))
.fill('none')
.stroke({ width: 1, color: 'red', dasharray: [5,5] });
});
If you use getNearestLevel()
you will get a pseudoadiabat crossing the sounding near a pressure level of the mouse.
Again, this has not a very good performance. Probably a higher yInterval
will be sufficient to get a good enough performance.
I hope this helps.
Hi Chird, yes thank you so much it's working. and i will take these notes in consideration. You have no idea how much you helped me !
Hi Chird, Hope you're doing well. I'm always trying to draw/move the thermodynamic lines, now i'm with the last one ( pseudo adiabatic ). i have followed your code to draw the pseudoadiabatic line , starting with calculating thetae( equipotential temperature) ,but i have issue the line is not drawn where mouse is put and in some places( specially in the right bottom ) the line is not drawn there . it seems because x and y are changing with equipotential temperature .
and here is the code :
so if you can help me to find the issue i would be grateful.