## ergonomics – Why are monitors only at neck height by default?

I have full freedom in where I place my monitors.

The one closest to my keyboard, I want to be close to my keyboard. So it is below eye level, the bottom only barely over my hands. This is convenient so I can move my eyes from screen to keyboard easily.

The other I have with about 10% of the screen above my eyes – I can see the screen content without craning my neck up, and everything comfortably in me view when looking straight forwards.

For people with a single monitor, proximity to the keyboard would seem a good driving reason to make the screen lower.

[Edit:

Hrm – someone downvoted? Do they disbelieve that proximity to the keyboard matters from a UX point of view? I am forced to disagree, it matters significantly to me. Perhaps for formally-trained touch-typists who’re only ever typing and not regularly moving hands from mouse to keyboard and back, it might not be – the keyboard can even be hidden! But for what I’d argue is the overwhelming majority, the keyboard and mouse are focal parts of the work area, need to be visible, and hence need to be close to the screen.

Even for those with hidden keyboards, I’d argue that the workplace focus should never be directly ahead. Workbenches have never worked like this, neither have drafting tables, nor easels, nor any line of work I can think of. The focal point is usually down from the eyes, somewhere around or just above the hands, since that’s what we are used to looking at, and working with.

So for even my highest monitor, the midpoint is about 15 degrees down from eye-level.]

## Calculating the expected height of a randomly built binary search tree

I need to calculate the expected height of a randomly built binary search tree, BST, with 4 different keys: $$x < y < z < w$$

According to Catalan numbers, there are 14 possible trees, 8 with height 3 and 6 with height 2. So let $$X$$ be a random discrete variable that holds the tree height, $$P{X=2}=frac{6}{14}=frac{3}{7}$$ and $$P{X=3}=frac{8}{14}=frac{4}{7}$$ hence $$E[X]=2cdot frac{3}{7} + 3cdotfrac{4}{7} = frac{18}{7}approx 2.571$$

But then I thought, not all the trees in Catalan numbers has the same probability of occurring as there are 24 ways to order the keys, so instead I get $$P{X=2}=frac{16}{24}=frac{2}{3}$$ and $$P{X=3}=frac{8}{24}=frac{1}{3}$$ and $$E[X]=2cdot frac{2}{3} + 3cdotfrac{1}{3} = frac{4}{3} + 1 = frac{7}{3} approx 2.333$$

I’m not sure which way is the correct way to calculate the probability of the possible values for $$X$$

## physics – How to make a variable height jump controlled by parameters?

I’m trying to make a variable height jump controlled by parameters. I want to be able to specify the max height of my jump, and a time to max height. I also want to be able to specify a min jump height.
My understanding is we construct a jump by using max_height and time_to_max to calculate gravity.

``````func gravity(height, peak_time):
return -2 * height / pow(peak_time * 2, 2)
``````

Because min_jump_height uses the same gravity as max jump height, it’s time to peak is not determined directly, but through the other variables. I calculate my initial velocity based on my min_jump_height and gravity:

``````func initial_velocity(gravity, min_height):
return sqrt(2 * -gravity * min_height)
``````

As usual, I apply gravity each frame:

``````velocity += gravity * delta
``````

How do I make it so that each frame the jump button is held a little more is added to velocity such that the original peak height is hit at peak time? This is, in effect, compensating through interpolation for if my initial velocity had been targeted to my max_height instead of my min_height. I imagine there might be more than one valid form of interpolation to solve this problem and I’d be interested in any of them, but the simplest will do.

## How to best select a texture pair to use in height blending when using a splatmap shader

In my project, I’m implementing a shader to combine up to 4 textures in a terrain using a splatmap texture (https://en.wikipedia.org/wiki/Texture_splatting).

I want to combine the splatmap blending with the height blending technique, described in: http://untitledgam.es/2017/01/height-blending-shader/. This technique basically defines a function to interpolate between two textures more realistically based on height information.

The problem is, in order to use height blending, I need to know which pair of textures I’ll be interpolating, while in the splatmap I actually have four different texture sets (channels, R G B and A).

So what I want to achieve is a shader that will select the pair of textures for which the splatmap channel information is strongest, and interpolate between the two while discarding others. My “naïve” attempt was something along the lines of (simplified version, pseudo-code and only for illustrative purposes):

``````uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D splat;

sampler2D sampler;
if (splat.r > splat.g) {
sampler = tex1;
} else {
sampler = tex2;
}
}
``````

