You can use the LineSegs class to create line segments easily; it’s not too much work from there to draw a circular arc:
def makeArc(angleDegrees = 360, numSteps = 16):
ls = LineSegs()
angleRadians = deg2Rad(angleDegrees)
for i in range(numSteps + 1):
a = angleRadians * i / numSteps
y = math.sin(a)
x = math.cos(a)
ls.drawTo(x, 0, y)
node = ls.create()
return NodePath(node)
If you want a solid pie wedge, it’s probably easiest to use the egg library:
def makeWedge(angleDegrees = 360, numSteps = 16):
data = EggData()
vp = EggVertexPool('fan')
data.addChild(vp)
poly = EggPolygon()
data.addChild(poly)
v = EggVertex()
v.setPos(Point3D(0, 0, 0))
poly.addVertex(vp.addVertex(v))
angleRadians = deg2Rad(angleDegrees)
for i in range(numSteps + 1):
a = angleRadians * i / numSteps
y = math.sin(a)
x = math.cos(a)
v = EggVertex()
v.setPos(Point3D(x, 0, y))
poly.addVertex(vp.addVertex(v))
node = loadEggData(data)
return NodePath(node)
genPyCode is the program that generates the Python wrapper classes around the actual C++ classes. Whenever you do something like:
n = NodePath('foo')
you are actually creating two objects: a C++ NodePath object, and a Python NodePath wrapper that redirects all of your Python calls into the C++ object. It’s genPyCode that generates all of the code to define the Python wrappers–basically everything that you bring in when you import pandac.PandaModules.
Normally, genPyCode is run on all of the libraries that Panda3D is compiled with, so that you have all of the C++ objects available in Python. By mistake, we omitted libpandaegg, so you had all of the objects except the ones in the egg library.
So, no, sorry–there’s no other secret libraries you can suddenly gain access to via genPyCode.