📄 kdtreeleafnode.cpp
字号:
#include "KDTreeLeafNode.hpp"#include <set>using namespace indii::ml::aux;KDTreeLeafNode::KDTreeLeafNode() : x(0), w(0.0) { //}KDTreeLeafNode::KDTreeLeafNode(const vector& x, const double w) : x(x), w(w) { /* pre-condition */ assert (w > 0.0); //}KDTreeLeafNode::~KDTreeLeafNode() { //}double KDTreeLeafNode::getWeight() { return w;}vector& KDTreeLeafNode::getLower() { return x;}vector& KDTreeLeafNode::getUpper() { return x;}vector KDTreeLeafNode::nearestTo(const vector& x) { /* pre-condition */ assert (x.size() == this->x.size()); return this->x;}double KDTreeLeafNode::densityAt(const vector& x, Norm& N, Kernel& K) { return w * K(N(x - this->x));}vector KDTreeLeafNode::sample(const double u, Norm& N, Kernel& K) { /* pre-condition */ assert (u >= 0.0 && u <= getWeight()); return x + K.sample() * N.sample(x.size());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -