<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=MathUtil</id>
	<title>MathUtil - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=MathUtil"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;action=history"/>
	<updated>2026-11-12T03:44:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1404&amp;oldid=prev</id>
		<title>Redspark: Added missing functions and marked some as MiniMicro only.</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1404&amp;oldid=prev"/>
		<updated>2025-04-05T04:23:10Z</updated>

		<summary type="html">&lt;p&gt;Added missing functions and marked some as MiniMicro only.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 04:23, 5 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot; &gt;Line 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| distanceToLineSegment(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| distanceToLineSegment(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| lineIntersectProportion(&amp;#039;&amp;#039;p1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p3&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p4&amp;#039;&amp;#039;) || look for an intersection between line p1-p2 and line p3-p4.  Return null if none found.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| lineSegmentsIntersect(&amp;#039;&amp;#039;p1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p3&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p4&amp;#039;&amp;#039;) || return whether the line segment p1-p2 intersects segment p3-p4.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| lineLineIntersection(&amp;#039;&amp;#039;p1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p3&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p4&amp;#039;&amp;#039;) || return the point at which line p1-p2 intersects line p3-p4.  If there is no intersection, this function returns null.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| reflect(&amp;#039;&amp;#039;vector&amp;#039;&amp;#039;, &amp;#039;&amp;#039;normal&amp;#039;&amp;#039;) || reflects a vector across a given normal.  This does the classic &amp;quot;angle of incidence equals angle of reflection&amp;quot; thing, where the angle is measured relative to the given normal vector.  &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| bounceVelocity(&amp;#039;&amp;#039;ball&amp;#039;&amp;#039;, &amp;#039;&amp;#039;lineSeg&amp;#039;&amp;#039;, &amp;#039;&amp;#039;friction&amp;#039;&amp;#039;=0.1) || Calculates the new velocity of something like a ball, after colliding with a (possibly moving) line segment.  &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| bounceOffSegment(&amp;#039;&amp;#039;ball&amp;#039;&amp;#039;, &amp;#039;&amp;#039;segment&amp;#039;&amp;#039;, &amp;#039;&amp;#039;friction&amp;#039;&amp;#039;=0.1, &amp;#039;&amp;#039;fracBefore&amp;#039;&amp;#039;=null) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a line segment. &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| bounceOffStaticPoly(&amp;#039;&amp;#039;ball&amp;#039;&amp;#039;, &amp;#039;&amp;#039;polyPts&amp;#039;&amp;#039;, &amp;#039;&amp;#039;friction&amp;#039;&amp;#039;=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a stationary polygon with points defined by polyPts. Returns true if bounced, false if not. &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| bounceOffPoly(&amp;#039;&amp;#039;ball&amp;#039;&amp;#039;, &amp;#039;&amp;#039;polyPts&amp;#039;&amp;#039;, &amp;#039;&amp;#039;prevPolyPts&amp;#039;&amp;#039;=null, &amp;#039;&amp;#039;friction&amp;#039;&amp;#039;=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a polygon with points defined by polyPts, possibly also moving from a previous position at prevPolyPts.  Returns true if bounced, false if not. &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| bounceOffMovingPoly(&amp;#039;&amp;#039;ball&amp;#039;&amp;#039;, &amp;#039;&amp;#039;polyPts&amp;#039;&amp;#039;, &amp;#039;&amp;#039;prevPolyPts&amp;#039;&amp;#039;=null, &amp;#039;&amp;#039;friction&amp;#039;&amp;#039;=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a polygon with points defined by polyPts, also moving from a previous position at prevPolyPts. Returns true if bounced, false if not.  &amp;#039;&amp;#039;&amp;#039;MiniMicro Only!&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| polyPerimeter(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;) || returns total distance around &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; (given as list of [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;]] points)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| polyPerimeter(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;) || returns total distance around &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; (given as list of [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;]] points)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l65&quot; &gt;Line 65:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 83:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| clamp(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;minval&amp;#039;&amp;#039;=0, &amp;#039;&amp;#039;maxval&amp;#039;=1) || return &amp;#039;&amp;#039;x&amp;#039;&amp;#039; limited to the range &amp;#039;&amp;#039;minval&amp;#039;&amp;#039; to &amp;#039;&amp;#039;maxval&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| clamp(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;minval&amp;#039;&amp;#039;=0, &amp;#039;&amp;#039;maxval&amp;#039;=1) || return &amp;#039;&amp;#039;x&amp;#039;&amp;#039; limited to the range &amp;#039;&amp;#039;minval&amp;#039;&amp;#039; to &amp;#039;&amp;#039;maxval&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| max(&amp;#039;&amp;#039;a&amp;#039;&amp;#039;, &amp;#039;&amp;#039;b&amp;#039;&amp;#039;) || returns the greater of two values.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| min(&amp;#039;&amp;#039;a&amp;#039;&amp;#039;, &amp;#039;&amp;#039;b&amp;#039;&amp;#039;) || returns the lesser of two values.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| numToStr(&amp;#039;&amp;#039;n&amp;#039;&amp;#039;, &amp;#039;&amp;#039;precision&amp;#039;&amp;#039;) || convert &amp;#039;&amp;#039;n&amp;#039;&amp;#039; to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| numToStr(&amp;#039;&amp;#039;n&amp;#039;&amp;#039;, &amp;#039;&amp;#039;precision&amp;#039;&amp;#039;) || convert &amp;#039;&amp;#039;n&amp;#039;&amp;#039; to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff::1.12:old-1392:rev-1404 --&gt;
&lt;/table&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1392&amp;oldid=prev</id>
		<title>Redspark at 00:46, 5 April 2025</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1392&amp;oldid=prev"/>
		<updated>2025-04-05T00:46:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 00:46, 5 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l82&quot; &gt;Line 82:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 82:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end while&amp;lt;/ms&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end while&amp;lt;/ms&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Category:Sys Modules]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Mini Micro]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Mini Micro]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Sys Modules&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Command-Line_MiniScript&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff::1.12:old-1391:rev-1392 --&gt;
