TPath


This object has been removed in release 10.0.0.

Describes path which consists of segments where each segment could be line or bezier curve.

You can find more information in comments below.

template<class PointType, class FloatType> // Type is a data type of points(usually it's an integer) 
    class TPath
    {
    public:
        struct SEGMENT // Describes segment 
        {
            SEGMENT_TYPE SegmentType; // Segment type 
            size_t Index; // Start point index 
            size_t Equation; // Equation index 
            math::TRect<PointType> Bounds; // Bounding rectangle 
        };
    public:
        TPath(); // Create empty 
        TPath(const math::TPoint<PointType> &start_point); // Create with start point 
        TPath(const TPath &other) = default;
        TPath(TPath &&other) = default;
    
        // STL 
        typename std::vector<SEGMENT>::size_type size() const;
        typename std::vector<SEGMENT>::const_iterator cbegin() const;
        typename std::vector<SEGMENT>::const_iterator cend() const;
        typename std::vector<SEGMENT>::const_iterator begin() const;
        typename std::vector<SEGMENT>::const_iterator end() const;
        typename std::vector<SEGMENT>::const_reverse_iterator crbegin() const;
        typename std::vector<SEGMENT>::const_reverse_iterator crend() const;
        typename std::vector<SEGMENT>::const_reverse_iterator rbegin() const;
        typename std::vector<SEGMENT>::const_reverse_iterator rend() const;
        const math::TPoint<PointType> &operator[](const typename std::vector<math::TPoint<PointType>>::size_type index) const;
        void clear();
    
        bool isClosed() const; // Return whether it is closed(last point is equal to first one) 
        math::TRect<PointType> getBounds() const; // Calculate bounding rectangle 
        const TLineEquation<FloatType> &getLineEquation(const size_t index) const; // Return line equation by index 
        const TBezierEquation<PointType> &getBezierEquation(const size_t index) const; // Return bezier equation by index 
    
        void AddStartPoint(const math::TPoint<PointType> &p); // Add start point. Can be called only on empty path 
        void LineTo(const math::TPoint<PointType> &p); // Add line from last point to specified one 
        void BezierTo(const math::TPoint<PointType> &p2, const math::TPoint<PointType> &p3); // Add bezier segment using last added point and two specified points 
    
        typename std::vector<SEGMENT>::const_iterator FirstSegment(const FloatType hline, FloatType &x); // Find segment index which intersects with hline. Stores intersection x-coordinate in x argument 
        typename std::vector<SEGMENT>::const_iterator NextSegment(const FloatType hline, const FloatType min_x, FloatType &x); // Find next the nearest segment which intersects horizontal line with hline y-coordinate and intersection point is >= min_x. If found, x is intersection point 
        std::vector<FloatType> Intersections(const FloatType hline, const bool sort); // Find all segments which intersect with hline. Optionally sort them by X-coordinate 
        bool TestPoint(const math::TPoint<PointType> &p); // Check whether point is inside path or not 
    };
Namespace: nitisa::graphics
Include: Nitisa/Modules/Graphics/Path.h