worked on 3d models within map

adjusted grid factory
adjusted nav mesh factory
minoor changes/fixes
new helper classes
refactoring
This commit is contained in:
2018-04-03 14:55:59 +02:00
parent f3b6155157
commit 1c2081d406
25 changed files with 620 additions and 93 deletions

View File

@@ -44,6 +44,19 @@ struct HelperPoly {
bbox_cm.add(p.xy());
}
void shrink(float cm) {
Point2 center;
for (const Point2 pt : points_cm) {center += pt;}
center /= points_cm.size();
for (Point2& pt : points_cm) {
Point2 dir = pt - center;
float len = dir.length();
dir = dir.normalized();
pt = center + dir * (len-cm);
}
}
/** does the polygon contain the given point (in cm)? */
bool contains(const Point2 p_cm) const {