# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# A point representing a position in 2D space
class Point2(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Point2()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsPoint2(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # Point2
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # x coordinate position
    # Point2
    def X(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # y coordinate position
    # Point2
    def Y(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

def Point2Start(builder): builder.StartObject(2)
def Start(builder):
    return Point2Start(builder)
def Point2AddX(builder, x): builder.PrependFloat64Slot(0, x, 0.0)
def AddX(builder, x):
    return Point2AddX(builder, x)
def Point2AddY(builder, y): builder.PrependFloat64Slot(1, y, 0.0)
def AddY(builder, y):
    return Point2AddY(builder, y)
def Point2End(builder): return builder.EndObject()
def End(builder):
    return Point2End(builder)