﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-LSM ACM/ICPC算法程序设计空间-随笔分类-计算几何</title><link>http://www.cppblog.com/shiming413/category/4950.html</link><description>alpc02 at poj</description><language>zh-cn</language><lastBuildDate>Tue, 20 May 2008 00:48:52 GMT</lastBuildDate><pubDate>Tue, 20 May 2008 00:48:52 GMT</pubDate><ttl>60</ttl><item><title>计算几何相关模板（更新中……）</title><link>http://www.cppblog.com/shiming413/archive/2007/08/22/30617.html</link><dc:creator>LSM</dc:creator><author>LSM</author><pubDate>Wed, 22 Aug 2007 10:39:00 GMT</pubDate><guid>http://www.cppblog.com/shiming413/archive/2007/08/22/30617.html</guid><wfw:comment>http://www.cppblog.com/shiming413/comments/30617.html</wfw:comment><comments>http://www.cppblog.com/shiming413/archive/2007/08/22/30617.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/shiming413/comments/commentRss/30617.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shiming413/services/trackbacks/30617.html</trackback:ping><description><![CDATA[<div style="TEXT-ALIGN: center">计算几何相关模板（更新中&#8230;&#8230;）<br></div>
最近在学计算几何，边学，边整理模板，有错的话请大家指出！<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">计算几何模板&nbsp;~&nbsp;alpc02</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">&nbsp;2</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;PRECISION&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;1e</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">&nbsp;3</span><span style="COLOR: #000000"><img id=Codehighlighter1_62_78_Open_Image onclick="this.style.display='none'; Codehighlighter1_62_78_Open_Text.style.display='none'; Codehighlighter1_62_78_Closed_Image.style.display='inline'; Codehighlighter1_62_78_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_62_78_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_62_78_Closed_Text.style.display='none'; Codehighlighter1_62_78_Open_Image.style.display='inline'; Codehighlighter1_62_78_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span id=Codehighlighter1_62_78_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_62_78_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">&nbsp;4</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x,&nbsp;y;<br></span><span style="COLOR: #008080">&nbsp;5</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">&nbsp;6</span><span style="COLOR: #000000"><img id=Codehighlighter1_102_152_Open_Image onclick="this.style.display='none'; Codehighlighter1_102_152_Open_Text.style.display='none'; Codehighlighter1_102_152_Closed_Image.style.display='inline'; Codehighlighter1_102_152_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_102_152_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_102_152_Closed_Text.style.display='none'; Codehighlighter1_102_152_Open_Image.style.display='inline'; Codehighlighter1_102_152_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;dblcmp(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;d)&nbsp;</span><span id=Codehighlighter1_102_152_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_102_152_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">&nbsp;7</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(fabs(d)&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;PRECISION)&nbsp;</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">:(d</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">:</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">&nbsp;8</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">三叉口函数，避免精度误差</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">&nbsp;9</span><span style="COLOR: #008000"><img id=Codehighlighter1_203_230_Open_Image onclick="this.style.display='none'; Codehighlighter1_203_230_Open_Text.style.display='none'; Codehighlighter1_203_230_Closed_Image.style.display='inline'; Codehighlighter1_203_230_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_203_230_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_203_230_Closed_Text.style.display='none'; Codehighlighter1_203_230_Open_Image.style.display='inline'; Codehighlighter1_203_230_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;length(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y)&nbsp;</span><span id=Codehighlighter1_203_230_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_203_230_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;sqrt(x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">x&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;y</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">y);<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">向量长度</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">12</span><span style="COLOR: #008000"><img id=Codehighlighter1_297_322_Open_Image onclick="this.style.display='none'; Codehighlighter1_297_322_Open_Text.style.display='none'; Codehighlighter1_297_322_Closed_Image.style.display='inline'; Codehighlighter1_297_322_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_297_322_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_297_322_Closed_Text.style.display='none'; Codehighlighter1_297_322_Open_Image.style.display='inline'; Codehighlighter1_297_322_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;dotdet(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x2,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y2)&nbsp;</span><span id=Codehighlighter1_297_322_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_297_322_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;x1</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">x2&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;y1</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">y2;<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">点积</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">15</span><span style="COLOR: #008000"><img id=Codehighlighter1_384_409_Open_Image onclick="this.style.display='none'; Codehighlighter1_384_409_Open_Text.style.display='none'; Codehighlighter1_384_409_Closed_Image.style.display='inline'; Codehighlighter1_384_409_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_384_409_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_384_409_Closed_Text.style.display='none'; Codehighlighter1_384_409_Open_Image.style.display='inline'; Codehighlighter1_384_409_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;det(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x2,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y2)&nbsp;</span><span id=Codehighlighter1_384_409_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_384_409_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;x1</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">y2&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;x2</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">y1;<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">叉积</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">18</span><span style="COLOR: #008000"><img id=Codehighlighter1_474_535_Open_Image onclick="this.style.display='none'; Codehighlighter1_474_535_Open_Text.style.display='none'; Codehighlighter1_474_535_Closed_Image.style.display='inline'; Codehighlighter1_474_535_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_474_535_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_474_535_Closed_Text.style.display='none'; Codehighlighter1_474_535_Open_Image.style.display='inline'; Codehighlighter1_474_535_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;cross(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)&nbsp;</span><span id=Codehighlighter1_474_535_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_474_535_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;dblcmp(&nbsp;det(a.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.x,&nbsp;a.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.y,&nbsp;d.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.x,&nbsp;d.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.y)&nbsp;);<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">右手螺旋定则，1——a在cd右侧，-1——a在cd左侧，0——三点共线</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">21</span><span style="COLOR: #008000"><img id=Codehighlighter1_636_705_Open_Image onclick="this.style.display='none'; Codehighlighter1_636_705_Open_Text.style.display='none'; Codehighlighter1_636_705_Closed_Image.style.display='inline'; Codehighlighter1_636_705_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_636_705_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_636_705_Closed_Text.style.display='none'; Codehighlighter1_636_705_Open_Image.style.display='inline'; Codehighlighter1_636_705_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;between(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)&nbsp;</span><span id=Codehighlighter1_636_705_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_636_705_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;dblcmp(&nbsp;dotdet(c.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;c.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y,&nbsp;d.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;d.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y)&nbsp;)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">在cross(a,c,d)==0的基础上，可判断点a是否在cd内部</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">24</span><span style="COLOR: #008000"><img id=Codehighlighter1_824_1174_Open_Image onclick="this.style.display='none'; Codehighlighter1_824_1174_Open_Text.style.display='none'; Codehighlighter1_824_1174_Closed_Image.style.display='inline'; Codehighlighter1_824_1174_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_824_1174_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_824_1174_Closed_Text.style.display='none'; Codehighlighter1_824_1174_Open_Image.style.display='inline'; Codehighlighter1_824_1174_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;segIntersect(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">b,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)&nbsp;</span><span id=Codehighlighter1_824_1174_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_824_1174_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;a_cd&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(a,c,d);<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(a_cd&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;between(a,c,d))&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;b_cd&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(b,c,d);<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(b_cd&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;between(b,c,d))&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c_ab&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(c,a,b);<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(c_ab&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;between(c,a,b))&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;d_ab&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(d,a,b);<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(d_ab&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;between(d,a,b))&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;((a_cd&nbsp;</span><span style="COLOR: #000000">^</span><span style="COLOR: #000000">&nbsp;b_cd)&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;(c_ab&nbsp;</span><span style="COLOR: #000000">^</span><span style="COLOR: #000000">&nbsp;d_ab)&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">两线段相交情况：0——不相交，1——规范相交，2——不规范相交（交于端点或重合）</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">37</span><span style="COLOR: #008000"><img id=Codehighlighter1_1313_1525_Open_Image onclick="this.style.display='none'; Codehighlighter1_1313_1525_Open_Text.style.display='none'; Codehighlighter1_1313_1525_Closed_Image.style.display='inline'; Codehighlighter1_1313_1525_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1313_1525_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1313_1525_Closed_Text.style.display='none'; Codehighlighter1_1313_1525_Open_Image.style.display='inline'; Codehighlighter1_1313_1525_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;intersectPoint(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">b,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d,&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">e)&nbsp;</span><span id=Codehighlighter1_1313_1525_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1313_1525_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;sc,&nbsp;sd;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;sc&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;fabs(&nbsp;det(b.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;b.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y,&nbsp;c.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;c.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y)&nbsp;);<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;sd&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;fabs(&nbsp;det(b.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;b.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y,&nbsp;d.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;d.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y)&nbsp;);<br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;e.x&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;(sc&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;d.x&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sd&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;c.x)&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">&nbsp;(sc&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sd);<br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;e.y&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;(sc&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;d.y&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sd&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;c.y)&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">&nbsp;(sc&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sd);<br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">两线段规范相交时，求交点坐标</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">44</span><span style="COLOR: #008000"><img id=Codehighlighter1_1629_1779_Open_Image onclick="this.style.display='none'; Codehighlighter1_1629_1779_Open_Text.style.display='none'; Codehighlighter1_1629_1779_Closed_Image.style.display='inline'; Codehighlighter1_1629_1779_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1629_1779_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1629_1779_Closed_Text.style.display='none'; Codehighlighter1_1629_1779_Open_Image.style.display='inline'; Codehighlighter1_1629_1779_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;linesegIntersect(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">b,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)&nbsp;</span><span id=Codehighlighter1_1629_1779_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1629_1779_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c_ab&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(c,a,b);<br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(c_ab&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;d_ab&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cross(d,a,b);<br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(d_ab&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(c_ab&nbsp;</span><span style="COLOR: #000000">^</span><span style="COLOR: #000000">&nbsp;d_ab&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">直线ab和线段cd相交情况：0——不相交，1——规范相交，2——不规范相交（交于端点或重合）</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">53</span><span style="COLOR: #008000"><img id=Codehighlighter1_1912_2030_Open_Image onclick="this.style.display='none'; Codehighlighter1_1912_2030_Open_Text.style.display='none'; Codehighlighter1_1912_2030_Closed_Image.style.display='inline'; Codehighlighter1_1912_2030_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1912_2030_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1912_2030_Closed_Text.style.display='none'; Codehighlighter1_1912_2030_Open_Image.style.display='inline'; Codehighlighter1_1912_2030_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;lineIntersect(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">a,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">b,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)&nbsp;</span><span id=Codehighlighter1_1912_2030_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1912_2030_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(dblcmp(det(b.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,&nbsp;b.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.y,&nbsp;d.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.x,&nbsp;d.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c.y))&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(cross(a,c,d)&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">两直线相交情况：0——平行，1——规范相交，2——不规范相交（重合）<br></span><span style="COLOR: #008080">60</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<br><br><br>
<img src ="http://www.cppblog.com/shiming413/aggbug/30617.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shiming413/" target="_blank">LSM</a> 2007-08-22 18:39 <a href="http://www.cppblog.com/shiming413/archive/2007/08/22/30617.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>计算几何入门题（更新中……）</title><link>http://www.cppblog.com/shiming413/archive/2007/08/22/30616.html</link><dc:creator>LSM</dc:creator><author>LSM</author><pubDate>Wed, 22 Aug 2007 10:28:00 GMT</pubDate><guid>http://www.cppblog.com/shiming413/archive/2007/08/22/30616.html</guid><wfw:comment>http://www.cppblog.com/shiming413/comments/30616.html</wfw:comment><comments>http://www.cppblog.com/shiming413/archive/2007/08/22/30616.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/shiming413/comments/commentRss/30616.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shiming413/services/trackbacks/30616.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 计算几何入门题（更新中&#8230;&#8230;）http://acm.pku.edu.cn/JudgeOnline/problem?id=1696Space Ant用到叉积，点积。这个题的代码稍微改改，貌似可以认为是凸包的o(n^2)算法，即卷包心菜。Code highlighting produced by Actipro CodeHighlighter (freeware)http...&nbsp;&nbsp;<a href='http://www.cppblog.com/shiming413/archive/2007/08/22/30616.html'>阅读全文</a><img src ="http://www.cppblog.com/shiming413/aggbug/30616.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shiming413/" target="_blank">LSM</a> 2007-08-22 18:28 <a href="http://www.cppblog.com/shiming413/archive/2007/08/22/30616.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>计算几何初步认识(一）</title><link>http://www.cppblog.com/shiming413/archive/2007/08/21/30494.html</link><dc:creator>LSM</dc:creator><author>LSM</author><pubDate>Tue, 21 Aug 2007 00:52:00 GMT</pubDate><guid>http://www.cppblog.com/shiming413/archive/2007/08/21/30494.html</guid><wfw:comment>http://www.cppblog.com/shiming413/comments/30494.html</wfw:comment><comments>http://www.cppblog.com/shiming413/archive/2007/08/21/30494.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/shiming413/comments/commentRss/30494.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shiming413/services/trackbacks/30494.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center;" align="center"><span style="font-size: 12pt; font-family: 宋体;">计算几何初步认识</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center;" align="center"><span style="font-size: 12pt; font-family: 宋体;">——</span><span style="font-size: 12pt;" lang="EN-US"><a href="http://hi.baidu.com/alpc62"><span style="font-size: 12pt;" lang="EN-US">Wjx</span></a></span><span style="font-size: 12pt; font-family: 宋体;">昨晚给我速成的计算几何</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><span style="font-size: 12pt;" lang="EN-US"><span>一、</span></span><span style="font-size: 12pt; font-family: 宋体;">点。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">点的坐标</span><span style="font-size: 12pt;" lang="EN-US">A(x1, y1)</span><span style="font-size: 12pt; font-family: 宋体;">，</span><span style="font-size: 12pt;" lang="EN-US">B(x2, y2)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><span style="font-size: 12pt;" lang="EN-US"><span>二、</span></span><span style="font-size: 12pt; font-family: 宋体;">向量。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">向量</span><span style="font-size: 12pt;" lang="EN-US">AB = (x2-x1, y2-y1) = (x3,y3) </span><span style="font-size: 12pt; font-family: 宋体;">，</span><span style="font-size: 12pt;" lang="EN-US">CD = (x4, y4)</span><span style="font-size: 12pt; font-family: 宋体;">。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">向量的模</span><span style="font-size: 12pt;" lang="EN-US">|AB| = sqrt(x3*x3 + y3*y3) </span><span style="font-size: 12pt; font-family: 宋体;">即向量的长度。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><span style="font-size: 12pt;" lang="EN-US"><span>三、</span></span><span style="font-size: 12pt; font-family: 宋体;">点积。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">点积的结果为一个数值。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">数值计算方法</span><span style="font-size: 12pt;" lang="EN-US">AB * CD </span><span style="font-size: 12pt; font-family: 宋体;">＝</span><span style="font-size: 12pt;" lang="EN-US"> x3*x4 + y3*y4</span><span style="font-size: 12pt; font-family: 宋体;">。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">几何意义</span><span style="font-size: 12pt;" lang="EN-US">AB * CD = |AB| * |CD| * cos(a)</span><span style="font-size: 12pt; font-family: 宋体;">，</span><span style="font-size: 12pt;" lang="EN-US">a</span><span style="font-size: 12pt; font-family: 宋体;">为向量</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">逆时针转向</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的角度，</span><span style="font-size: 12pt;" lang="EN-US">0&lt;=a&lt;360</span><span style="font-size: 12pt; font-family: 宋体;">，也可以认为是两向量的夹角，</span><span style="font-size: 12pt;" lang="EN-US">0&lt;=a&lt;=180</span><span style="font-size: 12pt; font-family: 宋体;">。一般用于求夹角，</span><span style="font-size: 12pt;" lang="EN-US">a = acos( (AB * CD) / (|AB| * |CD|) )</span><span style="font-size: 12pt; font-family: 宋体;">。也可：</span><span style="font-size: 12pt;" lang="EN-US">|CD| * cos(a) = AB * CD / |AB|</span><span style="font-size: 12pt; font-family: 宋体;">，即向量</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">上的投影。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><span style="font-size: 12pt;" lang="EN-US"><span>四、</span></span><span style="font-size: 12pt; font-family: 宋体;">叉积。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">叉积的结果为一个向量。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">数值</span><span style="font-size: 12pt;" lang="EN-US">= x3*y4 &#8211; x4*y3</span><span style="font-size: 12pt; font-family: 宋体;">。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">方向由右手螺旋定则判定。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">几何意义：</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">CD = |AB| * |CD| * sin(a)</span><span style="font-size: 12pt; font-family: 宋体;">，取绝对值即是以</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">和</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">为边的平行四边形面积。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><span style="font-size: 12pt;" lang="EN-US"><span>五、</span></span><span style="font-size: 12pt; font-family: 宋体;">线段相交的判定（判定线段</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">和线段</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">是否相交，属于哪种相交）。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">规范相交：交点只有一个，且不是线段的端点。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt;"><span style="font-size: 12pt;" lang="EN-US"><span>1、</span></span><span style="font-size: 12pt; font-family: 宋体;">充要条件：点</span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">和点</span><span style="font-size: 12pt;" lang="EN-US">B</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的两侧并且点</span><span style="font-size: 12pt;" lang="EN-US">C</span><span style="font-size: 12pt; font-family: 宋体;">和点</span><span style="font-size: 12pt;" lang="EN-US">D</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">的两侧。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt;"><span style="font-size: 12pt;" lang="EN-US"><span>2、</span></span><span style="font-size: 12pt; font-family: 宋体;">如何判断点</span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">在向量</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的左侧还是右侧：</span><span style="font-size: 12pt;" lang="EN-US">CA</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的数值大于</span><span style="font-size: 12pt;" lang="EN-US">0</span><span style="font-size: 12pt; font-family: 宋体;">则左侧，小于</span><span style="font-size: 12pt;" lang="EN-US">0</span><span style="font-size: 12pt; font-family: 宋体;">则右侧。于是</span><span style="font-size: 12pt;" lang="EN-US">CA</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的数值和</span><span style="font-size: 12pt;" lang="EN-US">CB</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的数值异号，点</span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">和点</span><span style="font-size: 12pt;" lang="EN-US">B</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">的两侧，同理可判断点</span><span style="font-size: 12pt;" lang="EN-US">C</span><span style="font-size: 12pt; font-family: 宋体;">和点</span><span style="font-size: 12pt;" lang="EN-US">D</span><span style="font-size: 12pt; font-family: 宋体;">是否在</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">的两侧（注意，必须严格异号）。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"><span style="font-size: 12pt; font-family: wingdings;" lang="EN-US"><span>l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt; font-family: 宋体;">不规范相交：交点为某个线段的端点，甚至两线段有一段重合。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt;"><span style="font-size: 12pt;" lang="EN-US"><span>1、</span></span><span style="font-size: 12pt; font-family: 宋体;">充要条件，一条线段的一个端点在另一条线段上。即</span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">上或</span><span style="font-size: 12pt;" lang="EN-US">B</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">上或</span><span style="font-size: 12pt;" lang="EN-US">C</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">上或</span><span style="font-size: 12pt;" lang="EN-US">D</span><span style="font-size: 12pt; font-family: 宋体;">在</span><span style="font-size: 12pt;" lang="EN-US">AB</span><span style="font-size: 12pt; font-family: 宋体;">上。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt;"><span style="font-size: 12pt;" lang="EN-US"><span>2、</span></span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">在线段</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">上的充要条件：</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"><span style="font-size: 12pt;" lang="EN-US"><span>a)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt;" lang="EN-US">AC</span><span style="font-size: 12pt; font-family: 宋体;">&#215;</span><span style="font-size: 12pt;" lang="EN-US">AD = 0</span><span style="font-size: 12pt; font-family: 宋体;">，几何意义，</span><span style="font-size: 12pt;" lang="EN-US">AC</span><span style="font-size: 12pt; font-family: 宋体;">和</span><span style="font-size: 12pt;" lang="EN-US">AD</span><span style="font-size: 12pt; font-family: 宋体;">组成的平行四边形的面积为</span><span style="font-size: 12pt;" lang="EN-US">0</span><span style="font-size: 12pt; font-family: 宋体;">，即</span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">、</span><span style="font-size: 12pt;" lang="EN-US">C</span><span style="font-size: 12pt; font-family: 宋体;">、</span><span style="font-size: 12pt;" lang="EN-US">D</span><span style="font-size: 12pt; font-family: 宋体;">三点共线。</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"><span style="font-size: 12pt;" lang="EN-US"><span>b)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: 12pt;" lang="EN-US">A</span><span style="font-size: 12pt; font-family: 宋体;">点在</span><span style="font-size: 12pt;" lang="EN-US">CD</span><span style="font-size: 12pt; font-family: 宋体;">之间，</span><span style="font-size: 12pt;" lang="EN-US">A.x</span><span style="font-size: 12pt; font-family: 宋体;">处于</span><span style="font-size: 12pt;" lang="EN-US">C.x</span><span style="font-size: 12pt; font-family: 宋体;">和</span><span style="font-size: 12pt;" lang="EN-US">D.x</span><span style="font-size: 12pt; font-family: 宋体;">之间并且</span><span style="font-size: 12pt;" lang="EN-US">A.y</span><span style="font-size: 12pt; font-family: 宋体;">处于</span><span style="font-size: 12pt;" lang="EN-US">C.y</span><span style="font-size: 12pt; font-family: 宋体;">和</span><span style="font-size: 12pt;" lang="EN-US">D.y</span><span style="font-size: 12pt; font-family: 宋体;">之间</span></p><img src ="http://www.cppblog.com/shiming413/aggbug/30494.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shiming413/" target="_blank">LSM</a> 2007-08-21 08:52 <a href="http://www.cppblog.com/shiming413/archive/2007/08/21/30494.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>