Skip to content

Commit

Permalink
Merge pull request #79 from Team-PLAT/feat/#74/trackOverlap
Browse files Browse the repository at this point in the history
[FEAT] 위치 조정 10배 증가
  • Loading branch information
dgh06175 authored Nov 2, 2024
2 parents a7a91c9 + b15f96d commit 5f4e8c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ private List<Double> editOverlapPosition(double latitude, double longitude, List
return editedPosition;
}
count++;
latitude += -0.0001 + (0.0002 * random.nextDouble());
longitude += -0.0001 + (0.0002 * random.nextDouble());
latitude += -0.001 + (0.002 * random.nextDouble());
longitude += -0.001 + (0.002 * random.nextDouble());
latitude = Math.round(latitude * 1_000_000) / 1_000_000.0;
longitude = Math.round(longitude * 1_000_000) / 1_000_000.0;
}
Expand All @@ -157,7 +157,7 @@ private boolean hasNearTrack(double la1, double lo1, List<Track> overlayTracks)
double lo2 = track.getLocation().getLongitude();
double distance = Math.sqrt(Math.pow(la1 - la2, 2) + Math.pow(lo1 - lo2, 2));

if (distance <= 0.0001) {
if (distance <= 0.001) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,15 @@ void addTrackTest() {
.isrc("test")
.imageUrl("https://testtest.com")
.content("테스트test")
.latitude(36.014108)
.longitude(129.325841)
.latitude(36.014188)
.longitude(129.325802)
.build();

// when
Long trackId1 = trackService.addTrack(member, trackUpload1).getTrackId();
Long trackId2 = trackService.addTrack(member, trackUpload2).getTrackId();

// then
TrackResponse.TrackDetail trackDetail1 = trackService.getTrackById(member, trackId1);
assertThat(trackDetail1.getLatitude()).isEqualTo(36.014188);
assertThat(trackDetail1.getLongitude()).isEqualTo(129.325802);
TrackResponse.TrackDetail trackDetail2 = trackService.getTrackById(member, trackId2);
assertThat(trackDetail2.getLatitude()).isNotEqualTo(36.014108);
assertThat(trackDetail2.getLongitude()).isNotEqualTo(129.325841);
Expand Down

0 comments on commit 5f4e8c8

Please sign in to comment.