(Random random, int index)
| 107 | } |
| 108 | |
| 109 | private static Arguments getRandom(Random random, int index) { |
| 110 | final double YAW_FACTOR = 360; |
| 111 | final double YAW_OFFSET = 0; |
| 112 | final double PITCH_FACTOR = 180; |
| 113 | final double PITCH_OFFSET = -90; |
| 114 | final double CARTESIAN_FACTOR = 256; |
| 115 | final double CARTESIAN_OFFSET = -128; |
| 116 | |
| 117 | Vector vector; |
| 118 | Location location; |
| 119 | if (random.nextBoolean()) { |
| 120 | float pitch = (float) (random.nextDouble() * PITCH_FACTOR + PITCH_OFFSET); |
| 121 | float yaw = (float) (random.nextDouble() * YAW_FACTOR + YAW_OFFSET); |
| 122 | |
| 123 | location = getEmptyLocation(); |
| 124 | location.setPitch(pitch); |
| 125 | location.setYaw(yaw); |
| 126 | |
| 127 | vector = location.getDirection(); |
| 128 | } else { |
| 129 | double x = random.nextDouble() * CARTESIAN_FACTOR + CARTESIAN_OFFSET; |
| 130 | double y = random.nextDouble() * CARTESIAN_FACTOR + CARTESIAN_OFFSET; |
| 131 | double z = random.nextDouble() * CARTESIAN_FACTOR + CARTESIAN_OFFSET; |
| 132 | |
| 133 | location = getEmptyLocation(); |
| 134 | vector = new Vector(x, y, z).normalize(); |
| 135 | |
| 136 | location.setDirection(vector); |
| 137 | } |
| 138 | |
| 139 | return Arguments.of("R" + index, |
| 140 | vector.getX(), vector.getY(), vector.getZ(), |
| 141 | location.getYaw(), location.getPitch() |
| 142 | ); |
| 143 | } |
| 144 | |
| 145 | @ParameterizedTest |
| 146 | @MethodSource("data") |
no test coverage detected