Geometry.h

#pragma once


#include "Point.h"
#include "Segment.h"


namespace Robotics
{
    typedef array< Point > Points;


    /// 幾何学
    public ref class Geometry
    {
    // Operation -----------------------------------------------------------
    protected:
        int GetIndexOfPointInCorner( Points^ point );

        double GetCoefficientComparisonOfAngle( Point point1, Point point2 );
        int WhetherAngleIsPlusOrMinus( Point middle, Point left, Point right );

        bool IsSegmentIntersect( Segment segment1, Segment segment2 );

        void QuickSort( int leftEdge, int rightEdge, array< double >^ reference, Points^% points );
        void Swap( double% left, double% right );


    // static
    public:
        static Points^ GrahamScan( Points^ vertices );

        static double CalculateDistanceOfPointAndSegment( Point point, Segment segment );
        static bool IsInsideOfPolygon( Points^ vertices, Point target );

    };
}