Exemplo n.º 1
0
void PlaneFit::Dimension(float& length, float& width) const
{
    const Base::Vector3f& bs = _vBase;
    const Base::Vector3f& ex = _vDirU;
    const Base::Vector3f& ey = _vDirV;

    Base::BoundBox3f bbox;
    std::list<Base::Vector3f>::const_iterator cIt;
    for (cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) {
        Base::Vector3f pnt = *cIt;
        pnt.TransformToCoordinateSystem(bs, ex, ey);
        bbox.Add(pnt);
    }

    length = bbox.MaxX - bbox.MinX;
    width = bbox.MaxY - bbox.MinY;
}
Exemplo n.º 2
0
Base::BoundBox3f Edgesort::getBoundingBox(std::vector<TopoDS_Edge>& aList)
{
    std::vector<TopoDS_Edge>::iterator aListIt;
    //Fill Bounding Boxes with Edges
    //Therefore we have to evaluate some points on our wire and feed the BBox Algorithm
    Base::BoundBox3f currentBox;
    currentBox.Flush();
    for (aListIt = aList.begin();aListIt!=aList.end();aListIt++)
    {
        BRepAdaptor_Curve curveAdaptor(*aListIt);
        GCPnts_QuasiUniformDeflection aProp(curveAdaptor,0.1);
        Base::Vector3f aPoint;
        for (int j=1;j<=aProp.NbPoints();++j)
        {
            aPoint.x = aProp.Value(j).X();
            aPoint.y = aProp.Value(j).Y();
            aPoint.z = aProp.Value(j).Z();
            currentBox.Add(aPoint);
        }
    }
    return currentBox;
}