<?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=83232&amp;view=findpost&amp;p=618094</guid>
        <pubDate>Sun, 20 Feb 2005 11:28:40 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=618094</link>
        <description><![CDATA[Romtek: Ну сам, в конце концов, можешь подумать? Почитать где-то. Или за тебя все должны искать и предлагать готовые решения?  &lt;_&lt;]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=616561</guid>
        <pubDate>Fri, 18 Feb 2005 16:28:04 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=616561</link>
        <description><![CDATA[Falex: И какой всё таки пример для моей функции&#33;]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=614421</guid>
        <pubDate>Wed, 16 Feb 2005 21:55:41 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=614421</link>
        <description><![CDATA[Romtek: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=83232&view=findpost&p=614310'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Falex &#064; <time class="tag-quote__quoted-time" datetime="2005-02-16T18:54:26+00:00">16.02.05, 18:54</time></span><div class='quote '><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">Scale:=75;</div><div class="code_line">InitGraph (gd, gm, &#39;c:\pascal&#39;);</div><div class="code_line">ClearDevice; {зачем это здесь нужно???}</div><div class="code_line">x1 := random (8*Scale);</div><div class="code_line">y1 := random (10*Scale);</div><div class="code_line">x2 := random (10*Scale);</div><div class="code_line">y2 := random (12*Scale);</div><div class="code_line">x3 := random (12*Scale);</div><div class="code_line">y3 := random (14*Scale);;</div><div class="code_line">Curve (x1, y1, x2, y2, x3, y3, segments);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;{А где задержка перед выходом из программы???}</div><div class="code_line">&nbsp;</div><div class="code_line">CloseGraph;</div><div class="code_line">end.</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script></div></div> :huh: <br>
<br>
Перед <em class='tag-i'>CloseGraph</em> обязательно должна быть какая-то задержка, чтобы пользователь смог что-то увидеть перед закрытием программы. Вставь <strong class='tag-b'>Readln;</strong><br>
У тебя при запуске программы графический режим устанавливается, потом сразу же и закрывается.  :lol: <br>
<br>
Вижу, что с Паскалем у тебя туго. :ph34r:]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=614310</guid>
        <pubDate>Wed, 16 Feb 2005 18:54:26 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=614310</link>
        <description><![CDATA[Falex: Попробовал вот так, но почему-то pascal из малоэкранного режима при компиляции переходит в полноэкранный,где ни<br>
одна клавиша не работает, кроме Windows.<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">Scale:=75;</div><div class="code_line">InitGraph (gd, gm, &#39;c:\pascal&#39;);</div><div class="code_line">ClearDevice;</div><div class="code_line">x1 := random (8*Scale);</div><div class="code_line">y1 := random (10*Scale);</div><div class="code_line">x2 := random (10*Scale);</div><div class="code_line">y2 := random (12*Scale);</div><div class="code_line">x3 := random (12*Scale);</div><div class="code_line">y3 := random (14*Scale);;</div><div class="code_line">Curve (x1, y1, x2, y2, x3, y3, segments);</div><div class="code_line">CloseGraph;</div><div class="code_line">end.</div></ol></div></div></div></div><br>
И какой всё таки пример для моей функции <br>
(P.S&gt;исходники на Delphi смотрел,но это же не pascal - и сама задача стоит по иному)]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613672</guid>
        <pubDate>Wed, 16 Feb 2005 09:31:49 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613672</link>
        <description><![CDATA[Romtek: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=83232&view=findpost&p=613411'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Falex &#064; <time class="tag-quote__quoted-time" datetime="2005-02-16T03:34:42+00:00">16.02.05, 03:34</time></span><div class='quote '>Значит кокретные числе нельзя брать?(и какие например можно?)</div></div><br>
<em class='tag-i'>целые числа</em> - это ординарные типы <em class='tag-i'>Byte,Word,Integer,Longint</em>. Что будешь вставлять вместо параметров в функцию: константы, переменные или результаты функций - компилятору до лампочки. Я ясно выражаюсь? :rolleyes: <br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=83232&view=findpost&p=613411'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Falex &#064; <time class="tag-quote__quoted-time" datetime="2005-02-16T03:34:42+00:00">16.02.05, 03:34</time></span><div class='quote '>Для моей программы надо брать процедуру BSpline или Catmull_Rom_Spline?</div></div><br>
По-моему, всё-таки процедура <em class='tag-i'>CubicBezierCurve</em>. Тебе ведь нужен <strong class='tag-b'>кубический</strong> сплайн.<br>
<br>
<strong class='tag-b'>Falex</strong>, ты читал то, что я тебе давал?<br>
<br>
Если проблема именно в отображении сплайна, то тебе надо задавать масштаб увеличения <em class='tag-i'>Scale</em> вещественного типа:<br>
<strong class='tag-b'>X1 := Random (Scale * 7.5);</strong><br>
<em class='tag-i'>Scale</em> должна быть не менее <em class='tag-i'>10.0</em>, но и не слишком большая, иначе кривая выйдет за пределы экрана.]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613411</guid>
        <pubDate>Wed, 16 Feb 2005 03:34:42 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613411</link>
        <description><![CDATA[Falex: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Xn,Yn - то координаты на экране, то есть пиксели (целые числа)</div></div><br>
Значит кокретные числе нельзя брать?(и какие например можно?)<br>
Для моей программы надо брать процедуру BSpline или Catmull_Rom_Spline?]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613264</guid>
        <pubDate>Tue, 15 Feb 2005 20:38:50 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613264</link>
        <description><![CDATA[Romtek: Xn,Yn - то координаты на экране, то есть <strong class='tag-b'>пиксели</strong> (целые числа)&#33; <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-02-15T20:51:19+00:00">15.02.05, 20:51</time></span></span><br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>Eugie</span><div class='quote '>Способов интерполяции много, наиболее практичный - с помощью сплайнов.<br>
<br>
Cплайн - это интерполирующая кривая с заданной степенью гладкости, проходящая через набор точек (узлов). Реализуют сплайны с помощью многочленов, т.е. участки кривой между соседними узлами представляют собой многочлены; при этом их коэффициенты определяются из условия равенства значений соседних многочленов и их производных (порядка до нужной степени гладкости) в узлах плюс несколько доп.условий на производные в крайних точках.<br>
<br>
Например, для кубических сплайнов имеем: пусть (x[1],y[1]),...,(x[N],y[N]) - набор узлов; F[n](x):=a[n]*x^3+b[n]*x^2+c[n]*x+d[n], n:=1,...,N-1 - набор кубических многочленов. Тогда система уравнений<br>
<br>
F [n](x[k]) := y[k], n:=(1..N-1), k:=(n,n+1),<br>
F&#39; [n](x[n+1]) := F&#39; [n+1](x[n+1]), n:=(1..N-2),<br>
F&#39;&#39;[n](x[n+1]) := F&#39;&#39;[n+1](x[n+1]), n:=(1..N-2),<br>
F&#39;&#39;[1](x[1]) := 0, F&#39;&#39;[N](x[N]) := 0 (эти два условия произвольные)<br>
<br>
однозначно определяет коэффициенты многочленов для построения кубического сплайна. Действительно, имеем 4(N-1) переменных a[n],b[n],c[n],d[n] для n := (1..N-1) и столько же уравнений.<br>
<br>
Описанная схема не самая эффективная, в литературе можно найти алгоритмы построения сплайнов, требующие решения всего N+1 линейных ур-й, причем прогонкой. Рекомендую помотреть, например, справочник по математике Бронштейна и Семендяева. </div></div><br>
<br>
В Дельфи для построения используются методы <em class='tag-i'>PolyBezier</em> и <em class='tag-i'>PolyBezierTo</em> класса Canvas.<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Строит кривую Безье (кубический сплайн), используя массив координат точек  Points</div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-02-15T21:03:52+00:00">15.02.05, 21:03</time></span></span><br>
Почитай также и это:<br>
<a class='tag-url' href='http://delphikingdom.ru/asp/answer.asp?IDAnswer=22580' target='_blank'>Линии Безье</a><br>
<a class='tag-url' href='http://www.delphikingdom.com/asp/viewitem.asp?UrlItem=/mastering/curve.htm' target='_blank'>Использование кривых Безье</a>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613098</guid>
        <pubDate>Tue, 15 Feb 2005 17:06:42 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=613098</link>
        <description><![CDATA[Falex: А если вместо x и y взять конкретное значение?<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">x1 := 5;</div><div class="code_line">y1 := 25;</div><div class="code_line">x2 := round(6.25);</div><div class="code_line">y2 := round(39.0625);</div><div class="code_line">x3 := round(7.5);</div><div class="code_line">y3 := round(56.25);</div></ol></div></div></div></div><br>
И для моей программы ведь надо брать процедуру BSpline или Catmull_Rom_Spline? (и чем они отличаются).<br>
Вот именно для той процедуры , которая мне нужна, приведи пожалуйста пример.]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=612430</guid>
        <pubDate>Tue, 15 Feb 2005 08:33:24 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=612430</link>
        <description><![CDATA[Romtek: <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">program CurveTst;</div><div class="code_line">uses Crt, Graph,</div><div class="code_line">&nbsp;&nbsp; &nbsp; v256,{} &nbsp;(* модуль поддержки 256-цветных режимов графики *)</div><div class="code_line">&nbsp;&nbsp; &nbsp; Curves;</div><div class="code_line">&nbsp;</div><div class="code_line">Const</div><div class="code_line">&nbsp;&nbsp; segments = 30;</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp; x1, y1,</div><div class="code_line">&nbsp;&nbsp; x2, y2,</div><div class="code_line">&nbsp;&nbsp; x3, y3,</div><div class="code_line">&nbsp;&nbsp; gd, gm : integer;</div><div class="code_line">&nbsp;</div><div class="code_line">begin</div><div class="code_line">{ &nbsp; &nbsp; gd := Detect;</div><div class="code_line">&nbsp;&nbsp; &nbsp; InitGraph (gd, gm, &#39;..\bgi&#39;);{}</div><div class="code_line">&nbsp;&nbsp; &nbsp; SetVMode(v640x480);{}</div><div class="code_line">&nbsp;</div><div class="code_line">{ &nbsp; &nbsp; SetBkColor(LightGray);{}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; repeat</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClearDevice;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x1 := random (GetMaxX);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y1 := random (GetMaxY);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x2 := random (GetMaxX);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y2 := random (GetMaxY);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x3 := random (GetMaxX);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y3 := random (GetMaxY);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetColor (1 + Random (GetMaxColor));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Curve (x1, y1, x2, y2, x3, y3, segments);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay (600)</div><div class="code_line">&nbsp;&nbsp; &nbsp; until keypressed;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; CloseGraph;</div><div class="code_line">end.</div></ol></div></div></div></div>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611818</guid>
        <pubDate>Mon, 14 Feb 2005 14:29:23 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611818</link>
        <description><![CDATA[Falex: Интересно - что это такое?И как этим unitom пользоваться?<br>
Лучше на моём примере бы объяснил&#33; <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-02-14T15:05:30+00:00">14.02.05, 15:05</time></span></span><br>
Пример для этого unita есть?<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">program spline;</div><div class="code_line">uses crt,graph,splineUnit;</div><div class="code_line">begin</div><div class="code_line">grDriver:=Detect;</div><div class="code_line">InitGraph(grDriver,gMode,&#39;c:\pascal&#39;);</div><div class="code_line">Curve(0,0,5,5,8,8,3);</div><div class="code_line">end.</div></ol></div></div></div></div>]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611246</guid>
        <pubDate>Mon, 14 Feb 2005 06:16:48 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611246</link>
        <description><![CDATA[Romtek: Вот это тебе, возможно, поможет.<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">{$N+}</div><div class="code_line">Unit Curves;</div><div class="code_line">Interface</div><div class="code_line">Uses Graph;</div><div class="code_line">Procedure Curve (x1, y1, x2, y2, x3, y3: Integer; Segments: Word);</div><div class="code_line">Procedure CubicBezierCurve (x1, y1, x2, y2, x3, y3, x4, y4: Integer; Segments: Word);</div><div class="code_line">Procedure BSpline (NumPoints: Word;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Points: array of pointtype; Segments: Word);</div><div class="code_line">Procedure Catmull_Rom_Spline (NumPoints: Word; Points: Array Of pointtype; Segments: Word);</div><div class="code_line">{----------------------------------------------------------------------------}</div><div class="code_line">Implementation</div><div class="code_line">Procedure Curve (x1, y1, x2, y2, x3, y3: Integer; Segments: Word);</div><div class="code_line">{ Draw a curve from (x1,y1) through (x2,y2) to (x3,y3) divided in</div><div class="code_line">&nbsp;&nbsp;&quot;Segments&quot; segments }</div><div class="code_line">Var</div><div class="code_line">&nbsp;&nbsp;lsteps, ex, ey, fx, fy: LongInt;</div><div class="code_line">&nbsp;&nbsp;t1, t2: Integer;</div><div class="code_line">&nbsp;</div><div class="code_line">Begin</div><div class="code_line">&nbsp;&nbsp;x2:=(x2 SHL 1)-((x1+x3) SHR 1);</div><div class="code_line">&nbsp;&nbsp;y2:=(y2 SHL 1)-((y1+y3) SHR 1);</div><div class="code_line">&nbsp;&nbsp;lsteps:=Segments;</div><div class="code_line">&nbsp;&nbsp;If (lsteps&#60;2) then lsteps:=2;</div><div class="code_line">&nbsp;&nbsp;If (lsteps&#62;128) then lsteps:=128; &nbsp;{ Clamp value to avoid overcalculation }</div><div class="code_line">&nbsp;&nbsp;ex:=(LongInt (x2-x1) SHL 17) DIV lsteps;</div><div class="code_line">&nbsp;&nbsp;ey:=(LongInt (y2-y1) SHL 17) DIV lsteps;</div><div class="code_line">&nbsp;&nbsp;fx:=(LongInt (x3-(2*x2)+x1) SHL 16) DIV (lsteps*lsteps);</div><div class="code_line">&nbsp;&nbsp;fy:=(LongInt (y3-(2*y2)+y1) SHL 16) DIV (lsteps*lsteps);</div><div class="code_line">&nbsp;&nbsp;Dec (lsteps);</div><div class="code_line">&nbsp;&nbsp;While lsteps&#62;0 Do Begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;t1:=x3;</div><div class="code_line">&nbsp;&nbsp; &nbsp;t2:=y3;</div><div class="code_line">&nbsp;&nbsp; &nbsp;x3:=(((fx*lsteps+ex)*lsteps) SHR 16)+x1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;y3:=(((fy*lsteps+ey)*lsteps) SHR 16)+y1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Line ( &nbsp;t1,t2,x3,y3 );</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dec (lsteps);</div><div class="code_line">&nbsp;&nbsp;End;</div><div class="code_line">&nbsp;&nbsp;Line ( &nbsp;x3,y3,x1,y1 );</div><div class="code_line">End;</div><div class="code_line">&nbsp;</div><div class="code_line">Procedure CubicBezierCurve (x1, y1, x2, y2, x3, y3, x4, y4: Integer; Segments: Word);</div><div class="code_line">{ Draw a cubic bezier-curve using the basis functions directly }</div><div class="code_line">Var</div><div class="code_line">&nbsp;&nbsp;tx1, tx2, tx3, ty1, ty2, ty3, mu, mu2, mu3, mudelta: Real;</div><div class="code_line">&nbsp;&nbsp;xstart, ystart, xend, yend, n: Integer;</div><div class="code_line">&nbsp;</div><div class="code_line">Begin</div><div class="code_line">&nbsp;&nbsp;If (Segments&#60;1) then Exit;</div><div class="code_line">&nbsp;&nbsp;If Segments&#62;128 then Segments:=128; { Clamp value to avoid overcalculation }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;mudelta:=1/Segments;</div><div class="code_line">&nbsp;&nbsp;mu:=0;</div><div class="code_line">&nbsp;&nbsp;tx1:=-x1+3*x2-3*x3+x4; ty1:=-y1+3*y2-3*y3+y4;</div><div class="code_line">&nbsp;&nbsp;tx2:=3*x1-6*x2+3*x3; &nbsp; ty2:=3*y1-6*y2+3*y3;</div><div class="code_line">&nbsp;&nbsp;tx3:=-3*x1+3*x2; &nbsp; ty3:=-3*y1+3*y2;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;xstart:=x1;</div><div class="code_line">&nbsp;&nbsp;ystart:=y1;</div><div class="code_line">&nbsp;&nbsp;mu:=mu+mudelta;</div><div class="code_line">&nbsp;&nbsp;For n:=1 to Segments Do Begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;mu2:=mu*mu;</div><div class="code_line">&nbsp;&nbsp; &nbsp;mu3:=mu2*mu;</div><div class="code_line">&nbsp;&nbsp; &nbsp;xend:=Round (mu3*tx1+mu2*tx2+mu*tx3+x1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;yend:=Round (mu3*ty1+mu2*ty2+mu*ty3+y1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;Line ( &nbsp;xstart, ystart, xend, yend );</div><div class="code_line">&nbsp;&nbsp; &nbsp;mu:=mu+mudelta;</div><div class="code_line">&nbsp;&nbsp; &nbsp;xstart:=xend;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ystart:=yend;</div><div class="code_line">&nbsp;&nbsp;End;</div><div class="code_line">End;</div><div class="code_line">&nbsp;</div><div class="code_line">Procedure Catmull_Rom_Spline (NumPoints: Word; Points: Array Of pointtype; Segments: Word);</div><div class="code_line">{ Draw a spline approximating a curve defined by the array of points. &nbsp; }</div><div class="code_line">{ In contrast to the BSpline this curve will pass through the points &nbsp; &nbsp;}</div><div class="code_line">{ defining is except the first and the last point. The curve will only &nbsp;}</div><div class="code_line">{ pass through the first and the last point if these points are given &nbsp; }</div><div class="code_line">{ twice after eachother, like this: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">{ Array of points: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="code_line">{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="code_line">{ &nbsp;First point defined twice &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Last point defined twice &nbsp; &nbsp; }</div><div class="code_line">{ &nbsp; |-----| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|----------| &nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="code_line">{ (0,0),(0,0),(100,100),....,(150,100),(200,200),(200,200) &nbsp; &nbsp; &nbsp;}</div><div class="code_line">{ the curve defined by these points will pass through all the points. &nbsp; }</div><div class="code_line">Function Calculate (mu: Real; p0, p1, p2, p3: Integer): Integer;</div><div class="code_line">&nbsp;</div><div class="code_line">Var</div><div class="code_line">&nbsp;&nbsp;mu2, mu3: Real;</div><div class="code_line">&nbsp;</div><div class="code_line">Begin</div><div class="code_line">&nbsp;&nbsp;mu2:=mu*mu;</div><div class="code_line">&nbsp;&nbsp;mu3:=mu2*mu;</div><div class="code_line">&nbsp;&nbsp;Calculate:=Round ((1/2)*(mu3*(-p0+3*p1-3*p2+p3)+</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mu2*(2*p0-5*p1+4*p2-p3)+</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mu *(-p0+p2)+(2*p1)));</div><div class="code_line">End;</div><div class="code_line">&nbsp;</div><div class="code_line">Var</div><div class="code_line">&nbsp;&nbsp;mu, mudelta: Real;</div><div class="code_line">&nbsp;&nbsp;x1, y1, x2, y2, n, h: Integer;</div><div class="code_line">&nbsp;</div><div class="code_line">Begin</div><div class="code_line">&nbsp;&nbsp;If (NumPoints&#60;4) Or (NumPoints&#62;16383) then Exit;</div><div class="code_line">&nbsp;&nbsp;mudelta:=1/Segments;</div><div class="code_line">&nbsp;&nbsp;For n:=3 to NumPoints-1 Do Begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;mu:=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;x1:=Calculate (mu,Points[n-3].x,Points[n-2].x,Points[n-1].x,Points[n].x);</div><div class="code_line">&nbsp;&nbsp; &nbsp;y1:=Calculate (mu,Points[n-3].y,Points[n-2].y,Points[n-1].y,Points[n].y);</div><div class="code_line">&nbsp;&nbsp; &nbsp;mu:=mu+mudelta;</div><div class="code_line">&nbsp;&nbsp; &nbsp;For h:=1 to Segments Do Begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;x2:=Calculate (mu,Points[n-3].x,Points[n-2].x,Points[n-1].x,Points[n].x);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;y2:=Calculate (mu,Points[n-3].y,Points[n-2].y,Points[n-1].y,Points[n].y);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Line ( &nbsp;x1, y1, x2, y2 );</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;mu:=mu+mudelta;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;x1:=x2;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;y1:=y2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;End;</div><div class="code_line">&nbsp;&nbsp;End;</div><div class="code_line">End;</div><div class="code_line">Procedure BSpline (NumPoints: Word;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Points: Array of Pointtype; Segments: Word);</div><div class="code_line">type Rmas=array[0..10] of real;</div><div class="code_line">Var i,oldy,oldx,x,y,j:integer;</div><div class="code_line">&nbsp;&nbsp; &nbsp;part,t,xx,yy,xmin,xmax,sum:real;</div><div class="code_line">&nbsp;&nbsp; &nbsp;dx,dy,wx,wy,px,py,xp,yp,temp,path,zc,u:Rmas;</div><div class="code_line">&nbsp;</div><div class="code_line">Function f(g:real):real;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;f:=g*g*g-g;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">Begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if NumPoints&#62;10 then exit;</div><div class="code_line">&nbsp;&nbsp; &nbsp;oldx:=999;</div><div class="code_line">&nbsp;&nbsp; &nbsp;x:=Points[0].x;</div><div class="code_line">&nbsp;&nbsp; &nbsp;y:=Points[0].y;</div><div class="code_line">&nbsp;&nbsp; &nbsp;zc[0]:=0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=1 to NumPoints do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; xx:=Points[i-1].x-Points[i].x; yy:=Points[i-1].y-Points[i].y;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; t:=sqrt(xx*xx+yy*yy);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; zc[i]:=zc[i-1]+t; &nbsp; &nbsp; {establish a proportional linear progression}</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;{Calculate x &amp; y matrix stuff}</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=1 to NumPoints-1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; dx[i]:=2*(zc[i+1]-zc[i-1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; dy[i]:=2*(zc[i+1]-zc[i-1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=0 to NumPoints-1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; u[i]:=zc[i+1]-zc[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=1 to NumPoints-1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; wy[i]:=6*((Points[i+1].y-Points[i].y)/u[i]-(Points[i].y-Points[i-1].y)/u[i-1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; wx[i]:=6*((Points[i+1].x-Points[i].x)/u[i]-(Points[i].x-Points[i-1].x)/u[i-1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;py[0]:=0.0; px[0]:=0.0; &nbsp; &nbsp;px[1]:=0; py[1]:=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;py[NumPoints]:=0.0; px[NumPoints]:=0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=1 to NumPoints-2 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; wy[i+1]:=wy[i+1]-wy[i]*u[i]/dy[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; dy[i+1]:=dy[i+1]-u[i]*u[i]/dy[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; wx[i+1]:=wx[i+1]-wx[i]*u[i]/dx[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; dx[i+1]:=dx[i+1]-u[i]*u[i]/dx[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=NumPoints-1 downto 1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; py[i]:=(wy[i]-u[i]*py[i+1])/dy[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; px[i]:=(wx[i]-u[i]*px[i+1])/dx[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;{ Draw spline &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i:=0 to NumPoints-1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; for j:=0 to 30 do</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;part:=zc[i]-(((zc[i]-zc[i+1])/30)*j);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;t:=(part-zc[i])/u[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;part:=t*Points[i+1].y+(1-t)*Points[i].y+u[i]*u[i]*(f(t)*py[i+1]+f(1-t)*py[i])/6.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;y:=round(part);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;part:=zc[i]-(((zc[i]-zc[i+1])/30)*j);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;t:=(part-zc[i])/u[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;part:=t*Points[i+1].x+(1-t)*Points[i].x+u[i]*u[i]*(f(t)*px[i+1]+f(1-t)*px[i])/6.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;x:=round(part);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if oldx&#60;&#62;999 then line(oldx,oldy,x,y);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;oldx:=x;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;oldy:=y;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; end;</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">END.</div></ol></div></div></div></div>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611188</guid>
        <pubDate>Mon, 14 Feb 2005 04:05:43 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611188</link>
        <description><![CDATA[Falex: Интересно как я деньги буду платить?<br>P.S&gt;Но я не собираюсь.]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611075</guid>
        <pubDate>Sun, 13 Feb 2005 19:12:06 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611075</link>
        <description><![CDATA[Romtek: <strong class='tag-b'>Falex</strong>, похоже, ты просто хочешь, чтобы за тебя написали программу. &lt;_&lt; <br>
Если так, то я могу направить топик прямо в раздел &quot;Работа&quot;. Там за деньги тебе с радостью помогут.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=83232&view=findpost&p=611053'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Falex &#064; <time class="tag-quote__quoted-time" datetime="2005-02-13T18:46:42+00:00">13.02.05, 18:46</time></span><div class='quote '>мне надо их как-то нарисовать (причёт строго между точками)&#33;</div></div><br>
Пример там есть&#33; Только бери, да подставляй свои функции.]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611053</guid>
        <pubDate>Sun, 13 Feb 2005 18:46:42 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611053</link>
        <description><![CDATA[Falex: Чтобы это всё в цикле было.<br>Если я например найду эти полиномы для всех точек, то мне надо их как-то нарисовать (причёт строго между точками)&#33;&#33;]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611003</guid>
        <pubDate>Sun, 13 Feb 2005 17:47:11 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=611003</link>
        <description><![CDATA[Romtek: <a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=52226' target='_blank'>Как нарисовать график функции</a>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610999</guid>
        <pubDate>Sun, 13 Feb 2005 17:31:50 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610999</link>
        <description><![CDATA[Falex: А как тогда построить несколько графиков функции на разных отрезках.Например:<br>
x*x на [5,10]<br>
x*x*x  на [10,15]<br>
exp(x) на [15,20]]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610975</guid>
        <pubDate>Sun, 13 Feb 2005 16:52:17 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610975</link>
        <description><![CDATA[Romtek: <strong class='tag-b'>Falex</strong>, мне то ясно: надо или самому думать, или искать в интернете.<br>
Мне это не надо, поэтому не ищу.]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610932</guid>
        <pubDate>Sun, 13 Feb 2005 15:55:43 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610932</link>
        <description><![CDATA[Falex: Ну что - теперь ясно?]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610815</guid>
        <pubDate>Sun, 13 Feb 2005 13:42:39 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610815</link>
        <description><![CDATA[Falex: Вобщем, если ты читал статью, которую ты привёл, то всё тоже самое, только за <strong class='tag-b'>исключением следующего:</strong><br>
между точками x[i] и x[i+1], которые у меня выводятся в файл в моей программе построить кубический сплайн<br>
(<strong class='tag-b'>нарисовать его</strong>).Тоесть, если точке N=4, то будет три кубических сплайна (естественно коэффициенты у них будут разные в зависимости точек x): первый сплайн между a=x[1] и x[2]; второй - между x[2] и x[3]; третий - между x[3] и x[4]=b.]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610730</guid>
        <pubDate>Sun, 13 Feb 2005 11:17:13 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610730</link>
        <description><![CDATA[Romtek: Хорошо, А тебе именно для интерполяции или чего-то другого? <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-02-13T11:20:02+00:00">13.02.05, 11:20</time></span></span><br>
И, вообще, какие параметры даны, а что надо вычислить.<br>
<strong class='tag-b'>Приведи полностью задание.</strong>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610671</guid>
        <pubDate>Sun, 13 Feb 2005 10:24:54 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610671</link>
        <description><![CDATA[Falex: Да был я там.Скачал delphi исходник.Да так и ничего и не понял.]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610602</guid>
        <pubDate>Sun, 13 Feb 2005 08:27:22 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610602</link>
        <description><![CDATA[Romtek: <a class='tag-url' href='http://alglib.manual.ru/interpolation/spline3.php' target='_blank'>Интерполяция функции кубическими сплайнами</a>]]></description>
        <author>Romtek</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610597</guid>
        <pubDate>Sun, 13 Feb 2005 08:18:26 +0000</pubDate>
        <title>3 Spline</title>
        <link>https://forum.sources.ru/index.php?showtopic=83232&amp;view=findpost&amp;p=610597</link>
        <description><![CDATA[Falex: Здраствуйте.Помогите решить вторую половину задачи.<br>
Первая половина представлена в файле.Её суть: дан отрезок и функция.Разделить отрезок на N равных частей<br>
и таблицу результатов занести в файл.<br>
А вот со второй задачей я вряд ли справлюсь.Её суть: между точками x[i] и x[i+1] построить кубический сплайн&#33;&#33;&#33;]]></description>
        <author>Falex</author>
        <category>Pascal</category>
      </item>
	
      </channel>
      </rss>
	