Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检查指定坐标是否在Bezier 曲线包围的区域内。我可以使用 GDI 中的特定功能吗?如果没有,我怎么能手动做到这一点?我的贝塞尔曲线由它的点设置。
你打算做多少查询? 如果性能不是很重要,你可以创建 GDI 区域并检查点是否在里面:
BeginPath draw enclosed path with PolyBezier and other functions EndPath PathToRegion PtInRegion
如果查询点很多,最好做解析解——计算从点开始的(水平)射线与贝塞尔曲线的交点数(需要三次方程解)。如果这个数字是奇数 - 点在里面(有一些微妙之处,在曲线尖点上有双根等)