by F. Yang
PKU1031题意描述:在坐标原点处有一个点光源S. 在距离S为r处的亮度为
,
其中为与光源有关的常数. 而光对在某处一高度为长度为的小量竖直矩形的照度为
,
其中为该小量矩形处的亮度,为光源到处的方向与的法线方向的夹角.
现有一高度为 的简单多边形篱笆,用点列描述. 原点不在多边形的边上. 求光源对多边形各处的照度的总和.
分析: 设的两端点为A, B. 且A, B在光源S到直线AB的垂足的同侧, 否则只需要将AB从垂足处分为两条线段讨论即可. 另外假设A离垂足较近. 设S到AB的垂线与SA的夹角为, 而S到AB的小量张角为. SA的长度为. 由小量分析的方法可得
.
易知即为上述的. 故得到在处的照度为
.
显然,照度与距离无关,只与张角有关. 故这个问题变成求一个点对一个简单多边形的张角.
求点对多边形张角的问题可以用投影和区间并的思想解决:
(1) 令;
(2 )维护一个闭区间序列ints[], 初始为空;
(3) 对每条条线段, , 求出向量和的辐角, , 设. 若, 则将区间加入到序列ints[]中, 否则分别将区间, 加入到序列ints[]中.
(4) 将区间序列ints[]按左端排序, 合并各个相交的区间;
(5) 最后剩下的不相交区间的长度总和就是所求夹角.
下面为解决这个问题的代码, 函数接口为double angfun(pt p[], int n) , 由于本题光源刚好在原点,所以不当作参数, 对其他点也是容易处理的, 坐标平移一下即可.
讨论: 假设允许点在多边形上, 这个方法也是可用的, 不过我们需要知道这个时候点是看作影响多边形外还是影响多边形内. 另外还需要判断每条边的左侧是内部还是右侧是内部. 这只要按叉积求一次面积即可判断. 具体在此从略. 本部分感谢bigheadghost提示.
PS: PKU上该题做成多case会wrong到死, 要做成单case才能过, 晕死!
2008年7月22日 03:37
拍了再看;p
2008年7月22日 03:52
为什么最后会有不相交区间的?
难道意思是
要么剩下一个区间[a, b], 要么剩下两个[a, 2 pi] 和 [0, b]?
2008年7月22日 03:52
and...
开始那段推导看不懂T_T
2008年7月22日 05:27
对!
为什么最后会有不相交区间的?
难道意思是
要么剩下一个区间[a, b], 要么剩下两个[a, 2 pi] 和 [0, b]?
2008年7月22日 05:32
画图比较麻烦, 所以说得不太清楚, 呵呵...
小量分析里有一个方法: 顶角很小的等腰三角形近似于一个直角三角形, 而且两底角均看作直角. 底边长为. 其中为腰长, 为顶角.
and...
开始那段推导看不懂T_T
2009年6月06日 23:59
@bigheadghost:
设光源到直线垂直距离h
l = h * tan(alpha)
=> d(l) = h * d(tan(alpha))
= h * (sec(alpha)) ^ 2 * d(alpha)
= h * 1 / (cos(alpha)) ^ 2 * d(alpha)
= r / cos(alpha) * d(alpha)
2010年4月10日 19:28
@xmjt621: Cool!Thanks a lot!
2021年9月27日 20:39
Who is your favorite singer/actress/famous star? Their net worth can be found easily at celebrity networth
2023年1月03日 15:55
I can recommend primarily decent and even responsible tips, as a result view it: 강남가라오케
2023年1月03日 15:59
Listed here you'll learn it is important, them offers the link in an helpful webpage: 안전놀이터
2023年1月06日 12:21
Mmm.. estimable to be here in your report or notify, whatever, I repute I should moreover process strong for my have website want I play some salubrious further updated busy in your location. 먹튀폴리스
2023年3月02日 20:30
The Best drug rehab west Virginia is Clean & Clear. Its mission is to assist all those people who are affected by anxiety, substance use, and dependency disorders to see a clean and clear way to enjoy a happy life with physical and mental health through the facilities of the best rehabilitation center near me like professional kitchen and chef, 24 hours nursing and security, inpatient rehab physical therapy, Indoor games and many more activities.
2023年7月11日 22:56
The activation code will appear on the TV screen when the streaming device has been connected. To enter the activation code, go to official website. First, you must log in to your TV provider and then select the Activate Now option to begin the activation procedure. bravotv.com/activation code Users may log in to the Bravo TV channel on their Smart TV or streaming device with this code and the service is now available on Android, Roku, Amazon Fire TV, Apple TV, iOS devices, computers, tablets, and Smart TVs.
2023年8月21日 22:46
Karnataka 9th Class Exam date Sheet 2024 available at Official Website, KSEEB Regulates and Supervises the System of Secondary Education in Karnataka State, It Executes and Governs Various Activities that include Karnataka 9th Class Syllabus 2024 Devising of Courses of Study, Prescribing Syllabus,This Karnataka High School Level Exam Appear Every Year More than 45 Laks of Students, Karnataka Secondary Education Students Studying Karnataka Class Revised Syllabus 2024 helps Students to Learn Logic and order and hence,Karnataka Board Class Syllabus 2024 is Designed in Accordance with the NCERT Based Guidelines and helps Students to get an Overview of the Kannada, English Medium All Subject.
2024年1月09日 01:56
JNANABHUMI AP provides a CBSE syllabus for all classes for the academic year 2024 has been designed as per the guidelines of the CBSE Board. The syllabus offers a conceptual background and lays the groundwork for the Class 10 Board exams. jnanabhumiap.in By visiting the page, students will find the downloadable pdf of the reduced CBSE 10th Syllabus along with the deleted portion of the syllabus for each subject. So, students are advised to prepare for the exam, as per the syllabus mentioned here.