<commit_before>//
//  Geometry+Drawable.swift
//  SwiftGraphics
//
//  Created by <NAME> on 1/17/15.
//  Copyright (c) 2015 schwa.io. All rights reserved.
//

import SwiftGraphics


extension CGPoint : Geometry {
    public var frame:CGRect { get { return CGRect(center:self, diameter:0) } }
}

extension CGPoint : Drawable {
    public func drawInContext(ctx:CGContext) {
        ctx.plotPoints([self])
    }
}




extension BezierCurve: Drawable {

    public var frame:CGRect {
        get {
            return self.boundingBox
        }
    }


    public func drawInContext(context:CGContext) {
        context.stroke(self)
    }
}

extension Circle : Drawable {
    public func drawInContext(ctx:CGContext) {
        ctx.strokeEllipseInRect(frame)
    }
}

extension Triangle : Drawable {
    public func drawInContext(ctx:CGContext) {
        let (a,b,c) = points
        ctx.strokeLine([a, b, c], close:true)
    }
    public var frame : CGRect {
        get {
            let (a,b,c) = self.points
            let points = [a,b,c]
            let rects:[CGRect] = points.map {
                return $0.frame
            }
            println(rects)
            return CGRect.unionOfRects(rects)
        }
    }
}


public struct Saltire {
    public let frame:CGRect

    public init(frame:CGRect) {
        self.frame = frame
    }
}

extension Saltire: Drawable {
    public func drawInContext(context:CGContext) {
        context.strokeSaltire(frame)
    }
}<commit_msg>RegularPolygon now drawable.<commit_after>//
//  Geometry+Drawable.swift
//  SwiftGraphics
//
//  Created by <NAME> on 1/17/15.
//  Copyright (c) 2015 schwa.io. All rights reserved.
//

import SwiftGraphics

extension CGPoint : Geometry {
    public var frame:CGRect { get { return CGRect(center:self, diameter:0) } }
}

extension CGPoint : Drawable {
    public func drawInContext(ctx:CGContext) {
        ctx.plotPoints([self])
    }
}

extension BezierCurve: Drawable {

    public var frame:CGRect {
        get {
            return self.boundingBox
        }
    }


    public func drawInContext(context:CGContext) {
        context.stroke(self)
    }
}

extension Circle : Drawable {
    public func drawInContext(ctx:CGContext) {
        ctx.strokeEllipseInRect(frame)
    }
}

extension Triangle : Drawable {
    public func drawInContext(ctx:CGContext) {
        let (a,b,c) = points
        ctx.strokeLine([a, b, c], close:true)
    }
    public var frame : CGRect {
        get {
            let (a,b,c) = self.points
            let points = [a,b,c]
            let rects:[CGRect] = points.map {
                return $0.frame
            }
            return CGRect.unionOfRects(rects)
        }
    }
}


public struct Saltire {
    public let frame:CGRect

    public init(frame:CGRect) {
        self.frame = frame
    }
}

extension Saltire: Drawable {
    public func drawInContext(context:CGContext) {
        context.strokeSaltire(frame)
    }
}

extension RegularPolygon: Drawable {

    public var frame:CGRect {
        get {
            return self.circumcircle.frame
        }
    }

    public func drawInContext(context: CGContext) {
        let path = Path(vertices:points, closed:true)
        let mode = CGPathDrawingMode(strokeColor:context.strokeColor, fillColor:context.fillColor)
        CGContextAddPath(context, path.CGPath)
        CGContextDrawPath(context, mode)
    }
}

{'fraction_non_alphanumeric': 0.10220913107511045, 'fraction_numerical': 0.006480117820324006, 'mean_word_length': 2.2373689227836033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3512855', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1050, 'n_words': 232}