trigonometry

ActionScript 3 Trig Equations to create Ellipse

£可爱£侵袭症+ 提交于 2020-01-17 02:15:40
问题 I am working with this function that moves an object around a center point in a perfect circle and am trying to modify it to move it in an oval shape that is 1/2 as high as it is wide? Basically, I have a set speed var myVelocity:Number = 0.25; then I calculate my Sine and Cosine based on the speed var myCos:Number = Math.cos(myVelocity); var mySin:Number = Math.sin(myVelocity); then I figure the distance of the the object from a fixed center points along each axis and var x1:Number = myBall

ActionScript 3 Trig Equations to create Ellipse

為{幸葍}努か 提交于 2020-01-17 02:15:02
问题 I am working with this function that moves an object around a center point in a perfect circle and am trying to modify it to move it in an oval shape that is 1/2 as high as it is wide? Basically, I have a set speed var myVelocity:Number = 0.25; then I calculate my Sine and Cosine based on the speed var myCos:Number = Math.cos(myVelocity); var mySin:Number = Math.sin(myVelocity); then I figure the distance of the the object from a fixed center points along each axis and var x1:Number = myBall

Plotting the reciprocal of a sine wave in MatLab

心不动则不痛 提交于 2020-01-17 01:13:09
问题 I'm having difficulties trying to plot the reciprocal of a basic sine wave within MatLab. The tutorial I'm following (not a MatLab tutorial) is plotting it by hand by placing a few points between each vertical asymptote to give you an idea of what the graph will look like. I've tried using MatLab's csc() function, and the graph when plotted along side x is nothing like the drawn example. The drawn example from 0 to pi looks similar to a big U and from pi to 2*pi is a negative version (upside

Creating a stereo sin WAV using C

左心房为你撑大大i 提交于 2020-01-16 03:29:16
问题 I am trying to create a stereo sine WAV in C, with the possibility to have a different (and possibly blank) left and right channels. A tone is generated for each channel with this function: int16_t * create_tone(float frequency, float amplitude, float duration) I then open a FILE* and call create_wav . Here are the two structures I'm using to create the WAV: struct wav_h { char ChunkID[4]; int32_t ChunkSize; char Format[4]; char Subchunk1ID[4]; int32_t Subchunk1Size; int16_t AudioFormat;

acos function in Sqlite

青春壹個敷衍的年華 提交于 2020-01-15 12:15:42
问题 I have a question about SQLite queries. I need to execute a sqlite query like this: SELECT id, ( 6371 * acos ( cos ( radians(78.3232) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(65.3234) ) + sin ( radians(78.3232) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 30 ORDER BY distance LIMIT 0 , 20; But I obtain an error because Sqlite not support functions like acos . Is there a way to execute my query in Sqlite? I need to use this on iOS. Any practical

How to move point along circle?

一曲冷凌霜 提交于 2020-01-13 19:46:20
问题 I want to move a sprite in a circular motion by using a circle radius and movingangle. I know for instance that the sprite is moving in a circle with the radius 10 and It's current position is (387,38) and angle is 28 degrees. Now I wann't move it say, 100px along the circle perimeter. p1 = x&y coordinate, known (387,38) in example with movingangle 28 degrees r = radius, known (10 in example) l = distance to move along bend, known (100px in example) p2 = new point, what is this x and y value?

Calculate 3D point coordinates using horizontal and vertical angles and slope distance

杀马特。学长 韩版系。学妹 提交于 2020-01-13 13:05:15
问题 I am trying to learn how to calculate the XYZ coordinates of a point using the XYZ coordinates of an origin point, a horizontal and vertical angle, and 3d distance. I can make the calculations simply by projecting the points onto 2D planes, but is there a more straightforward way to do this in 3D? I am trying to understand how a surveying total station calculates new point locations based on it's measured location, the 3d (slope) distance that it measures to a new point, and the measured

Calculate 3D point coordinates using horizontal and vertical angles and slope distance

≡放荡痞女 提交于 2020-01-13 13:04:09
问题 I am trying to learn how to calculate the XYZ coordinates of a point using the XYZ coordinates of an origin point, a horizontal and vertical angle, and 3d distance. I can make the calculations simply by projecting the points onto 2D planes, but is there a more straightforward way to do this in 3D? I am trying to understand how a surveying total station calculates new point locations based on it's measured location, the 3d (slope) distance that it measures to a new point, and the measured

Vectorized Trig functions in C?

筅森魡賤 提交于 2020-01-12 07:30:27
问题 I'm looking to calculate highly parallelized trig functions (in block of like 1024), and I'd like to take advantage of at least some of the parallelism that modern architectures have. When I compile a block for(int i=0; i<SIZE; i++) { arr[i]=sin((float)i/1024); } GCC won't vectorize it, and says not vectorized: relevant stmt not supported: D.3068_39 = __builtin_sinf (D.3069_38); Which makes sense to me. However, I'm wondering if there's a library to do parallel trig computations. With just a

Convert lat/lon to pixel coordinate?

好久不见. 提交于 2020-01-08 13:23:29
问题 I'm trying to convert a lat/lon pair to a pixel coordinate. I have found this mercator projection but I don't understand the code. What is the factor,x_adj, y_adj variable? When I run the code without those constants my lat/lon pair is not on my map and the x and y pixel coordinate is not what I want. function get_xy(lat, lng) { var mapWidth=2058; var mapHeight=1746; var factor=.404; var x_adj=-391; var y_adj=37; var x = (mapWidth*(180+lng)/360)%mapWidth+(mapWidth/2); var latRad = lat*Math.PI