由自定义超立方体包围的点
我有一个 N 维向量、沿每个维度的 X 和“n”等距点以及参数“delta”。我需要一种方法来找到超立方体包含的 n^N 个向量的总数,该超立方体以向量 X 为中心,超立方体每边的大小为 2*delta。
例如:
考虑 N=3 的情况,因此我们有一个大小为 (2*delta) 的立方体,包围点 X。
------------\
|\--------|--\
| | X | |
----------- |
\ |_2*del___\|
沿着每个维度,我有“n”个点。所以,我在 X 周围总共有 n^3 个向量。我需要找到所有向量。有没有相同的标准算法/方法?如果您做过类似的事情,请推荐。
如果问题不清楚,请告诉我。
这就是我所看到的:考虑一维,边长是 2*delta 并且我有 n 个分区。因此,每个细分的大小为 (2*delta/n)。所以我只是移动到原点 (x-delta)(因为 x 是边的中点)并通过 {(x-delta) + 1*(2*delta/n) 获得“n”个点, (x-delta) + 2*(2*delta/n)....+ (x-delta) + 1*(n*delta/n) } 。我对所有 N 维执行此操作,然后对坐标进行排列。这样我就拥有了所有的点。
(我想关闭此)
I have a N-dimensional vector, X and 'n' equidistant points along each dimension and a parameter 'delta'. I need a way to find the total of n^N vectors enclosed by the Hypercube defined with the vector X at the center and each side of Hypercube being of size 2*delta.
For example:
Consider a case of N=3, so we have a Cube of size (2*delta) enclosing the point X.
------------\
|\--------|--\
| | X | |
----------- |
\ |_2*del___\|
Along each dimension I have 'n' points. So, I have a total of n^3 vectors around X. I need to find all the vectors. Is there any standard algorithm/method for the same? If you have done anything similar, please suggest.
If the problem is not clear, let me know.
This is what I was looking at: Considering one dimension, length of a side is 2*delta and I have n divisions. So, each sub-division is of size (2*delta/n). So I just move to the origin that is (x-delta) (since x is the mid point of the side) and obtain the 'n' points by {(x-delta) + 1*(2*delta/n),(x-delta) + 2*(2*delta/n)....+ (x-delta) + 1*(n*delta/n) } . I do this for all the N-dimensions and then take a permutation of the co-ordinates. That way I have all the points.
(I would like to close this)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解你的问题,你有一个以 X 点为中心的轴对齐超立方体,并且你已将该超立方体的内部细分为规则晶格,其中晶格点和间距位于超立方体的坐标系中。您所要做的就是让 X = 0,找到每个格点的向量,然后返回并通过 X 平移它们。
编辑:让我添加一个示例
let x = (5,5,5), delta = 1 且 n = 3
然后,将 x 移动到原点,您的格点为 (-1, -1, -1), (0, -1, -1), (1, -1, -1) 等等总共 27 个。翻译回来,我们有 (4, 4, 4), (5, 4, 4), (6, 4, 4) 等等。
If i understand your problem correctly, you have an axis-aligned hypercube centred around a point X, and you have subdivided the interior of this hypercube into a regular lattice where the lattice points and spacing are in the coordinate system of the hypercube. All you have to do is let X = 0, find the vectors to each of the lattice points, and then go back and translate them by X.
Edit: let me add an example
let x = (5,5,5), delta = 1 and n = 3
then, moving x to the origin, your lattice points are (-1, -1, -1), (0, -1, -1), (1, -1, -1) and so on for a total of 27. translating back, we have (4, 4, 4), (5, 4, 4), (6, 4, 4) and so on.
好吧,我没有完全理解你的问题。 N 维超立方体中的一个点总共有 2^(N-1)*N 条“线”。
如果您只想在看起来像轴的线上创建 n 个点,但平移距离原点 delta 距离,这里有一些(为了清晰起见,写得不好)MATLAB 代码:
该代码适用于立方体,但它应该适用于我所做的就是:
显示:
Ok, I didn't fully understand your question. There are total of
2^(N-1)*N
"lines" about a point in an N-dimensional hypercube.If you just want to create n points on lines which look like the axis, but translated at a distance of delta from the origin, here's some (poorly written, for clarity) MATLAB code:
The code's for a cube, but it should work for any N. All I've done is:
Display: