我从start
到end
有一个区间,其中start
和end
的类型为double
。我想将间隔分为n
个点,其中两个相邻点之间的距离相同。
例如:
// Given closed interval [-3.14,3.14]:
start = -3.14
end = 3.14
n = 3
// The 3 points would be:
-3.14,0.0,3.14
// Where the distance between each two neighboring points is 3.14
或者:
// Given left-closed,right-open interval [0,1):
start = 0
end = 1
n = 4
// The 4 points would be:
0.0,0.25,0.5,0.75
// Where the distance between each two neighboring points is .25
我对此有疑问,请多多指教