Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to draw a sine wave with specified start point, end point and length. To do so I have already done finding Amplitude and Period for sine function.

The problem is that sine wave is not fitted into points (its below). Please take a look: input

What I thought how to solve this: 1) Create two vectors. First vector is from starting to ending point and second vector is from starting wave point to ending wave point 2) Calculate angle between them 3) Try to rotate the sine wave with computed angle 4) Add y offset in order to fit sine wave between points (see output image)

But...There is a problem, the sine is not rotated in desired angle as You can see in this image (the blurred waves are made in graphic app). output

What is the problem?


objectStart = {-0.6061,0.2351}
objectEnd = {-0.1999,0.1787}
found sine = {y= 0.1 * sin( 24.85 * x)+0 foundLen=0.78}
curveStart = {-0.6061,-0.0601}
curveEnd = {-0.1999,0.0967} v1 = {0.4061,-0.0563}
v2 = {0.4061,0.1569}
angleBetweenVectors = 29.027 angleBetweenLineAndCurvePoints = -90.0

Code with comments:

Thanks for any help! Regards!


I have found that angle between vector divided by 2 (which is about 15 degree) is mine desired angle. But why I have to divide it by 2? Anyone knows?

share|cite|improve this question

1 Answer 1

Ok, I have found how to fit my sine curve. I have done it by adding delta y between those two vectors into the value of found sine function (blue). However, the sine wave which is now fitted between points is a little bit different (violet). I got a question for all you experts, does it affect the length of sine wave which i found or the length of the original and "moved" curves are the same? Here is the image

enter image description here

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.