我使用mathematica(使用版本8)遇到了很大的问题。 绘制Voronoi图是很简单的事情,但如何改变规范呢?
<< DiscreteMath`ComputationalGeometry`
data2D = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5,
14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6,
5.1}, {5.3, 2.4}, {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9,
3.1}, {11, 1.1}};
DiagramPlot[data2D, LabelPoints -> False]
给出了与L_2范数(欧几里德范数)相对应的Voronoi图。 我需要L_1范数和L_infinity范数的图...
答案 0 :(得分:7)
来自Mma help(仅近似值):
ColorCombine[{Image[ WatershedComponents[
DistanceTransform[i, DistanceFunction -> ManhattanDistance]],
"Bit"], i, i}]
注意:请注意,Voronoi多边形的凸性属性会丢失......