Explore noneuclidean geometry
Source file: NonEuclideanExample
jReality offers the option to visualize scenes in non-euclidean geometries. To be precise, it offers hyperbolic and elliptic/spherical space alongside euclidean space. How this works is outside the scope of this tutorial -- see this popular account for the details.
This tutorial example demonstrates this metric neutrality of jReality. Run the program. You should see a yellow disk and a sphere, with edges and vertices drawn in red and blue respectively. This is a euclidean view. Type '1' key to cycle through the other metrics, first comes elliptic (positive curvature) and then hyperbolic (negative curvature). The scene is similar in all cases, consisting of the unit disk and a smaller sphere, but in all cases there are subtle differences related to the metric being used.
The program provides a rotate tool (using the left mouse) and a drag tool (attached to the middle mouse) which operate in conformity with the metric. There is also a fly tool on the arrow keys which also is metric corrrect.
The shading for the noneuclidean cases is carried out by an OpenGL shader which has almost but not all the same features as the standard DefaultPolygonShader used by jReality for the default euclidean case.
Also note that in the hyperbolic case the unit sphere (which is the set of points "at infinity" from hyperbolic space proper) is drawn as a wireframe sphere to aid in orienation.
The source code itself (see link above) has some comments to help you further understand the details. I hope to expand the text of this tutorial in the future but for now that's all I have time to write.