class AgentRotationCalculator extends Object
Modifier and Type | Field and Description |
---|---|
private AgentModel |
agent |
private static int |
FLAGS_TO_COMPUTE_ROTATION |
Constructor and Description |
---|
AgentRotationCalculator(AgentModel agent)
Sets current AgentModel.
|
Modifier and Type | Method and Description |
---|---|
private void |
calculateRotation(List<Vector3D> absolute,
List<Vector3D> seen)
Infers agent's rotation from 3 seen flags.
|
private Map<Vector3D,Vector3D> |
getFlagsOfSideWithMoreFlagsSeen(Map<FixedObject,Vector3D> fixedObjects) |
private int[] |
orderToFormAxes(List<Vector3D> absolute)
Of 3 flags, determine which two of them to use to form Y axis
(0.
|
void |
updateRotations(ParsedData data)
Updates agent's rotation in current AgentModel from
last received data from server by calculation using fixed
objects(flags) and agents rotation and position.
|
private static final int FLAGS_TO_COMPUTE_ROTATION
private final AgentModel agent
public AgentRotationCalculator(AgentModel agent)
agent
- public void updateRotations(ParsedData data)
data
- private Map<Vector3D,Vector3D> getFlagsOfSideWithMoreFlagsSeen(Map<FixedObject,Vector3D> fixedObjects)
private void calculateRotation(List<Vector3D> absolute, List<Vector3D> seen)
absolute
- Global positions of seen flagsseen
- Perceived positions of seen flags