26 lines
686 B
C++
26 lines
686 B
C++
#include <engine/angle.hpp>
|
|
|
|
void Triangle::orderPoints(void)
|
|
{
|
|
Point minPoint;
|
|
WORD minIndex;
|
|
|
|
for(int ptIndex=0;ptIndex<VectorPoints;ptIndex++)
|
|
{
|
|
if(!ptIndex){minIndex=ptIndex;minPoint=operator[](ptIndex);}
|
|
else if((operator[](ptIndex).y()<minPoint.y())||(operator[](ptIndex).y()==minPoint.y()&&operator[](ptIndex).x()<minPoint.x()))
|
|
{
|
|
minIndex=ptIndex;
|
|
minPoint=operator[](ptIndex);
|
|
}
|
|
}
|
|
operator[](minIndex)=operator[](0);
|
|
operator[](0)=minPoint;
|
|
if((operator[](1).y()<operator[](2).y())||(operator[](1).y()==operator[](2).y()&&operator[](1).x()<operator[](2).x()))
|
|
{
|
|
minPoint=operator[](2);
|
|
operator[](2)=operator[](1);
|
|
operator[](1)=minPoint;
|
|
}
|
|
}
|