<commit_before>#Figure file for the GeoMath library
from math import sqrt

class Figure:
    "Figure Object in GeoMath library"

    def __init__(self):
        self.points = []

    def add_point(self, point):
        self.points.append((point))

    def add_points(self, point):
        for p in point:
            self.points.append((p))

    # Perimeter formula for getting the figure perimeter
    def perimeter(self):
        "Perimeter Property for Figure Object in GeoMath library"
        perimeter = 0.0
        if len(self.points) >= 3:
            points = self.points + [self.points[0]]
            for i in range(len(self.points)):
                perimeter += Line.distance(points[i], points[i+1])
            return(perimeter)
        else:
            return("You need at least 3 points to calculate the Perimeter property!")


    # Calculating figure barycenter
    def barycenter(points):
        "Barycenter Property for Figure Object in GeoMath library"

        i = 0
        arrayx = []
        arrayy = []
        for point in points:
            arrayx.append(point.x)
            arrayy.append(point.y)

        XPoint = sum(arrayx) / len(arrayx)
        YPoint = sum(arrayx) / len(arrayy)

        return(("Point(%s, %s)") % (XPoint, YPoint))

    def area(self):
        _points = self.points
        if len(_points) == 3:
            # Triangle
            # Calculate the area with matrix
            pass
        elif len(_points) == 4:
            # Square or rectangle
            pass
        elif len(_points) > 4:
            # Polygon
            pass


    def __repr__(self):
        pontos = ""
        for point in self.points:
            pontos = pontos + str(point) + " "
        figureString = "Figure Points: " + pontos
        return(figureString)
<commit_msg>Added Figure area and points<commit_after>#Figure file for the GeoMath library
from math import sqrt

class Figure:
    "Figure Object in GeoMath library"

    def __init__(self, figureType=None):
        self.polygonPoints = []

    def add_point(self, point):
        self.polygonPoints.append((point))

    def add_points(self, point):
        for p in point:
            self.polygonPoints.append((p))

    def area(self):
        """
        Area Class based on a StackOverflow post
        """
        n = len(self.polygonPoints) # of corners
        a = 0.0
        for i in range(n):
            j = (i + 1) % n
            a += abs(self.polygonPoints[i].x * self.polygonPoints[j].y - self.polygonPoints[j].x * self.polygonPoints[i].y)
        result = a / 2.0
        return result

    def perimeter(self):
        "Perimeter Property for Figure Object in GeoMath library"
        n = len(self.polygonPoints)
        p = 0.0
        for i in range(n):
            j = (i + 1) % n
            p += abs(self.polygonPoints[i].distance(self.polygonPoints[j]))
        return(p)

    def barycenter(points):
        "Barycenter Property for Figure Object in GeoMath library"

        i = 0
        arrayx = []
        arrayy = []
        for point in points:
            arrayx.append(point.x)
            arrayy.append(point.y)

        XPoint = sum(arrayx) / len(arrayx)
        YPoint = sum(arrayx) / len(arrayy)

        return(("Point(%s, %s)") % (XPoint, YPoint))

    def area(self):
        _points = self.polygonPoints
        if len(_points) == 3:
            # Triangle
            # Calculate the area with matrix
            pass
        elif len(_points) == 4:
            # Square or rectangle
            pass
        elif len(_points) > 4:
            # Polygon
            pass

    def __repr__(self):
        points = ""
        for point in self.polygonPoints:
            pontos = pontos + str(point) + " "
        figureString = "Figure Points: " + points
        return(figureString)

class Circumference():
    def __init__(self):
        self.centerPoint = None
        self.radius = 0
        self.area = 0
        self.perimeter = 0

{'fraction_non_alphanumeric': 0.10166079516859587, 'fraction_numerical': 0.006290890790135883, 'mean_word_length': 1.7816655003498951, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6227638', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1135, 'n_words': 329}