简体   繁体   English

有理贝塞尔曲线的透视投影

[英]Perspective projection of rational bezier

I need a method to project 3d conics to 2d.我需要一种将 3d 圆锥投影到 2d 的方法。 None of the articles tell how to do this with rational beziers.没有一篇文章说明如何使用理性贝塞尔曲线来做到这一点。 Another thing I need a method for is moving 3d or 2d conics to 4d or 3d respectively (as in a reverse projection).我需要一种方法的另一件事是将 3d 或 2d 圆锥分别移动到 4d 或 3d(如反向投影)。 I read somewhere that rational beziers can be split by moving them to a higher dimension and splitting the resulting non-rational curve with de Casteljau and then moving back.我在某处读到,有理贝塞尔曲线可以通过将它们移动到更高维度并用 de Casteljau 分割得到的非有理曲线然后向后移动来分割。 I seem to recall that perspective projection of conic beziers can be represented exactly with conic beziers, and that it may involve splitting into several curves.我似乎记得圆锥贝塞尔曲线的透视投影可以用圆锥贝塞尔曲线精确表示,并且它可能涉及分割成几条曲线。 I don't understand any of the articles on any site on beziers.我不理解任何关于贝塞尔的网站上的任何文章。

Since there aren't any better answers, here's what I can offer off the top of my head...由于没有更好的答案,这就是我可以提供的...

Perspective transformation can change parabolas into ellipses or hyperbolas and vice-versa, so even though P0, P1, and P2 can be directly mapped, the weights will change.透视变换可以将抛物线变为椭圆或双曲线,反之亦然,因此即使可以直接映射 P0、P1 和 P2,权重也会发生变化。

Assuming a conic with weights (1,w,1), however, the distance along the line from (P0+P2)/2 to P1 at which it intersects the curve is simply related to the weight w, and that lets you find the new weight as follows:然而,假设一个权重为 (1,w,1) 的圆锥曲线,沿着从 (P0+P2)/2 到 P1 的直线与曲线相交的距离与权重 w 简单相关,这可以让您找到新重量如下:

  1. Map P0, P1, and P2 to P0', P1', P2'将 P0、P1 和 P2 映射到 P0'、P1'、P2'
  2. Calculate the midpoint M' = (P1'+P2')/2计算中点 M' = (P1'+P2')/2
  3. Inverse map M' to M, and calculate the intersection point I of the line M-P1 with the original curve.逆映射M'到M,计算M-P1线与原曲线的交点I。
  4. Map the intersection point I to I', to get the point at which the new curve should intersect M'-P1'将交点 I 映射到 I',以获得新曲线应与 M'-P1' 相交的点
  5. Calculate the new weight w' from the position of the intersection I'.从交点 I' 的位置计算新的权重 w'。 The curve gets to I at t=0.5, so w' = (M'-I')/(P1'-I').曲线在 t=0.5 时到达 I,因此 w' = (M'-I')/(P1'-I')。 Note that this division makes sense, because the vectors being divided are collinear.请注意,这种划分是有意义的,因为被划分的向量是共线的。 You can divide their lengths or just the largest coordinate.您可以划分它们的长度或仅划分最大坐标。

If you expand out all the steps, I'm sure there are ways to simplify this procedure.如果您扩展所有步骤,我相信有一些方法可以简化此过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM