Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
Dynamic Gridlines calculation

The problem

Hello! I am creating a graphing application. Now I am creating the gridlines for the graphing calculator.

To manage to zoom, I have two variables; scale_x for the X-axis, and scale_y for the Y-axis. When I am zooming the gridlines has to change accordingly to the scaling.

I am trying to accomplish something like https://www.geogebra.org/calculator 's gridlines.

Their gridlines always space with a number that is either, a*10^b where a∈{1,2,5} and b is just which "step" you're at. Just try zooming out and look at the gridlines.

What I got

I am currently spacing the gridlines relative to the grids coordinate system, NOT the width and height of the screen.

var distance_x = 100 / (2**Math.floor((getBaseLog(2, scale_x))));
var distance_y = 100 / (2**Math.floor((getBaseLog(2, scale_y))));

This bit of code spaces the gridlines nicely but only with 2^something.

I'm not even sure why this is working, but I need it to work as GeoGebra's gridlines.

Anyone got an idea?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda