math

how to control the speed of animation, using a Bezier curve?

你。 提交于 2020-01-16 02:50:47
问题 I found formula only for vector coordinates of cubic curve who help in depicts(build vector image). Here it is: B(t) = (1-t)^3*P0 + 3*t*(1-t)^2*P1 + 3*t^2*(1-t)*P2 + t^3*P3 See more at: http://www.ams.org/samplings/feature-column/fcarc-bezier#sthash.85XhcT7H.dpuf This formula returns the coordinates of the vector, but I can not understand how they can influence the speed of the animation, as in http://cubic-bezier.com/#.17,.67,.83,.67. Please, direct me to the right way so that I could

Batch SetLocal EnableDelayedExpansion and Math problems

…衆ロ難τιáo~ 提交于 2020-01-16 00:54:08
问题 C:\WINDOWS\system32>SetLocal EnableDelayedExpansion C:\WINDOWS\system32>set/a Number1=3+9 12 C:\WINDOWS\system32>if !Number1!==9+3 (echo Good) else (echo Bad) Bad C:\WINDOWS\system32>if !Number1!==3+9 (echo Good) else (echo Bad) Bad C:\WINDOWS\system32>set/a i=9+3 12 C:\WINDOWS\system32>if !Number1!==%i% (echo Good) else (echo Bad) Bad I expected to see the last results (and maybe some others) to show Good as a result but did not! I think this is because it is a error with the SetLocal

Secant method of iteration into PHP

随声附和 提交于 2020-01-16 00:25:24
问题 How would i turn the secant method of iteration into php? The formula is x i+1 = x i - (f(x i ) (x i -x i+1 ))/f(x i )-f(x i-1 ) where f = function and i is an iteration. so x i+1 is the next iteration after x i So far I have seen this, but there is somethning wrong somewhere in it so i want to make one from scratch, unless someone here can see what is wrong with it? while ((abs($y0 - $y1) > FINANCIAL_ACCURACY) && ($i < FINANCIAL_MAX_ITERATIONS)) { $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0

How to do this coordinate system operation more efficiently?

╄→гoц情女王★ 提交于 2020-01-15 16:00:50
问题 I'm making a 3D game, where the player's back should always be facing the camera and he should move in that direction. I didn't come to the "back facing the camera" part yet, but I believe that it will be simple once I figure out how to move the player in the right direction... Though it is a 3D coordinate system, height can be ignored (z-axis) because no matter how high the camera is, the player should always be going in the same speed (the camera system is planned to function much like in

How to do this coordinate system operation more efficiently?

泄露秘密 提交于 2020-01-15 16:00:22
问题 I'm making a 3D game, where the player's back should always be facing the camera and he should move in that direction. I didn't come to the "back facing the camera" part yet, but I believe that it will be simple once I figure out how to move the player in the right direction... Though it is a 3D coordinate system, height can be ignored (z-axis) because no matter how high the camera is, the player should always be going in the same speed (the camera system is planned to function much like in

How to hide or delete the zero in my bash script?

左心房为你撑大大i 提交于 2020-01-15 15:33:51
问题 This is my script: echo -n "number 1 :"; read bil1 echo -n "number 2 :"; read bil2 multiple=$(echo $bil1*$bil2 |bc -l |sed -e 's/^\./0./' -e 's/^-\./-0./'); echo " Your result : $bil1 * $bil2 = $multiple "; If I input 9.5 for $bil1 and 300 for $bil2 , the result is 2850.0 . I want the result: Your result : 9.5 * 300 = 2850 How do I hide or delete the zero at the end of the result? I.e. show only 2850 ? 回答1: Add the following part to your sed command (at the end): -e 's/\.0*$//' (Delete a dot

How to hide or delete the zero in my bash script?

余生颓废 提交于 2020-01-15 15:31:15
问题 This is my script: echo -n "number 1 :"; read bil1 echo -n "number 2 :"; read bil2 multiple=$(echo $bil1*$bil2 |bc -l |sed -e 's/^\./0./' -e 's/^-\./-0./'); echo " Your result : $bil1 * $bil2 = $multiple "; If I input 9.5 for $bil1 and 300 for $bil2 , the result is 2850.0 . I want the result: Your result : 9.5 * 300 = 2850 How do I hide or delete the zero at the end of the result? I.e. show only 2850 ? 回答1: Add the following part to your sed command (at the end): -e 's/\.0*$//' (Delete a dot

Setting X Coordinate from Mouse Location

吃可爱长大的小学妹 提交于 2020-01-15 12:20:38
问题 i have a darkBlueRect rectangle sprite and a copy of the same sprite with a larger scale and a lighter color - lightBlueRect . i'm attempting to shift the location of the lightBlueRect according to the mouse.x location when the mouse is moving over the darkBlueRect . this way if the mouse is on the right of the darkBlueRect than the location of the scaled up lightBlueRect will be on the opposite side and shifted towards the left proportionate to the mouse position and scale. in addition, the

SQL abs calculation - using latitudes and longitudes - MATH!

浪尽此生 提交于 2020-01-15 11:44:08
问题 I've got an sql query that pulls locations from a database based on coordinates within a certain range. Now I'm trying to order them by proximity with a bit of math - but no matter how many times im writing it out on paper I can't seem to figure out a working solution. lets describe a few variables: $plat (the latitude of the place) $plong (the longitude of the place) $slat (the latitude of the searched location) $slong (the longitude of the searched location) One big thing to note is that I

Arithmetic error when adding two double values [duplicate]

隐身守侯 提交于 2020-01-15 11:14:39
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Floating point inaccuracy examples double arithmetic and equality in Java I caught this issue while trying to debug a sorting routine that checked if two values were equal. Getting the values was simply doing some addition on two double variables: 0.31 + 0.27. When the sort compared the sum of those two against the some of another objects, whose sum also equaled 0.58, it told me the comparison was not equal.