sal*_*iem 2 algorithm math geometry
这是我要解决的问题:
我有一个不规则的形状.如何在这个形状上均匀分布5个点,使每个点之间的距离相等?
red*_*una 10
大卫说这是不可能的,但事实上左边有一个答案:把你所有的点放在彼此之上!它们与所有其他点的距离都相同:零.
实际上,无论输入形状如何,这是唯一具有解决方案的算法(即所有成对距离都相同).
我知道这个问题要求"均匀"地提出要点,但由于这没有正式定义,我希望这只是试图解释"所有成对距离是相同的",在这种情况下我的回答是"均匀".
this is mathematically impossible. It will only work for a small subset of base shapes.
There are however some solutions you might try:
Analytic approach. Start with a point P0, create a sphere around P0 and intersect it with the base shape, giving you a set of curves C0. Then create another point P1 somewhere on C0. Again, create a sphere around P1 and intersect it with C0, giving you a set of points C1, your third point P2 will be one of the points in C1. And so on and so forth. This approach guarantees distance constraints, but it also heavily depends on initial conditions.
Iterative approach. Essentially form-finding. You create some points on the object and you also create springs between the ones that share a distance constraint. Then you solve the spring forces and move your points accordingly. This will most likely push them away from the base shape, so you need to pull them back onto the base shape. Repeat until your points are no longer moving or until the distance constraint has been satisfied within tolerance.
Sampling approach. Convert your base geometry into a voxel space, and start scooping out all the voxels that are too close to a newly inserted point. This makes sure you never get two points too close together, but it also suffers from tolerance (and probably performance) issues.
If you can supply more information regarding the nature of your geometry and your constraints, a more specific answer becomes possible.