Пример #1
0
    def evaluateProjection(self, P0, surfs=None, Q=None):
        """ Computes projections from P0 to the supplied list of surfaces
            and returns the parametric coordinates of the closest point

        * Input *
        P0: double(n,3)
            List of n points to project onto the B-spline surface model
        surfs: integer(n)
            List of surfaces (0-based) to check
        Q: double(n,3)
            Optional list of directions along which to evaluate projection

        * Output *
        surf: integer(n)
            0-based list of surfaces of the projected points
        u: double(n)
            List of parametric coordinates in u of the projected points
        v: double(n)
            List of parametric coordinates in v of the projected points

        """

        if surfs==None:
            surfs = numpy.linspace(1,self.nsurf,self.nsurf)
        else:
            surfs = numpy.array(surfs) + 1
        if Q==None:
            surf,u,v = PUBSlib.evaluateprojection(P0.shape[0],surfs.shape[0],self.nD,self.nT,self.nC,self.nP,self.nsurf,self.nedge,self.ngroup,self.nvert,surfs,self.surf_vert,self.surf_edge,self.edge_group,self.group_k,self.group_m,self.group_n,self.group_d,self.surf_index_P,self.edge_index_P,self.surf_index_C,self.edge_index_C,self.knot_index,self.T,self.C[:,:3],self.P[:,:3],P0)
        else:
            surf,u,v = PUBSlib.evaluatepjtnalongq(P0.shape[0],surfs.shape[0],self.nD,self.nT,self.nC,self.nP,self.nsurf,self.nedge,self.ngroup,self.nvert,surfs,self.surf_vert,self.surf_edge,self.edge_group,self.group_k,self.group_m,self.group_n,self.group_d,self.surf_index_P,self.edge_index_P,self.surf_index_C,self.edge_index_C,self.knot_index,self.T,self.C[:,:3],self.P[:,:3],P0,Q)
        surf -= 1
        return surf,u,v
Пример #2
0
    def evaluateProjection(self, P0, surfs=None, Q=None):
        """ Computes projections from P0 to the supplied list of surfaces
            and returns the parametric coordinates of the closest point

        Input

        P0: double(n,3)
            List of n points to project onto the B-spline surface model

        surfs: integer(n)
            List of surfaces (0-based) to check

        Q: double(n,3)
            Optional list of directions along which to evaluate projection

        Output

        surf: integer(n)
            0-based list of surfaces of the projected points

        u: double(n)
            List of parametric coordinates in u of the projected points
            
        v: double(n)
            List of parametric coordinates in v of the projected points

        """

        if surfs is None:
            surfs = numpy.linspace(1, self.nsurf, self.nsurf)
        else:
            surfs = numpy.array(surfs) + 1
        if Q is None:
            surf, u, v = PUBSlib.evaluateprojection(
                P0.shape[0], surfs.shape[0], self.nD, self.nT, self.nC,
                self.nP, self.nsurf, self.nedge, self.ngroup, self.nvert,
                surfs, self.surf_vert, self.surf_edge, self.edge_group,
                self.group_k, self.group_m, self.group_n, self.group_d,
                self.surf_index_P, self.edge_index_P, self.surf_index_C,
                self.edge_index_C, self.knot_index, self.T, self.C[:, :3],
                self.P[:, :3], P0)
        else:
            surf, u, v = PUBSlib.evaluatepjtnalongq(
                P0.shape[0], surfs.shape[0], self.nD, self.nT, self.nC,
                self.nP, self.nsurf, self.nedge, self.ngroup, self.nvert,
                surfs, self.surf_vert, self.surf_edge, self.edge_group,
                self.group_k, self.group_m, self.group_n, self.group_d,
                self.surf_index_P, self.edge_index_P, self.surf_index_C,
                self.edge_index_C, self.knot_index, self.T, self.C[:, :3],
                self.P[:, :3], P0, Q)
        surf -= 1
        return surf, u, v