_swig_getattr AttributeError
I'm getting an attribute error using swig to wrap a c function for use in python code. I've got other functions alongside chap that work just fine, but some strange reason this one will not work :/
I'm trying to use CGAL to determine the Convex Hull of All Particles (chap). Below is the chap function and the traceback:
std::vector<Vec2d> World::chap() const
{
std::vector<Point_2> ch;
std::vector<Point_2> points;
std::vector<Vec2d> result;
for(size_t i = 0, sz = particles.size(); i < sz; ++i)
{
points.push_back(Point_2(particles[i]->position.x, particles[i]->position.y));
}
CGAL::convex_hull_2(points.begin(), points.end(), std::back_inserter(ch));
for(size_t i = 0, sz = ch.size(); i < sz; ++i)
{
result.push_back(Vec2d(ch[i].x(), ch[i].y()));
}
return result;
}
Traceback (most recent call last):
File "keiro.py", line 64, in <module>
if scenario.run():
File "/Users/marcstrauss/Desktop/keiro/scenario.py", line 56, in run
dt = self.world.advance()
File "/Users/marcstrauss/Desktop/keiro/world.py", line 87, in advance
view.add_ch(self.chap())
File "/Users/marcstrauss/Desktop/keiro/fast/physics.py", line 312, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, World, name)
File "/Users开发者_StackOverflow中文版/marcstrauss/Desktop/keiro/fast/physics.py", line 34, in _swig_getattr
raise AttributeError,name
AttributeError: chap
Is the function public? I got the same error when trying to call a function declared as Protected. The SWIG C++ manual notes that Private and Protected functions will not be wrapped
精彩评论