关于SetMatchMode(SPH_MATCH_EXTENDED)

官方文档里面的:@(title,body) hello world 的query貌似意思指的是在title和body两个字段中都必须存在"hello world"关键词,而不是任意一个字段匹配的意思。
如果要实现在title和body任意一个字段匹配关键词"hello world",但另外一个字段(比如author)里面包含某个关键词(比如"杨振宁"),
那么照着官方文档里面的例子:"hello world" @title "example program"~5 @body python -(php|perl) @* code去构造query是有问题,应该还需要加上括号:((@title "hello")|(@body"world ")) @author "杨振宁"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
将以下代码改为C++代码: import scipy.special as sp import numpy as np import numba from numba import njit,prange import math import trimesh as tri fileName="data/blub.obj" outName='./output/blub_rec.obj' # 参数 # 限制选取球谐基函数的带宽 bw=64 # 极坐标,经度0<=theta<2*pi,纬度0<=phi<pi; # (x,y,z)=r(sin(phi)cos(theta),sin(phi)sin(theta),cos(phi)) def get_angles(x,y,z): r=np.sqrt(x*x+y*y+z*z) x/=r y/=r z/=r phi=np.arccos(z) if phi==0: theta=0 theta=np.arccos(x/np.sin(phi)) if y/np.sin(phi)<0: theta+=math.pi return [theta,phi] if __name__=='__main__': # 载入网格 mesh=tri.load(fileName) # 获得网格顶点(x,y,z)对应的(theta,phi) numV=len(mesh.vertices) angles=np.zeros([numV,2]) for i in range(len(mesh.vertices)): v=mesh.vertices[i] [angles[i,0],angles[i,1]]=get_angles(v[0],v[1],v[2]) # 求解方程:x(theta,phi)=对m,l求和 a^m_lY^m_l(theta,phi) 解出系数a^m_l # 得到每个theta,phi对应的x X,Y,Z=np.zeros([numV,1]),np.zeros([numV,1]),np.zeros([numV,1]) for i in range(len(mesh.vertices)): X[i],Y[i],Z[i]=mesh.vertices[i,0],mesh.vertices[i,1],mesh.vertices[i,2] # 求出Y^m_l(theta,phi)作为矩阵系数 sph_harm_values=np.zeros([numV,(bw+1)*(bw+1)]) for i in range(numV): for l in range(bw): for m in range(-l,l+1): sph_harm_values[i,l*(l+1)+m]=sp.sph_harm(m,l,angles[i,0],angles[i,1]) print('系数矩阵维数:{}'.format(sph_harm_values.shape)) # 求解方程组,得到球谐分解系数 a_x=np.linalg.lstsq(sph_harm_values,X,rcond=None)[0] a_y=np.linalg.lstsq(sph_harm_values,Y,rcond=None)[0] a_z=np.linalg.lstsq(sph_harm_values,Z,rcond=None)[0] # 从系数恢复的x,y,z坐标,存为新的点云用于比较 x=np.matmul(sph_harm_values,a_x) y=np.matmul(sph_harm_values,a_y) z=np.matmul(sph_harm_values,a_z) with open(outName,'w') as output: for i in range(len(x)): output.write("v %f %f %f\n"%(x[i,0],y[i,0],z[i,0]))
最新发布
06-09

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值