GeomPlate_BuildAveragePlane bug?

GeomPlate_BuildAveragePlane returns really unexpected results [ see attach. ]
I construct the class from a wire, and fill in its vertices and expect and averaged plane that is a fair fit through the vertices.
However, I get something far from what I would expect... looks like a bug to me...
Different settings for tolerance, Poption, Noption lead to very similar results.

-jelle

=== CODE ===

def fit_plane(_wire):
verts = map(vertex2pnt, [i for i in Topo(_wire).vertices()])
array = TColgp_HArray1OfPnt(1, len(verts)+1)
for n,i in enumerate(verts):
array.SetValue(n+1,i)
from OCC.GeomPlate import GeomPlate_BuildAveragePlane
gbap = GeomPlate_BuildAveragePlane(array.GetHandle(), array.Length(), 1,1,1)
if gbap.IsPlane():
pl = gbap.Plane().GetObject()
return pl
else:
print 'FAILED TO COMPUTE PLANE'
return None

jelle's picture

This looks a lot better, where GeomPlate_BuildAveragePlane is called with normals and points.
However, I don't understand why the location of the planes is wrong.
The orientation does look fine however.

jelle's picture

More of a case of poor API documentation; the resulting plane has to be translated to the centre of mass of where ever it came from...