Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work out how to derive a column from a node coordinate #19

Closed
ncatlin opened this issue Oct 1, 2016 · 1 comment
Closed

Work out how to derive a column from a node coordinate #19

ncatlin opened this issue Oct 1, 2016 · 1 comment
Labels

Comments

@ncatlin
Copy link
Owner

ncatlin commented Oct 1, 2016

Drawing text is horribly slow, there are lots of instructions -> we only want to draw the instruction labels on the screen.

To do this, rgat uses colour picking - regularly (a few times a second) drawing a sphere to the screen with 32 columns with a green gradient and 16 rows with a red gradient. It looks like this:
colpickspheresmall

Before it's cleared, we check the green value of the pixel either side of the screen (and the red on top and bottom, but those values are not used yet).

This tells us the columns we need to draw text in.

Then we iterate through every node on the graph to checking if it is within those columns.

The problem with this is that my maths is horrendous. The formula to convert a node coordinate to a column looks like this [graphicsMaths.cpp]:

node column = floor(<horizontal coordinate> / (COLOUR_PICKING_MYSTERY_CONSTANTA / <horizontal edge separation>)) % 32;

The constant was found by looking at a few example row/node mappings and multiplying them.
eg: coord 8a is between col 0 and 1 at h_edge_sep ~1.39.
-> 1.39*8 = 11.12

(The constant that has worked best so far is 11.16).

This generally works but it gets very dubious at high graph widths and breaks entirely when the graph starts wrapping a long way around the sphere.

@ncatlin ncatlin added the bug label Oct 1, 2016
@ncatlin
Copy link
Owner Author

ncatlin commented Mar 26, 2017

solved with deprecation of the sphere

@ncatlin ncatlin closed this as completed Mar 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant