multi selection – should dual list orientation follow the language direction?

I got this question while working on a “Persian” app. As you may know, dual lists are consisted of 2 lists, where normally in a LTR language, the list on the left includes all the available options and the one on the right includes the ones that the user has selected from the left one. Now here’s my question: If the app’s language is a RTL one, should the order of the lists be reversed, meaning that the list with the available options be placed on the right, and the one with user’s selection on the left?

webmathematica – How can I plot a hexagon inside this cylinder so that it is always in the same direction as the cylinder, no matter what the orientation is?

How can I plot a hexagon inside this cylinder so that it is always in the same direction as the cylinder, no matter what the orientation is? In addition, the hexagon must always be the same size as the cylinder.

For example, start at the origin (10,9,8) and go to (1,2,3)?

Graphics3D ({Cylinder ({{10, 9, 8}, {1, 2, 3}}, 0.5)}

I tried this:

Table (Show (Graphics3D (Cylinder ({{0., 0., 0}, {0., 0., l}}, 1)), PolyhedronData ({"Prism", 6})), {l, 0.1 , 3, 0.1})

shaders – Need help getting an objects orientation / all my OpenGL rotations are reversed

I’m using OpenGL on Ubuntu Linux with the Eclipse IDE and the GCC compiler. I am bringing blender models into a homemade renderer/game engine.
I parse a text file containing object descriptions to load models.

Example object:

begin_object generic_object
generic_object_name lampost
generic_object_parent_name world
generic_object_position -10.0000 -10.0000 2.000000
generic_object_rotation 90.000000 0.000000 0.000000
generic_object_scale 1.000000 1.000000 1.000000
end_object

begin_object ...

The generic_object_rotation 90.000000 0.000000 0.000000 line describes 3 values:

  • Rotation around Z (XY).
  • Rotation around X (YZ).
  • Rotation around Y (XZ).

After going through all the headaches of Euler angles and their gimbal lock and singularities, I switched all my code to quaternions (highly recommended).

I am told that a counter-clockwise rotation around the Z-axis, looking down the Z-axis toward the origin uses a rotation matrix like:

cos(theta)  -sin(theta)  0  0
sin(theta)  cos(theta)   0  0
0           0            1  0
0           0            0  1

I got this from a document (rotgen.pdf) off the Song-Ho website.

If I replace theta with +90.0 (just like in my input file above), the result is:

  0.0 ,  -1.0 ,  0.0 ,  0.0  
  1.0 ,   0.0 ,  0.0 ,  0.0 
  0.0 ,   0.0 ,  1.0 ,  0.0 
-10.0 , -10.0 ,  2.0 ,  1.0

So, I make a quaternion for +90.0 degrees, turn it into a matrix and then print out the matrix to see if it is the same, and I actually get the same matrix.

  0.0 ,  -1.0 ,  0.0 ,  0.0  
  1.0 ,   0.0 ,  0.0 ,  0.0 
  0.0 ,   0.0 ,  1.0 ,  0.0 
-10.0 , -10.0 ,  2.0 ,  1.0

All is well… Then, I send this matrix to the shader to draw this object and it rotates my object CW instead.

In the shader there’s:

gl_Position = projection_matrix * view_matrix * model_matrix * vec4( aPos , 1.0 );

which seems correct.

So, I made a cube in Blender, attached different colour textures to each side of the cube so I could verify that my input data was good and, as long as the model_matrix is the identity matrix, the object is oriented correctly in space. Any time I add rotations, the models rotate in the
opposite direction. This happens on all 3 axes.

My current goal/project is the parenting system. I want to be able to extract orientation and position from the model matrix of any object (that data is stored with the object).

Specifically, right now, I want to extract the forward vector from the model_matrix so I can attach a light source to this rotating object. Set its light direction for the fragment shader. That is when I found this error.

What I am seeing:
The rotation of the object is opposite to what I command. When I rotate 0-360 over and over again, the forward vector I am reading from the objects model_matrix diverges from the direction of the object until it gets to 180 degrees, where the face of the object and the forward vector are coincident again; then they diverge again until we reach 360 and they are again coincident.

What I expect (and this may be part of my issue):
I want the rotation part of the model_matrix that rotates the object to be the current orientation of the object. And it looks like it is but the object does not render that way. The object rotates in the opposite direction (which is preventing me from getting the correct light direction vector, i.e. the forward vector).

Is this an OpenGL thing? Is the orientation of an object the transpose of the 3×3 rotation section of the model_matrix?

unity – Orientation changed event in Unity3D?

I’d like to listen to orientation change events, so for example my UI layout or the components themselves can be changed.

All I’ve found is that I should check the value of Screen.orientation every frame, and check if it has changed since previous frame.

But this isn’t really efficient, and I wonder why doesn’t Unity provide an event for this.

This asset seems to have what I need. Anyone knows how is it implemented?

As a last resort I could make a singleton behaviour which starts a coroutine which checks every X seconds whether it has changed, and if it has, I fire an event. But this still seems like a suboptimal solution.

plotting – Fit ellipse to a arbitrary 2D image to extract centroid, orientation, major, minor axis

The similar command in MMA is ComponentMeasurement. It lists all detected bright components of an image with desired parameter.

a = Import(
  "https://www.mathworks.com/matlabcentral/answers/uploaded_files/
253610/diskimage1.jpeg");

cm = ComponentMeasurements(
  Binarize@a, {"Centroid", "SemiAxes", "Orientation"})

{1 -> {{488.496, 386.124}, {750.908, 620.778}, 3.14156},
2 -> {{438.5, 868.5}, {3.66324, 2.63965}, -1.5708},
3 -> {{526.5, 868.87}, {3.31766, 2.55314}, -1.5708},
4 -> {{539., 871.}, {2.23607, 1.}, 3.14159},
5 -> {{513.864, 866.591}, {2.17306, 1.53368}, -2.87856},
6 -> {{499.6, 483.975}, {205.184, 190.328}, -0.834907},
7 -> {{349.5, 626.}, {1., 0.5}, -1.5708}}

The result contains more than one entry because the presence of the caption on top of the image together with white frame. The needed spot is number six (with second biggest value of simiaxes).

Show(Binarize@a,
 Epilog -> {
   Red,
   Rotate(
    Circle(cm((6, 2, 1)), cm((6, 2, 2))), 
    cm((6, 2, 3)))
   },
 ImageSize -> Automatic)

enter image description here

usability – Is there any study on landscape/ vertical orientation of Apps?

I am working on the UX part of an App to interact with hardware.
You would first design graphic and text images, and then the hardware would personalize your “view”. (Sorry I am vague, not able to disclose much more)

Bottom line is: The app has been designed exclusively for Landscape orientation, but I have not used any landscape app in… forever. I am worried it is not going to be well received.
Therefore I was wondering:

 Is there any study on customer preference of Landscape over Portrait orientation?

metro – Are there any statistics on what orientation people prefer to hold tablets at?

The question “on what orientation do people prefer to hold their tablets at?” is very similar to the question: “Do people prefer landscape oriented photographs or portrait oriented photographs”? There is no correct answer to this question since it depends entirely on the actual picture. In case of tablets: it depend on the application. In contrast to a TV or a movie theater, a tablet is by definition a device with which you can easily adapt the orientation depending on the application. Some applications will do better with portrait mode, others will do better in landscape mode, others can make good use of both orientations if well implemented. So the best answer to your question is: users will prefer to hold the tablet in the orientation the application was designed for.

Now, over to your real question: “is it good UX to have the portrait mode show a detailed view of a selected item while the landscape mode shows an overview?”
In my opinion, viewing the details of a selected item is best done by… selecting the item. Not by rotating the screen.

scanning – Preferred scan orientation for all-in-one scanner

I want to scan a photograph using the flatbed scanner in my all-in one printer (Samsung C460W). The long side of the photograph is shorter than the short side of the scan bed, so I could scan it in either landscape or portrait orientation.

Would either of these orientations produce a higher-quality result? The specifications say it can scan at 600×600 dpi, but I assume that in the scanning direction this is achieved by the movement of the scan had, whilst in the perpendicular direction this is limited by the scan sensor’s resolution. So if I align e.g. the short size of the photograph with the short size of the scan bed, I am not utilizing the maximum possible sensor photocells.

Does either of the two directions have a higher quality and if so, which one?

(I cannot see a striking difference in images scanned in the two different directions, so I suppose the differences – if any – are small. But I am still interested to know whether there is an academic difference.)