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

Algo for vectorScale does poorly on irregular grids #11

Open
etpinard opened this issue Jun 6, 2018 · 2 comments
Open

Algo for vectorScale does poorly on irregular grids #11

etpinard opened this issue Jun 6, 2018 · 2 comments

Comments

@etpinard
Copy link
Member

etpinard commented Jun 6, 2018

See example in https://github.com/gl-vis/gl-cone3d/compare/irregular-grid-cone-size

On x/y/z and u/v/w data generated by (python code from https://plot.ly/~empet/14868/sizemode-and-sizeref-for-cone-trac/#/)

from scipy.integrate import odeint

def eq_vf(pos, t):
    x, y, z = pos 
    return  -y-z, x+0.2*y, 0.2+z*(x-5.7)

def Rossler_vf(x, y, z):
    return  -y-z, x+0.2*y, 0.2+z*(x-5.7)

pos0 = (0.6, 1, .0)
t = np.arange(0.0, 75, 0.025) 
pos = odeint(eq_vf, pos0, t)

I = [8*k for k in range(pos.shape[0]//8)]
newpos = pos[I,:]

x, y, z = newpos.T
u, v, w = Rossler_vf(x,y,z)

We get a maxNorm of ~64 and a minSeparation of ~0.26 making for a very small vectorScale and pretty much invisible small cones.


With this data, the field-wide maxNorm and minSeparation do a poor job of defining the spacing in-between each cone. Perhaps we should come up with a more "local" algorithm. One thing is sure, cones should be visible by default (w/o having to set coneSize) regardless of the input positions and vectors.

cc @kig @alexcjohnson who may have ideas about this.

@etpinard
Copy link
Member Author

etpinard commented Jun 6, 2018

cc plotly/plotly.js#2700 which is somewhat related.

@alexcjohnson
Copy link

A local algorithm would help - so basically, don't find the minimum separation between any two cones, but find the minimum scale at which each cone clearly avoids its neighbors. Seems straightforward enough, just collect the minimum of distance / norm or distance / (norm1 + norm2)

But I'm not sure that would be quite enough to satisfy the goal "cones should be visible by default" - someone could still place two cones right next to each other - like in this case I guess it's two concentric loops that came out very close to each other. I could come up with various expensive solutions, like find the maximum scale for each cone, then rather than just the minimum of those, take the 10th percentile, or average the minimum and median, something like that...

I wonder if there's a cheap solution though that would be robustly visible, and satisfactory in most situations? Like scaling the largest cone to a norm of K * data_extent / Math.pow(nCones, 1/3) where K is 0.5 or something, data_extent is the maximum distance between cones, or just Math.max(maxX-minX, maxY-minY, maxZ-minZ)? Not sure about the 1/3 power either, might be better to use 1/2 or something between the two?

Or perhaps a combination of these: try to use the minimum scale (local variant), but include a floor based on a simple formula like ^^ but with a smaller K?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants