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

Setting mesh scalars from array #152

Open
ivmartel opened this issue May 19, 2014 · 2 comments
Open

Setting mesh scalars from array #152

ivmartel opened this issue May 19, 2014 · 2 comments

Comments

@ivmartel
Copy link

Hi,
When setting the mesh scalars from an array (as suggested on L15 of lesson 12), it seems its min/max are not recalculated. I'm doing it this way:

mesh.scalars.array = xScalars;
mesh.scalars.lowerThreshold = min;
mesh.scalars.upperThreshold = max;
mesh.scalars.minColor = [0.69, 0.66, 0.91];
mesh.scalars.maxColor = [0.75, 0.60, 0.67];
mesh.modified();

This does not affect the display but dat.gui is lost for a threshold setting as:

var maxThresholdController = scalarsgui.add(mesh.scalars, 'upperThreshold',
   mesh.scalars.min, mesh.scalars.max);

I added a min/max find loop in the if (scalars ) { (L1132) of renderer3D.js which solves the problem. Is this correct or am I missing something?

@NicolasRannou
Copy link
Member

Great,

Could you please submit a pull request so we can have a look?

Best
Nicolas

On Mon, May 19, 2014 at 4:03 AM, ivmartel [email protected] wrote:

Hi,
When setting the mesh scalars from an array (as suggested on L15 of lesson
12http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/12/#run),
it seems its min/max are not recalculated. I'm doing it this way:

mesh.scalars.array = xScalars;mesh.scalars.lowerThreshold = min;mesh.scalars.upperThreshold = max;mesh.scalars.minColor = [0.69, 0.66, 0.91];mesh.scalars.maxColor = [0.75, 0.60, 0.67];mesh.modified();

This does not affect the display but dat.gui is lost for a threshold
setting as:

var maxThresholdController = scalarsgui.add(mesh.scalars, 'upperThreshold',
mesh.scalars.min, mesh.scalars.max);

I added a min/max find loop in the if (scalars ) { (L1132https://github.com/xtk/X/blob/master/visualization/renderer3D.js#L1132)
of renderer3D.js which solves the problem. Is this correct or am I missing
something?


Reply to this email directly or view it on GitHubhttps://github.com//issues/152
.

@ivmartel
Copy link
Author

I created a fiddle based on the cube example to demonstrate the problem. Interacting with the thresholds is difficult... It works better with the pull request I propose (#153).
And a comment/question, the colour gradient between the minimum and maximum seems to work better when the scalars range is [0,1]. Otherwise it saturates. New issue?

angleto pushed a commit to angleto/X that referenced this issue Aug 22, 2015
maskedCopy,maskedFill,maskedSelect
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