# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# A primitive representing a cylinder, elliptic cylinder, or truncated cone
class CylinderPrimitive(object):
    __slots__ = ['_tab']

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

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

    # Position of the center of the cylinder and orientation of the cylinder. The flat face(s) are perpendicular to the z-axis.
    # CylinderPrimitive
    def Pose(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Pose import Pose
            obj = Pose()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Size of the cylinder's bounding box
    # CylinderPrimitive
    def Size(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Vector3 import Vector3
            obj = Vector3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # 0-1, ratio of the diameter of the cylinder's bottom face (min z) to the bottom of the bounding box
    # CylinderPrimitive
    def BottomScale(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 0.0

    # 0-1, ratio of the diameter of the cylinder's top face (max z) to the top of the bounding box
    # CylinderPrimitive
    def TopScale(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Color of the cylinder
    # CylinderPrimitive
    def Color(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Color import Color
            obj = Color()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def CylinderPrimitiveStart(builder): builder.StartObject(5)
def Start(builder):
    return CylinderPrimitiveStart(builder)
def CylinderPrimitiveAddPose(builder, pose): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pose), 0)
def AddPose(builder, pose):
    return CylinderPrimitiveAddPose(builder, pose)
def CylinderPrimitiveAddSize(builder, size): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(size), 0)
def AddSize(builder, size):
    return CylinderPrimitiveAddSize(builder, size)
def CylinderPrimitiveAddBottomScale(builder, bottomScale): builder.PrependFloat64Slot(2, bottomScale, 0.0)
def AddBottomScale(builder, bottomScale):
    return CylinderPrimitiveAddBottomScale(builder, bottomScale)
def CylinderPrimitiveAddTopScale(builder, topScale): builder.PrependFloat64Slot(3, topScale, 0.0)
def AddTopScale(builder, topScale):
    return CylinderPrimitiveAddTopScale(builder, topScale)
def CylinderPrimitiveAddColor(builder, color): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0)
def AddColor(builder, color):
    return CylinderPrimitiveAddColor(builder, color)
def CylinderPrimitiveEnd(builder): return builder.EndObject()
def End(builder):
    return CylinderPrimitiveEnd(builder)