The problem, I realized, is that I can’t store samplers inside a variable like this due to limitations in GLSL. So I’m looking for a soultion that would be similar to this. Particularly, I would want to avoid a solution where I’m sampling all four textures for every texture lookup. That is because I will be using some expensive techniques inside the shader which require several texture lookups, and I don’t want to increase the computation cost 2x.

## OpenGL height map accuracy for planetary rendering

I am trying to implement planetary rendering and I am trying to use OpenGL tessellation to model the terrain. Here is an overview picture using cube faces projected onto a sphere:

If I use the following code for the tessellation evaluation shader, I get a smooth sphere even when rendering a near view.

``````#version 410 core
in mediump vec2 texcoord_tes();
out mediump vec2 texcoord_geo;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
vec2 c = mix(texcoord_tes(0), texcoord_tes(1), gl_TessCoord.x);
vec2 d = mix(texcoord_tes(3), texcoord_tes(2), gl_TessCoord.x);
texcoord_geo = mix(c, d, gl_TessCoord.y);
vec4 a = mix(gl_in(0).gl_Position, gl_in(1).gl_Position, gl_TessCoord.x);
vec4 b = mix(gl_in(3).gl_Position, gl_in(2).gl_Position, gl_TessCoord.x);
vec4 p = mix(a, b, gl_TessCoord.y);
float s = 1.0 / sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}
``````

Here is a near view using the computed scaling factor (`float s = 1.0 / sqrt(p.x ...)`):

However if I take the scale factors from a floating-point texture, I can see quantisation artifacts.
The scale factors (or heightmap values) are extracted from the texture using `float s = texture(hf, texcoord_geo).r`. The code for the tessellation evaluation shader in this case is as follows:

``````#version 410 core
in mediump vec2 texcoord_tes();
out mediump vec2 texcoord_geo;
uniform sampler2D hf;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
vec2 c = mix(texcoord_tes(0), texcoord_tes(1), gl_TessCoord.x);
vec2 d = mix(texcoord_tes(3), texcoord_tes(2), gl_TessCoord.x);
texcoord_geo = mix(c, d, gl_TessCoord.y);
float s = texture(hf, texcoord_geo).r;
vec4 a = mix(gl_in(0).gl_Position, gl_in(1).gl_Position, gl_TessCoord.x);
vec4 b = mix(gl_in(3).gl_Position, gl_in(2).gl_Position, gl_TessCoord.x);
vec4 p = mix(a, b, gl_TessCoord.y);
gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}
``````

In this case the near view looks like this and shows artifacts:

My question is, what am I doing wrong?
Or is it normal that OpenGL textures are less accurate than 4-byte floating point numbers?
Any help is appreciated.

## keep Mega Menu height Responsive for 40% all the time

this site was a real pain, everything they asked for was a challenge to get it work, now they need mega menu to be exactly 40% on any screens, what is the best way and maybe fastest way to achieve that?

site URL:
http://medija.ir

.

## android – Why is screen HEIGHT not taken into consideration while designing responsive layouts for mobile apps?

### Preface

When we’re talking about the interfaces, we’re obliged to take into account the devices that makes us possible to display the content we aim to see. So that the main medium when the term `responsivity` was introduced was computer screens/displays and `web` through `computers`.

As you might imagine displays of all the computers/notebooks, the screens are rectangular on default and people using these displays intend to make browsers/applications minimized via reducing it’s width rather than the height as it opens more broader and wider area.

Doesn’t responsive layout mean that my app should look the same in devices of all widths and heights?

Well, it’s just because in these days mostly people are mobile users and the term need to be updated as the term `responsivity` originally also covers the same issue. Or there might be attempts to describe the concept differentially as only mobile users ran into this seperation since web is mostly on rectangular screens.

If 2 devices have a lot of difference in HEIGHT, my app in one device
will look drastically different from the one in other device

Besides you’re totally correct and even it’s the same for width for development point of view, it might mostly happening beacuse the heights are used %100 to fit all the screen sizes for mobile preferably. But that’s not my main arguement and point to avoid using responsivity as a height on mobile or web eventually.

## theming – How to create a new region with 100% width and auto height

I searched everywhere but found nothing.

I need to create a 100% region to be placed above the Content region so I can place a full screen slide on it but I don’t know how to do it or else I would need to create a css section within the Content region to use as I wish when I also want it a certain section of some page is at 100% without necessarily modifying the current structure of the body which is not full screen but with a precise and smaller size.

How to do this new region and/or a specific 100% width section unattached from the body style?

## unity – How to make an object jump an equal height whenever it hits the ground?

So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can’t use Physics Materials. Here are some ways that I tried:

Used Physics.CheckSphere:

``````isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
}
``````

Used Raycast:

``````bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{