# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# A vector in 3D space that represents a direction only
class Vector3(object):
    __slots__ = ['_tab']

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

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

    # x coordinate length
    # Vector3
    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 1.0

    # y coordinate length
    # Vector3
    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 1.0

    # z coordinate length
    # Vector3
    def Z(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 1.0

def Vector3Start(builder): builder.StartObject(3)
def Start(builder):
    return Vector3Start(builder)
def Vector3AddX(builder, x): builder.PrependFloat64Slot(0, x, 1.0)
def AddX(builder, x):
    return Vector3AddX(builder, x)
def Vector3AddY(builder, y): builder.PrependFloat64Slot(1, y, 1.0)
def AddY(builder, y):
    return Vector3AddY(builder, y)
def Vector3AddZ(builder, z): builder.PrependFloat64Slot(2, z, 1.0)
def AddZ(builder, z):
    return Vector3AddZ(builder, z)
def Vector3End(builder): return builder.EndObject()
def End(builder):
    return Vector3End(builder)