makaip / mathematix

A nodeblock-based math webapp.
https://makaip.github.io/mathematix/
GNU General Public License v3.0
4 stars 0 forks source link

X and Y axes don’t align with the grid lines in the graphing space #31

Closed Valenciola closed 7 months ago

Valenciola commented 7 months ago

As can be seen in this (beautiful) image here, Mathematix can accurately output functions. However, there’s a little bit of an issue when it comes to the actual lines in the graph: they don’t align with the white axes (x = 0 and y = 0 lines).

image

I’m not too sure, but maybe this can be fixed by just shifting the dark lines over a little bit, rather than shifting the axes (and the origin, which would end up shifting the entire graph location). I’ll have to investigate a little further.

Valenciola commented 7 months ago

It seems like taking a look at draw.js (https://github.com/makaip/mathematix/blob/main/grapher/draw.js) is a good place to start; I’ll see about this in the morning.

AlexanderJCS commented 7 months ago

draw.js is definitely the culprit here. Don't shift the gray lines over unless you have reason to suspect that those are the inaccurate ones. You can check this guys graphing y=x and seeing if it aligns perfectly (you may need to take a screenshot and zoom in).

It might just be a math error or something, or it doesn't account for the thickness of the line (highly doubt it, since it shouldn't need to do this, but maybe??).

Valenciola commented 7 months ago

Here you go, this is the graph of y=x in Mathematix. It's accurately passing through the origin created by the axes, but it's not hitting any of intersections created by the gray lines.

Screenshot (23)

This is why I thought it might be better to shift over the gray lines, since it appears like the functions are being graphed according to the position of the white lines.