Redian新闻
>
[静态后端W21]Review Swift's dispatch implementation
avatar
i*D
2
我想判断3d空间中一个线段和在一个点的关系. 这个点在这个线段的直线上,我想判断
它在线段的两个端点之间还是在之外. 这个问题本身是一个明确的判断,不能容忍error
和tolerance.
比如线段是AB, 另外一个点是C. 我的方法是判断if AB-(AC+BC)<0. 但是在实际运算中
,我发现即便是C在AB之间,也有很多时候AB-(AC+BC)<0. 应该是因为round off error.
不知道有什么好的trick或者策略来解决这个问题.
avatar
i*e
3
Fucking Eric Schmidt is a fucking pussy.
-Steve Ballmer
avatar
x*x
4
这个意见可以考虑。如果需要我捐钱
avatar
k*g
5
If it is given beyond doubt that C is a point on the line extension of AB,
then C is outside the finite segment AB iff
C is outside the axis-aligned bounding box
the cartesian product with
( all x in (xmin, xmax) ) and
( all y in (ymin, ymax) )
where xmin = min ( A_x , B_x )
xmax = max ( A_x , B_x )
etc etc.
for 3D, 4D etc just apply cartesian product over all dimensions.
Upon thinking about that, it seems that even if you apply a unitary
coordinate transform (unitary rotation and/or mirroring) the "iff" still
holds. Not very sure, but seems interesting.
Not a proof.. just a sketch of idea. No guarantee. If there is a mistake
please leave a comment. Thanks.
avatar
i*D
6
我想判断3d空间中一个线段和在一个点的关系. 这个点在这个线段的直线上,我想判断
它在线段的两个端点之间还是在之外. 这个问题本身是一个明确的判断,不能容忍error
和tolerance.
比如线段是AB, 另外一个点是C. 我的方法是判断if AB-(AC+BC)<0. 但是在实际运算中
,我发现即便是C在AB之间,也有很多时候AB-(AC+BC)<0. 应该是因为round off error.
不知道有什么好的trick或者策略来解决这个问题.
avatar
k*g
7
If it is given beyond doubt that C is a point on the line extension of AB,
then C is outside the finite segment AB iff
C is outside the axis-aligned bounding box
the cartesian product with
( all x in (xmin, xmax) ) and
( all y in (ymin, ymax) )
where xmin = min ( A_x , B_x )
xmax = max ( A_x , B_x )
etc etc.
for 3D, 4D etc just apply cartesian product over all dimensions.
Upon thinking about that, it seems that even if you apply a unitary
coordinate transform (unitary rotation and/or mirroring) the "iff" still
holds. Not very sure, but seems interesting.
Not a proof.. just a sketch of idea. No guarantee. If there is a mistake
please leave a comment. Thanks.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。