&lt;/table&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1391&amp;oldid=prev</id>
		<title>Duck Mim: degToRad(&quot;radians&quot;) ----&gt; degToRad(&#039;&#039;degrees&#039;&#039;)</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1391&amp;oldid=prev"/>
		<updated>2025-04-04T20:29:05Z</updated>

		<summary type="html">&lt;p&gt;degToRad(&amp;quot;radians&amp;quot;) ----&amp;gt; degToRad(&amp;#039;&amp;#039;degrees&amp;#039;&amp;#039;)&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 20:29, 4 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot; &gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| radToDeg(&amp;#039;&amp;#039;radians&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;radians&amp;#039;&amp;#039; into degrees&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| radToDeg(&amp;#039;&amp;#039;radians&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;radians&amp;#039;&amp;#039; into degrees&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| degToRad(&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;radians&lt;/del&gt;&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;degrees&amp;#039;&amp;#039; into radians&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| degToRad(&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;degrees&lt;/ins&gt;&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;degrees&amp;#039;&amp;#039; into radians&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| moveTowards(&amp;#039;&amp;#039;num&amp;#039;&amp;#039;, &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039;, &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;=1) || returns a value closer to &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039; from &amp;#039;&amp;#039;num&amp;#039;&amp;#039;, differing from &amp;#039;&amp;#039;num&amp;#039;&amp;#039; by no more than &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| moveTowards(&amp;#039;&amp;#039;num&amp;#039;&amp;#039;, &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039;, &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;=1) || returns a value closer to &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039; from &amp;#039;&amp;#039;num&amp;#039;&amp;#039;, differing from &amp;#039;&amp;#039;num&amp;#039;&amp;#039; by no more than &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff::1.12:old-1387:rev-1391 --&gt;
&lt;/table&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1387&amp;oldid=prev</id>
		<title>Redspark: Added to Sys Modules Category</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1387&amp;oldid=prev"/>
		<updated>2025-03-31T16:09:39Z</updated>

		<summary type="html">&lt;p&gt;Added to Sys Modules Category&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:09, 31 March 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot; &gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Mini Micro]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Mini Micro]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Sys Modules]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff::1.12:old-783:rev-1387 --&gt;
