We have an array or points (double's X, Y, Z) they form a circle, starting from default rotation angles Xa, Ya, Za. We want to extend each point in our circle by one axes (say Z) on some random variable. How to do such thing in pseudocode?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Do you mean something like this (pseudocode):
void randomize(Point[] points, Axis axis, double scale) {
RandomNumberGenerator rng = new RandomNumberGenerator();
for (Point point : points) {
point[axis] += scale * rng.nextRandom();
}
}
If you need to displace points along some direction that is not an axis, you'd modify the above to compute the displacement vector components and add each component to the corresponding point coordinate.