官术网_书友最值得收藏!

29. Line-line intersection

Write a program that determines where two lines intersect. Let the user left-click twice to define one line and right-click twice to define another. Be sure that the program can handle horizontal and vertical lines, and the case when the lines are parallel.

Hint: Use a parametric definition for the lines as in p = p0 + t × v where p0 is a point on the line, v is a vector pointing in the direction of the line, and t is a real number parameter. If that doesn't make sense to you, then read the solution. You may want to stop after the explanation and try to implement the code yourself before you read the entire solution.
主站蜘蛛池模板: 喀喇| 楚雄市| 富蕴县| 汶上县| 杂多县| 庐江县| 郑州市| 永济市| 平果县| 章丘市| 广汉市| 绍兴县| 抚松县| 长泰县| 大洼县| 沂南县| 金沙县| 北宁市| 卢氏县| 崇礼县| 长垣县| 新竹县| 化州市| 建昌县| 金塔县| 界首市| 凌海市| 嘉善县| 永州市| 嘉善县| 河间市| 视频| 万山特区| 七台河市| 雷波县| 东乌| 清苑县| 收藏| 五寨县| 新营市| 政和县|