<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91621</guid>
        <pubDate>Wed, 23 Apr 2003 14:21:25 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91621</link>
        <description><![CDATA[SVK : Ааа... я как всегда опаздал :( но вдруг пригодится ;)<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;Gug - острота угла стрелки в градусах&#60;br&#62;Lstr - длинна стрелки&#60;br&#62;&#60;br&#62;void DrawVector(HDC hdc, int bx, int by, int ex, int ey)&#60;br&#62; {&#60;br&#62; &nbsp;int ug;&#60;br&#62; &nbsp;POINT poly[3];&#60;br&#62;&#60;br&#62; &nbsp;MoveToEx(hdc,bx,by,0);&#60;br&#62; &nbsp;LineTo(hdc,ex,ey);&#60;br&#62; &nbsp;ug=RetGrad(ex-bx,ey-by);&#60;br&#62; &nbsp;ug=ug-Gug;&#60;br&#62; &nbsp;poly[0].x=ex;&#60;br&#62; &nbsp;poly[0].y=ey;&#60;br&#62; &nbsp;poly[1].x=ex+Lstr*cos(ug*M_PI/180);&#60;br&#62; &nbsp;poly[1].y=ey+Lstr*sin(ug*M_PI/180);&#60;br&#62; &nbsp;ug=ug+2*Gug;&#60;br&#62; &nbsp;poly[2].x=ex+Lstr*cos(ug*M_PI/180);&#60;br&#62; &nbsp;poly[2].y=ey+Lstr*sin(ug*M_PI/180);&#60;br&#62; &nbsp;SetPolyFillMode(hdc,WINDING);&#60;br&#62; &nbsp;Polygon(hdc,poly,3);&#60;br&#62; }&#60;br&#62;&#60;br&#62;int RetGrad(int w,int h)&#60;br&#62; {&#60;br&#62; &nbsp;float fw=w,fh=h,fg=sqrt(fw*fw+fh*fh),fs,fc;&#60;br&#62; &nbsp;if(fg==0) return 0;&#60;br&#62; &nbsp;fs=fh/fg;fc=fw/fg;&#60;br&#62; &nbsp;if(fs&#62;=0) return 180.0*acos(fc)/M_PI;&#60;br&#62; &nbsp; else return 360.0-180.0*acos(fc)/M_PI;&#60;br&#62; }&#60;br&#62;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>SVK </author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91620</guid>
        <pubDate>Sat, 19 Apr 2003 19:46:47 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91620</link>
        <description><![CDATA[BiV: спасиб]]></description>
        <author>BiV</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91619</guid>
        <pubDate>Sat, 19 Apr 2003 07:47:57 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91619</link>
        <description><![CDATA[Булат Шакиров: По алгоритму S.Yu.Gubanov'а сурс (ТМТ Паскаль)<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;Uses Graph,Crt,Strings;&#60;br&#62;var&#60;br&#62; &nbsp;h,w,x3,y3,x1,y1,x2,y2,x4,y4,x5,y5,i,j &nbsp; &nbsp; &nbsp; : LongInt;&#60;br&#62; &nbsp;nx,ny,vx,vy,v:real;&#60;br&#62;begin&#60;br&#62; &nbsp;{ Set 256-colours graphics mode }&#60;br&#62; &nbsp;SetSVGAMode(640,480,24,LfbOrBanked);&#60;br&#62;{ Сначала нужно найти пару ортогональных векторов (Vx, Vy) и (nx, ny). }&#60;br&#62;{ V - направлен из точки 1 в точку 2 (по направлению движения) &nbsp; &nbsp; &nbsp; &nbsp; }&#60;br&#62;x1:=GetMaxX div 2;&#60;br&#62;y1:=GetMaxY div 2;&#60;br&#62;x2:=x1+20;&#60;br&#62;y2:=y2;&#60;br&#62;Vx := x2 - x1;&#60;br&#62;Vy := y2 - y1;&#60;br&#62;V &nbsp;:= sqrt(Vx*Vx + Vy*Vy);&#60;br&#62;Vx := Vx/V;&#60;br&#62;Vy := Vy/V;&#60;br&#62;{ Вектор n - перпендикулярен направлению движения }&#60;br&#62;nx := Vy;&#60;br&#62;ny := -Vx;&#60;br&#62;h:=15;&#60;br&#62;w:=10;&#60;br&#62;{ Обозначим h и w - размеры рисуемой стрелки. Находим точку (x3,y3) лежащую на }&#60;br&#62;{ прямой проходящей из 1 в 2 и находящейся на расстоянии h от точки 2. &nbsp; &nbsp; &nbsp; &nbsp; }&#60;br&#62;x3 := x2 - Round(h*Vx);&#60;br&#62;y3 := y2 - Round(h*Vy);&#60;br&#62;{ Теперь найдем точки (x4,y4) и (x5,y5) расположенные &quot;по бокам&quot; - зазубрины }&#60;br&#62;{ стрелки }&#60;br&#62;x4 := x3 + Round(w*nx);&#60;br&#62;y4 := y3 + Round(w*ny);&#60;br&#62;x5 := x3 - Round(w*nx);&#60;br&#62;y5 := y3 - Round(w*ny);&#60;br&#62;{ Ну вот и все, осталось нарисовать }&#60;br&#62; &nbsp;MoveTo(x1,y1);&#60;br&#62; &nbsp;LineTo(x2,y2);&#60;br&#62; &nbsp;LineTo(x4,y4);&#60;br&#62; &nbsp;LineTo(x5,y5);&#60;br&#62; &nbsp;LineTo(x2,y2);&#60;br&#62; &nbsp;ReadKey; &nbsp; &nbsp;{ Get the key pressed &nbsp; &nbsp; }&#60;br&#62; &nbsp;CloseGraph; { Return to the text mode }&#60;br&#62;end.&#60;br&#62;</div></ol></div></div></div></div>]]></description>
        <author>Булат Шакиров</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91618</guid>
        <pubDate>Sat, 19 Apr 2003 03:04:14 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91618</link>
        <description><![CDATA[S.Yu.Gubanov: Сначала нужно найти пару ортогональных векторов (Vx, Vy) и (nx, ny). V - направлен из точки 1 в точку 2 (по направлению движения)<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;Vx := x2 - x1;&#60;br&#62;Vy := y2 - y1;&#60;br&#62;V  := sqrt(Vx*Vx + Vy*Vy);&#60;br&#62;Vx := Vx/V;&#60;br&#62;Vy := Vy/V;&#60;br&#62;</div></ol></div></div></div></div><br>Вектор n - перпендикулярен направлению движения<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;nx := Vy;&#60;br&#62;ny := -Vx;&#60;br&#62;</div></ol></div></div></div></div><br>Обозначим h и w - размеры рисуемой стрелки. Находим точку (x3,y3) лежащую на прямой проходящей из 1 в 2 и находящейся на расстоянии h от точки 2.<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;x3 := x2 - h*Vx;&#60;br&#62;y3 := y2 - h*Vy;&#60;br&#62;</div></ol></div></div></div></div><br>Теперь найдем точки (x4,y4) и (x5,y5) расположенные &quot;по бокам&quot; - зазубрины стрелки<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;x4 := x3 + w*nx;&#60;br&#62;y4 := y3 + w*ny;&#60;br&#62;x5 := x3 - w*nx;&#60;br&#62;y5 := y3 - w*ny;&#60;br&#62;</div></ol></div></div></div></div><br>Ну вот и все, осталось нарисовать<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;MoveTo(x1,y1);&#60;br&#62;LineTo(x2,y2);&#60;br&#62;LineTo(x4,y4);&#60;br&#62;LineTo(x5,y5);&#60;br&#62;LineTo(x2,y2);&#60;br&#62;</div></ol></div></div></div></div><br><br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (4)|\&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| \&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp;\&#60;br&#62;(1)------------(3)--(2)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp;/&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| /&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (5)|/&#60;br&#62;</div></ol></div></div></div></div><br>]]></description>
        <author>S.Yu.Gubanov</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91617</guid>
        <pubDate>Fri, 18 Apr 2003 22:42:52 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91617</link>
        <description><![CDATA[Shiru_Otaku: Тогда ему не алгоритм, а сорс нужен;)]]></description>
        <author>Shiru_Otaku</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91616</guid>
        <pubDate>Fri, 18 Apr 2003 06:45:51 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91616</link>
        <description><![CDATA[Grisha: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>GrAnd, 18.04.03, 08:31:24</span><div class='quote '>Что то я не понимаю. Что такое x1,y1 x2,y2 и как понять алгоритм рисования стрелки???</div></div><br><br>Да ему нужно линию из x1,y1 в x2,y2, а на конце еще две коротенькие линии (или три). Вот он и хочет точки тех линий =&gt; углы cos/sin считать надо <br>]]></description>
        <author>Grisha</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91615</guid>
        <pubDate>Fri, 18 Apr 2003 05:34:41 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91615</link>
        <description><![CDATA[Danaris: Может алгоритм вращения стрелки?]]></description>
        <author>Danaris</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91614</guid>
        <pubDate>Fri, 18 Apr 2003 04:31:24 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91614</link>
        <description><![CDATA[GrAnd: Что то я не понимаю. Что такое x1,y1 x2,y2 и как понять алгоритм рисования стрелки???]]></description>
        <author>GrAnd</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91613</guid>
        <pubDate>Thu, 17 Apr 2003 17:48:44 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91613</link>
        <description><![CDATA[Grisha: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>BiV, 17.04.03, 19:10:18</span><div class='quote '>формат заголовка функции: Strelka(x1,y1, x2,y2)</div></div><br><br>да ну думать неохота<br>]]></description>
        <author>Grisha</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91612</guid>
        <pubDate>Thu, 17 Apr 2003 15:10:18 +0000</pubDate>
        <title>Нужен алгоритм рисования стрелки</title>
        <link>https://forum.sources.ru/index.php?showtopic=9423&amp;view=findpost&amp;p=91612</link>
        <description><![CDATA[BiV: формат заголовка функции: Strelka(x1,y1, x2,y2)]]></description>
        <author>BiV</author>
        <category>Алгоритмы</category>
      </item>
	
      </channel>
      </rss>
	