+ fix mesh trimming
This commit is contained in:
@@ -431,3 +431,19 @@ void Polygon2D::Intersect (const Polygon2D &rclPolygon, std::list<Polygon2D> &rc
|
||||
rclResultPolygonList.push_back(clResultPolygon);
|
||||
}
|
||||
|
||||
bool Polygon2D::Intersect (const Vector2D &rclV, double eps) const
|
||||
{
|
||||
if (_aclVct.size() < 2)
|
||||
return false;
|
||||
|
||||
size_t numPts = GetCtVectors();
|
||||
for (size_t i = 0; i < numPts; i++) {
|
||||
Vector2D clPt0 = (*this)[i];
|
||||
Vector2D clPt1 = (*this)[(i+1)%numPts];
|
||||
Line2D clLine(clPt0, clPt1);
|
||||
if (clLine.Intersect(rclV, eps))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,8 @@ public:
|
||||
// misc
|
||||
BoundBox2D CalcBoundBox (void) const;
|
||||
bool Contains (const Vector2D &rclV) const;
|
||||
void Intersect (const Polygon2D &rclPolygon, std::list<Polygon2D> &rclResultPolygonList) const;
|
||||
void Intersect (const Polygon2D &rclPolygon, std::list<Polygon2D> &rclResultPolygonList) const;
|
||||
bool Intersect (const Vector2D &rclV, double eps) const;
|
||||
|
||||
private:
|
||||
std::vector<Vector2D> _aclVct;
|
||||
|
||||
Reference in New Issue
Block a user