我在直线上给出了N个点,这些是 - (x1,y1),(x2,y2),....(xn,yn),这些点代表3D中的线。我希望这根线弯曲形成圆形和椭圆形。所以这些点将映射到圆和椭圆上的点。讲述一些将直线上的点映射到圆和椭圆上的点的映射技术。
答案 0 :(得分:3)
将线点减少为标量参数坐标0 <= t <= 1
。
将t
坐标乘以2*pi
(给出theta
)并将其插入参数圆等式中:
x = cos( theta )
y = sin( theta )
示例:
给定4个点(0,0),(1,1),(5,5)和(10,10)转换为参数坐标,如下所示:
length = | (10,10) - (0,0) | = sqrt( 10^2 + 10^2 ) = sqrt( 200 )
t0 = 0.0 = | (0,0) - (0,0) | / length = 0
t1 = 0.1 = | (1,1) - (0,0) | / length = sqrt( 2 ) / length
t2 = 0.5 = | (5,5) - (0,0) | / length = sqrt( 50 ) / length
t3 = 1.0 = | (10,10) - (0,0) | / length = sqrt( 200 ) / length
p0.x = cos( t0 * 2 * pi ) = 1
p0.y = sin( t0 * 2 * pi ) = 0
p1.x = cos( t1 * 2 * pi ) = 0.80901699437
p1.y = sin( t1 * 2 * pi ) = 0.58778525229
...