using const references
This commit is contained in:
parent
69b05cc335
commit
2470e5a3af
@ -6,12 +6,12 @@ static float sign(float x, float y, float x1, float y1, float x2, float y2)
|
|||||||
return (x - x2) * (y1 - y2) - (x1 - x2) * (y - y2);
|
return (x - x2) * (y1 - y2) - (x1 - x2) * (y - y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float sign (Point &p1, Point &p2, Point &p3)
|
static float sign (const Point &p1, const Point &p2, const Point &p3)
|
||||||
{
|
{
|
||||||
return (p1.x() - p3.x()) * (p2.y() - p3.y()) - (p2.x() - p3.x()) * (p1.y() - p3.y());
|
return (p1.x() - p3.x()) * (p2.y() - p3.y()) - (p2.x() - p3.x()) * (p1.y() - p3.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPointInTriangle(Point &pt, Point &p1, Point &p2, Point &p3)
|
static bool IsPointInTriangle(const Point &pt, const Point &p1, const Point &p2, const Point &p3)
|
||||||
{
|
{
|
||||||
float d1 = sign(pt, p1, p2);
|
float d1 = sign(pt, p1, p2);
|
||||||
float d2 = sign(pt, p2, p3);
|
float d2 = sign(pt, p2, p3);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user