&lt;/table&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=783&amp;oldid=prev</id>
		<title>JoeStrout: Created page with &quot;In Mini Micro, &lt;c&gt;mathUtil&lt;/c&gt; is an import module in the &lt;c&gt;/sys/lib&lt;/c&gt; directory.  It provides various additional math-related functions and constants.  Like all th...&quot;</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=783&amp;oldid=prev"/>
		<updated>2021-08-26T22:32:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;In &lt;a href=&quot;/wiki/Mini_Micro&quot; title=&quot;Mini Micro&quot;&gt;Mini Micro&lt;/a&gt;, &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an &lt;a href=&quot;/wiki/Import&quot; title=&quot;Import&quot;&gt;import&lt;/a&gt; module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.  Like all th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mathUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mathUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constant ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| mathUtil.e || [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler&amp;#039;s number], roughly 2.718; base of natural logarithms&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are normally accessed via the &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; prefix, e.g. &amp;lt;c&amp;gt;mathUtil.radToDeg(pi)&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| ln(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;) || natural logarithm of &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| radToDeg(&amp;#039;&amp;#039;radians&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;radians&amp;#039;&amp;#039; into degrees&lt;br /&gt;
|-&lt;br /&gt;
| degToRad(&amp;#039;&amp;#039;radians&amp;#039;&amp;#039;) || converts &amp;#039;&amp;#039;degrees&amp;#039;&amp;#039; into radians&lt;br /&gt;
|-&lt;br /&gt;
| moveTowards(&amp;#039;&amp;#039;num&amp;#039;&amp;#039;, &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039;, &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;=1) || returns a value closer to &amp;#039;&amp;#039;targetNum&amp;#039;&amp;#039; from &amp;#039;&amp;#039;num&amp;#039;&amp;#039;, differing from &amp;#039;&amp;#039;num&amp;#039;&amp;#039; by no more than &amp;#039;&amp;#039;maxChange&amp;#039;&amp;#039;)&lt;br /&gt;
|-&lt;br /&gt;
| moveTowardsXY(&amp;#039;&amp;#039;mover&amp;#039;&amp;#039;, &amp;#039;&amp;#039;target&amp;#039;&amp;#039;, &amp;#039;&amp;#039;maxDist&amp;#039;&amp;#039;=1) || like &amp;lt;c&amp;gt;moveTowards&amp;lt;/c&amp;gt;, but mutates map &amp;#039;&amp;#039;mover&amp;#039;&amp;#039; to approach &amp;#039;&amp;#039;target&amp;#039;&amp;#039;, each with &amp;#039;&amp;#039;x&amp;#039;&amp;#039; and &amp;#039;&amp;#039;y&amp;#039;&amp;#039; properties (e.g., a [[Sprite]])&lt;br /&gt;
|-&lt;br /&gt;
| distance(&amp;#039;&amp;#039;p1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p2&amp;#039;&amp;#039;) || find the distance between two points; each may be a map containing &amp;#039;&amp;#039;x&amp;#039;&amp;#039; and &amp;#039;&amp;#039;y&amp;#039;, or an [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;] list&lt;br /&gt;
|-&lt;br /&gt;
| lerp(&amp;#039;&amp;#039;a&amp;#039;&amp;#039;, &amp;#039;&amp;#039;b&amp;#039;&amp;#039;, &amp;#039;&amp;#039;t&amp;#039;&amp;#039;) || returns a value some portion &amp;#039;&amp;#039;t&amp;#039;&amp;#039; of the way from &amp;#039;&amp;#039;a&amp;#039;&amp;#039; to &amp;#039;&amp;#039;b&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| lerp2d(&amp;#039;&amp;#039;p1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;t&amp;#039;&amp;#039;) || same as &amp;lt;c&amp;gt;lerp&amp;lt;/c&amp;gt;, but on 2d points (maps or lists)&lt;br /&gt;
|-&lt;br /&gt;
| proportionAlongLine(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || returns how far &amp;#039;&amp;#039;p&amp;#039;&amp;#039; is along the line from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLine(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || returns closest point to &amp;#039;&amp;#039;p&amp;#039;&amp;#039; on the line from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039; as an [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;] list&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLineSegment(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || same as &amp;lt;c&amp;gt;nearestPointOnLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLine(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || returns distance from &amp;#039;&amp;#039;p&amp;#039;&amp;#039; to the line from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLineSegment(&amp;#039;&amp;#039;endA&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;, &amp;#039;&amp;#039;p&amp;#039;&amp;#039;) || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from &amp;#039;&amp;#039;endA&amp;#039;&amp;#039; to &amp;#039;&amp;#039;endB&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| polyPerimeter(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;) || returns total distance around &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; (given as list of [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;]] points)&lt;br /&gt;
|-&lt;br /&gt;
| polyArea(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;) || returns area of &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; (given as list of [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;]] points)&lt;br /&gt;
|-&lt;br /&gt;
| pointInPoly(&amp;#039;&amp;#039;point&amp;#039;&amp;#039;, &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;) || returns true if &amp;#039;&amp;#039;point&amp;#039;&amp;#039; (an [&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;] point) is contained within &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;; or if &amp;#039;&amp;#039;point&amp;#039;&amp;#039; is a list of [&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;y&amp;#039;&amp;#039;] points, returns true if any of those points are within &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| offsetPoly(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;, &amp;#039;&amp;#039;delta&amp;#039;&amp;#039;) || returns a new polygon by insetting/growing &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; by the given amount&lt;br /&gt;
|-&lt;br /&gt;
| shiftPoly(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;, &amp;#039;&amp;#039;dx&amp;#039;&amp;#039;, &amp;#039;&amp;#039;dy&amp;#039;&amp;#039;) || returns a new polygon by translating &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; by the given amounts&lt;br /&gt;
|-&lt;br /&gt;
| rotatePoly(&amp;#039;&amp;#039;polygon&amp;#039;&amp;#039;, &amp;#039;&amp;#039;degrees&amp;#039;&amp;#039;) || returns a new polygon by rotating &amp;#039;&amp;#039;polygon&amp;#039;&amp;#039; by &amp;#039;&amp;#039;degrees&amp;#039;&amp;#039; clockwise&lt;br /&gt;
|-&lt;br /&gt;
| randNormal(&amp;#039;&amp;#039;mean&amp;#039;&amp;#039;=0, &amp;#039;&amp;#039;stddev&amp;#039;&amp;#039;=1) || returns a [https://en.wikipedia.org/wiki/Normal_distribution normally-distributed] random number&lt;br /&gt;
|-&lt;br /&gt;
| randRange(&amp;#039;&amp;#039;min&amp;#039;&amp;#039;, &amp;#039;&amp;#039;max&amp;#039;&amp;#039;) || returns a random number between &amp;#039;&amp;#039;min&amp;#039;&amp;#039; and &amp;#039;&amp;#039;max&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| dice(&amp;#039;&amp;#039;numberOfDice&amp;#039;&amp;#039;=1, &amp;#039;&amp;#039;sides&amp;#039;&amp;#039;=6) || roll &amp;#039;&amp;#039;numberOfDice&amp;#039;&amp;#039; dice, each with values from 1 to &amp;#039;&amp;#039;sides&amp;#039;&amp;#039;, and return the sum&lt;br /&gt;
|-&lt;br /&gt;
| clamp(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;minval&amp;#039;&amp;#039;=0, &amp;#039;&amp;#039;maxval&amp;#039;=1) || return &amp;#039;&amp;#039;x&amp;#039;&amp;#039; limited to the range &amp;#039;&amp;#039;minval&amp;#039;&amp;#039; to &amp;#039;&amp;#039;maxval&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| numToStr(&amp;#039;&amp;#039;n&amp;#039;&amp;#039;, &amp;#039;&amp;#039;precision&amp;#039;&amp;#039;) || convert &amp;#039;&amp;#039;n&amp;#039;&amp;#039; to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following program creates a sprite, then uses &amp;lt;c&amp;gt;mathUtil.moveTowardsXY&amp;lt;/c&amp;gt; to make it chase the mouse.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
s = new Sprite&lt;br /&gt;
s.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push s&lt;br /&gt;
while true&lt;br /&gt;
	mathUtil.moveTowardsXY s, mouse, 10&lt;br /&gt;
	yield&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>