Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教为什么ssg这么计算夹角? #4

Open
loveheaven opened this issue Feb 15, 2021 · 1 comment
Open

请教为什么ssg这么计算夹角? #4

loveheaven opened this issue Feb 15, 2021 · 1 comment

Comments

@loveheaven
Copy link

请教为什么ssg这么计算夹角?我理解计算cone圆锥的夹角不是这么计算吧。

float djk = distance_->compare(data_ + dimension_ * (size_t)result[t].id,
data_ + dimension_ * (size_t)p.id,
(unsigned)dimension_);
float cos_ij = (p.distance + result[t].distance - djk) / 2 /
sqrt(p.distance * result[t].distance);
希望能得到指教。

@DelightRun
Copy link
Contributor

这就是余弦定理的公式啊:

cos A = (b²+c²-a²)/2bc

只是代码里算距离的函数默认算出来的是没开根号前的欧氏距离,带入余弦定理公式就是这个形态了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants