1. 3D engine
You should implement a simple server-side 3D engine for a MMO game
(without a visual representation).
The engine should download a 3D scene and allow to determine a crossing
of set rays with geometry (so called "ray casting"). The scene includes
objects, each of which is composed of triangular facets. Triangles are
two-sided, i.e. a ray may cross a triangle from any side.
A ray is described by an origin point and a direction vector, a crossing
of a ray with the first object (if any exists) should be determined.
Supposed amount of objects in the scene is 1 000 – 100 000, a large
amount of rays should be processed in efficient way in real time.
"Efficient" here implies, first of all, minimizing latency between
requests and responses (priority of latency over throughput).
The scene is set in the form of xml (xml-scheme, scene examples shall be
A running engine should read from stdin strings of the following type:
origin – coordinates of a ray start point, direction – a direction
vector. In general case vectors may be unnormalized:
The result should be put to stdout in the following format:
If there are no crossings, the "objectName" should not be printed.
Example of an output:
No other information shall be put to stdout, as it is supposed that the
output may be listened by some other program. Errors should be printed
to stderr, the format is free.
The solution should consume file name of scene as input parameter, e.
java -jar engine.jar scene.xml
In attached files:
scene.xsd — a XML-scheme
example1.xml — an example of a simple scene
example2.xml — a scene with 48 objects
Class for refactoring in attached files —
Our expectations from the execution of the tasks:
- OOP approach.
- TDD approach.
- Use of maven or gradle.
- Simple, clear and logical code.
Requirements to the execution of the tasks:
- Java or C#.
- All sources are on GitHub.
- Binary assemblies excluded.