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

[Mesh] 2D display of mesh has a side effect on field values #3796

Closed
chapuisk opened this issue Apr 26, 2023 · 2 comments
Closed

[Mesh] 2D display of mesh has a side effect on field values #3796

chapuisk opened this issue Apr 26, 2023 · 2 comments
Assignees
Labels
About Grids This issue concerns grids and fields 😱 Bug The issue reveals a bug in GAMA V. 1.9.1 Bug specific to the 1.9.1 release
Milestone

Comments

@chapuisk
Copy link
Contributor

Describe the bug

First issue : when rendering a field in a 2D display, it changes the values of cells {0,0} and {1,0} to reflect min and max (sort of meta-data) of init field (or the very first changes) - and then those cells do not change anymore. Turning the display to 3D solve the problem. Also if you have a 2D and a 3D display, those 2 cells are the same in BOTH displays, meaning it mess up directly with field values.

Second issue : when rendering a field in a 2D display, it seems that cells with max x and max y (i.e. in the display the bottom line and the column at the right) are not properly rendered

To Reproduce
Steps to reproduce the behavior:
Run the model at the bottom of the issue

Expected behavior
Mesh should not mess up with fields

Screenshots

See a random experiments :

Screen Shot 2023-04-26 at 16 33 04

Desktop (please complete the following information):

  • OS: macOS Monterey (also on windows 11)
  • PC Model: Apple M1
  • GAMA version: 1.9.1
  • Java version: JDK embedded
  • Graphics cards / Display system:

Additional context

The model I use to generate screenshots:

model NewModel

global {
	
	field f <- field(100,100);
	
	init {
		do upfield( range(100) collect ({rnd(100),rnd(100)}) , 10);
	}
	
	reflex flex {
		do upfield( range(5) collect ({rnd(100),rnd(100)}) , 10);
	}
	
	action upfield(list<point> c, int up) { loop xy over:c { f[xy] <- f[xy] + up; } }
	
}

experiment xp type:gui {
	output {
		display main type:3d {
			mesh f scale:0.0 color:palette([#black, #green, #yellow, #pink]);
		}
		display main type:2d {
			mesh f scale:0.0 color:palette([#black, #green, #yellow, #pink]);
		}
	}
}
@chapuisk chapuisk added 😱 Bug The issue reveals a bug in GAMA About Grids This issue concerns grids and fields V. 1.9.1 Bug specific to the 1.9.1 release labels Apr 26, 2023
@AlexisDrogoul AlexisDrogoul changed the title [Mesh] 2D display of mesh mess up with filed values [Mesh] 2D display of mesh has a side effect on field values Apr 26, 2023
@AlexisDrogoul AlexisDrogoul added this to the GAMA 1.9.2 milestone Apr 26, 2023
@AlexisDrogoul
Copy link
Member

Related in some ways to #3607 -- I corrected the first issue, but there is a problem displaying the last row and column in both Java2D and OpenGL (in the latter, these values are not displayed at all).

@AlexisDrogoul
Copy link
Member

After further investigations : the oddities in your last row and column do not come from the display but from the way you compute the values. fields do not emit "out of bounds" error (notably to accommodate for models where agents are outside the boundaries of the world or just at the boundaries. So when you write :

	reflex flex {
		do upfield( range(5) collect ({rnd(100),rnd(100)}) , 10);
	}

There is a 1% probability that you obtain points with either x or y equal to 100 and this probability will add up to the probability of obtaining 99 (as these points are considered at the boundary). The result is that the last row and column have twice the chance to be "upped" than the others, hence your strange values.

Two things:

  1. Using {rnd(99),rnd(99)} obviously solves the issue
  2. The fact that this doesn't show up on 3D displays is a reminiscence of In 3d displays, grids do not (always) fill the whole screen #3607 : the last row and column are simply not displayed in some cases. So there is a bug here, but not exactly what you described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
About Grids This issue concerns grids and fields 😱 Bug The issue reveals a bug in GAMA V. 1.9.1 Bug specific to the 1.9.1 release
Projects
None yet
Development

No branches or pull requests

2 participants