fix angle of icons along lines

fixes https://github.com/mapbox/mapbox-gl-native/issues/1242
This commit is contained in:
Ansis Brammanis
2015-04-09 12:05:16 -07:00
parent 0b779eaa8b
commit 9b0376e58e

View File

@@ -146,8 +146,8 @@ Placement Placement::getIcon(Anchor &anchor, const Rect<uint16_t> &image, float
float angle = layout.icon.rotate * M_PI / 180.0f;
if (anchor.segment >= 0 && layout.icon.rotation_alignment != RotationAlignmentType::Viewport) {
const Coordinate &next = line[anchor.segment];
angle += -std::atan2(next.x - anchor.x, next.y - anchor.y) + M_PI / 2;
const Coordinate &prev = line[anchor.segment];
angle += std::atan2(anchor.y - prev.y, anchor.x - prev.x);
}
if (angle) {