Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cohen-Sutherland线段裁剪算法 #3

Closed
lewiszlw opened this issue May 18, 2023 · 1 comment
Closed

Cohen-Sutherland线段裁剪算法 #3

lewiszlw opened this issue May 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lewiszlw
Copy link

            if outcode & TOP != 0 {
                // 这里是不是应该为 p.x = pt1.x + (pt2.x - pt1.x) * (rect_max.y - pt1.y) / (pt2.y - pt1.y);
                p.x = p1.x + (pt2.x - pt1.x) * (rect_max.y - pt1.y) / (pt2.y - pt1.y);
                p.y = rect_max.y;
            } else if outcode & BOTTOM != 0 {
                // 这里是不是应该为 p.x = pt1.x + (pt2.x - pt1.x) * (rect_min.y - pt1.y) / (pt2.y - pt1.y);
                p.x = p1.x + (pt2.x - pt1.x) * (rect_min.y - pt1.y) / (pt2.y - pt1.y);
                p.y = rect_min.y;
            } else if outcode & RIGHT != 0 {
                p.y = pt1.y + (pt2.y - pt1.y) * (rect_max.x - pt1.x) / (pt2.x - pt1.x);
                p.x = rect_max.x;
            } else if outcode & LEFT != 0 {
                p.y = pt1.y + (pt2.y - pt1.y) * (rect_min.x - pt1.x) / (pt2.x - pt1.x);
                p.x = rect_min.x;
            }
@VisualGMQ
Copy link
Owner

是的,笔误了,感谢

VisualGMQ added a commit that referenced this issue May 18, 2023
@VisualGMQ VisualGMQ added the discuss 讨论问题 label May 18, 2023
@VisualGMQ VisualGMQ added bug Something isn't working and removed discuss 讨论问题 labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants