# Path: fos/actor/primitives.py
# class Cylinder(Actor):
# 
#     def __init__(self, name, p1, p2, r1, r2, resolution = 4, color = (0.0, 1.0, 0.0, 1.0), wireframe = False):
#         """ A Cylinder actor. Creates cones if radius set to zero
#         """
#         super(Cylinder, self).__init__( name )
# 
#         self.vertices, self.faces = makeCylinder( p1, p2, r1, r2, resolution )
# 
#         self.wireframe = wireframe
#         self.color = color
# 
#         self.vertices_ptr = self.vertices.ctypes.data
#         self.faces_ptr = self.faces.ctypes.data
#         self.faces_nr = self.faces.size
# 
#     def draw(self):
#         glDisable(GL_CULL_FACE)
#         if self.wireframe:
#             glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
#         else:
#             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
#         glLineWidth(1.0)
#         glColor4f( self.color[0], self.color[1], self.color[2], self.color[3] )
#         glEnableClientState(GL_VERTEX_ARRAY)
#         glVertexPointer(3, GL_FLOAT, 0, self.vertices_ptr)
#         glDrawElements( GL_TRIANGLES, self.faces_nr, GL_UNSIGNED_INT, self.faces_ptr )
#         glDisableClientState(GL_VERTEX_ARRAY)
#         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
#         glEnable(GL_CULL_FACE)


import numpy as np
from pyglet.gl import *
from .base import *
from .primitives import Cylinder

class Axes(Actor):

    def __init__(self, name = "Cartesian Axes", scale = 1.0, linewidth = 1.0):
        """ Draw three axes
        """
        super(Axes, self).__init__( name )

        self.scale = scale
        self.linewidth = linewidth

        self.vertices = self.scale * np.array( [ 
            [0.0, 0.0, 0.0],[1.0, 0.0, 0.0],
            [0.0, 0.0, 0.0],[0.0, 1.0, 0.0],
            [0.0, 0.0, 0.0],[0.0, 0.0, 1.0]], dtype = np.float32 )

        # x axes arrow

# Path: fos/actor/primitives.py
# class Cylinder(Actor):
# 
#     def __init__(self, name, p1, p2, r1, r2, resolution = 4, color = (0.0, 1.0, 0.0, 1.0), wireframe = False):
#         """ A Cylinder actor. Creates cones if radius set to zero
#         """
#         super(Cylinder, self).__init__( name )
# 
#         self.vertices, self.faces = makeCylinder( p1, p2, r1, r2, resolution )
# 
#         self.wireframe = wireframe
#         self.color = color
# 
#         self.vertices_ptr = self.vertices.ctypes.data
#         self.faces_ptr = self.faces.ctypes.data
#         self.faces_nr = self.faces.size
# 
#     def draw(self):
#         glDisable(GL_CULL_FACE)
#         if self.wireframe:
#             glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
#         else:
#             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
#         glLineWidth(1.0)
#         glColor4f( self.color[0], self.color[1], self.color[2], self.color[3] )
#         glEnableClientState(GL_VERTEX_ARRAY)
#         glVertexPointer(3, GL_FLOAT, 0, self.vertices_ptr)
#         glDrawElements( GL_TRIANGLES, self.faces_nr, GL_UNSIGNED_INT, self.faces_ptr )
#         glDisableClientState(GL_VERTEX_ARRAY)
#         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
#         glEnable(GL_CULL_FACE)


# Path: fos/actor/axes.py
import numpy as np
from pyglet.gl import *
from .base import *
from .primitives import Cylinder


class Axes(Actor):

    def __init__(self, name = "Cartesian Axes", scale = 1.0, linewidth = 1.0):
        """ Draw three axes
        """
        super(Axes, self).__init__( name )

        self.scale = scale
        self.linewidth = linewidth

        self.vertices = self.scale * np.array( [ 
            [0.0, 0.0, 0.0],[1.0, 0.0, 0.0],
            [0.0, 0.0, 0.0],[0.0, 1.0, 0.0],
            [0.0, 0.0, 0.0],[0.0, 0.0, 1.0]], dtype = np.float32 )

        # x axes arrow

        self.x_cone = Cylinder( "XCone", np.array([0.8,0,0]), np.array([1.1,0,0]), 0.15, 0, 10, color = (1.0, 0, 0, 1.0) )