Do you perhaps want to generate the
y points for a sine wave, as a function of time, and then apply a linear/affine transformation?
A linear transformation includes rotation, shearing and stretching. An affine transformation can also include shifting the points up/down/left/right by a fixed amount.
The MATLAB code that produced the above figure is as follows. Most of it is declarations of the desired characteristics of the sine wave, its size, the rotation angles, and so on.
The core of what you need is just a matrix multiplication of the old point
x1,y1 by a linear transformation matrix, which rotates, scales and skews, followed by adding the constant up/down/left/right shift. This gives the new transformed point
If you generalise to an "affine" transform, then you can do all of this in one 3x3 matrix multiplication. This is just as easy, but the maths is (very slightly) more complicated. For this example I'll stick with the "most obvious" way.
% Define sine wave amplitude and frequency
frequency = 5;
amplitude = 2;
% Calculate sine wave (x,y) points over time interval t
t = 0:0.01:2*pi; % vector of time values - 0 to 2*pi in steps of 0.01
x1 = t;
y1 = amplitude * sin(frequency*t);
% Produce plot
% Define transform parameters
scale = 5; % 5 times bigger
shift = [ -15
-10 ]; % shift 15 units left, and 10 units down
theta = pi/6; % 30 degrees
rotation_matrix = [ cos(theta), -sin(theta)
sin(theta), cos(theta) ];
% Transform points via scaling, shifting, and rotation
% make empty arrays to store new points in
x2 = zeros(size(t));
y2 = zeros(size(t));
% Transform points one at a time
for i = 1:length(t)
old_xy = [ x1(i)
% calculate transformed x and y
new_xy = ( rotation_matrix * old_xy * scale ) + shift;
% Store calculated values to vector
x2(i) = new_xy(1);
y2(i) = new_xy(2);
% Make a pretty picture
The ingredients for what you want are here: you just have to figure out how to get the sine wave to start and stop at your desired endpoints. I leave this exercise in trigonometry up to you.
(Note: If you can't figure out how to find the transformation that will give a sine wave starting a point A and ending at point B, it would be better to ask math.stackexchange.com instead of StackOverflow - that would be a geometry question, not a programming question. Do post links between the related questions, though.)
Edit 2: Slightly incorrect use of mathematical terms - translation is not a linear transformation; it's actually an affine transform, where affine transforms are the more general version of linear transforms.