# Thread: some serious mathproblem i need help with, sinusoidal spiral etc

1. ## some serious mathproblem i need help with, sinusoidal spiral etc

First post here so i hope im in the right forum, but i sort of suck at math so cant be sure.

My problem is that i need help with figuring out how to do the maths for a certain type of timer/clock.

The clock looks sort of like this

*edit* noticed an error i made, the image/clock should only have 12 hours just like a normal analog clock, NOT 24 as the image has.

This is only the first 6 minutes of it and it also sligthtly wrong, the second hand should travel on the minute hand really.

The timers hands are based on the following Lemniscate -- from Wolfram MathWorld

What i need help with is how i can set a certain width and length for the arms of the hands.

This i need due to that the timer is used in a game i play and it's an imperative part to being successfull. The timers size is also based on the different continents sizes in the game.

each continent has this timer placed in the middle and here is one of the continents http://jaxmap.net/pdf/efull.pdf and each coord is 1m

other continent is here http://jaxmap.net/pdf/afull.pdf

If someone would be able to help me with this i would be very very gratefull

Also if someone could calculate how long it would take the hands to go from exactly aligned 12 o clock to next fulyl aligned 12 o clock would be great, i think it should be ~4 days

*edit again*

The hour hand spins one turn as a regular clock ie 12 hour to make one full spin, the minute hand spins one spin and travels along the hour hands side in 60 minutes and the second hand does the same on the minute hand but in 60 secfonds.

The timer is sort of placed on top of the map, and each time the first side of the timer passes over an area it raises the loot values in that area, and then when the timer passes with it's endpart it lowers the values again, that is why the width is important aswell.

I also had a friend make the image of the timer in mathematica i think, and here is the code he used if that could be of any help

Code:
function LemniscateClock(StartTime,Duration,DoRender)
% LemniscateClock(StartTime,Duration,Render)
% Plots 3 Lemniscates (hour, min, sec)
% at StartTime in minutes
% for Duration in minutes
% DoRender == 1 does render to animated GIF
% -- Author ---
% Marc falkao Falk, Entropia Universe

%lemnisacte param
a=1; %scale parameter for Lemniscate, not used atm
l = 2*a*5.2441; %circumference std lemniscate
t = 0:.01:2*pi; %time vector
%timers
d = 24; %total hours
tim = d; %multiplier for min
tis = d*60; %multiplier for sec

%simple param handling
if nargin < 1
StartTime = 0; %00:00
Duration = 10; %6 min
DoRender = 0;  %render off
end

if nargin == 1
StartTime = 2*pi/d/60 * StartTime;
Duration = 10;
DoRender = 0;
end

if nargin == 2
StartTime = 2*pi/d/60 * StartTime;
Duration = 60 / Duration;
DoRender = 0;
end

%define axis
ax = axes('XLim',[-4 4],'YLim',[-4 4]);
axis equal

%== Clock ==
hc = rectangle('Position',[-sqrt(2)*a,-sqrt(2)*a,2*sqrt(2)*a,2*sqrt(2)*a],'Curvature',[1,1]);
hold on

% Plot the numbers 1-12 on the screen
% --Declare variables to be used in the plotting the clock numbers
Clk_fSize = 12;                                  % controls the font size of the numbers of the clock
Clk_fTheta = ((d-4)*pi/d/2:-2*pi/d:-3/2*pi)';           % sets the Theta for each number position, goes from pi/2 to -3/2pi
Clk_numbas = (1:1:d)';
text(Clk_nData(:,1),Clk_nData(:,2),num2str(Clk_nData(:,3)),...
'horizontalAlignment','center','verticalAlignment','middle','FontSize',Clk_fSize);
%== Tic Marks
% Define the Length of the Tic marks
TLenStart = sqrt(2)*a-.1;    % Start of the Tick mark (distance from origin)
TLenStop = sqrt(2)*a;     % End of the Tick mark (distance from origin)
[STX,STY,TTX,TTY] = ticMark(TLenStart,TLenStop);
% Plot Skinny and Thick Tick marks on the clock face
plot(TTX,TTY, 'linewidth',2,'color','k');
%hour marker
hh = plot([-sqrt(2)*a,-sqrt(2)*a-.1],[0,0], 'linewidth',2,'color','b');

%== Leminscate ==
h = plot(sqrt(2)*a*cos(t)./(1+sin(t).^2),2*pi/d*sqrt(2)*a*cos(t).*sin(t)./(1+sin(t).^2));
axis(a*[-2.2 2.2 -2.2 2.2])
hold off

%transforms
th = hgtransform('Parent',ax);
thc = hgtransform('Parent',ax); %circle
tm = hgtransform('Parent',th);
ts = hgtransform('Parent',th);
set(get(ax,'Parent'),'Renderer','opengl','DoubleBuffer','on')

set(h,'Parent',th); %Hour Lamnisacte
set(hc,'Parent',thc); %circle
set(hh,'Parent',th); %hour marker
hm = copyobj(h,tm);copyobj(hh,tm); %Min Lamnisacte
hs = copyobj(h,ts);copyobj(hh,ts); %Sec Lamnisacte

set(h,'Color','k');
set(hm,'Color','b');
set(hs,'Color','r');

Sxy = makehgtform('scale',[1 2*pi/d*sqrt(2)*a 1]);
Rz = makehgtform('zrotate',pi/2+StartTime); %Start at 0 hour+ StartTime
set(th,'Matrix',Rz)

drawnow;

if DoRender == 1
M = getframe;
map = [0 0 0;.8 .8 .8; 1 0 0; 0 0 1; 1 1 1];
im(:,:,1,1) = rgb2ind(M.cdata,map,'nodither');
end

%end part1 insert part 2 thereafter to complete the m-file

%part 2
%animation
i = 2;
for r = pi/2+StartTime:.0001:pi/2+StartTime+2*pi/d/Duration
% Form z-axis rotation matrix
Rz = makehgtform('zrotate',-r);
Rzm = makehgtform('zrotate',-r*tim);
Rzs = makehgtform('zrotate',-r*tis);
rm = (r -pi/2) * tim + pi/2;
Txym = makehgtform('translate',sqrt(2)*a*[cos(rm)./(1+sin(rm).^2) 2*pi/d*cos(rm).*sin(rm)./(1+sin(rm).^2) 0]);
rs = (r -pi/2) * tis + pi/2;
Txys = makehgtform('translate',sqrt(2)*a*[cos(rs)/(1+sin(rs).^2) 2*pi/d*cos(rs).*sin(rs)./(1+sin(rs).^2) 0]);
% Set transforms for both hgtransform objects
set(th,'Matrix',Rz)
%with rotation

set(tm,'Matrix',Txym*Rzm*eye(4))
set(ts,'Matrix',Txys*Rzs*eye(4))

drawnow,%pause(.1)
if DoRender == 1
M = getframe;
im(:,:,1,i) = rgb2ind(M.cdata,map,'nodither');
end
i = i + 1;
end

if DoRender == 1
imwrite(im,map,'LemniscateClock_tmp.gif','DelayTime',0,'LoopCount',inf)
end

function [STX,STY,TTX,TTY] = ticMark(TLenStart,TLenStop)
%ticMark is given the distance from center to start the tick
% marks (TLenStart) and the distance from origin to stop the
% tick marks (TLenStop).
%STTTheta 60 point array going clockwise skinny ticmarks
STTheta = ((d-4)*pi/d/2:-2*pi/d/60:-3/2*pi);

%Calculates X Y coordinates for all 60 skinny tick marks
STX = [TLenStart*cos(STTheta') TLenStop*cos(STTheta')]';
STY = [TLenStart*sin(STTheta') TLenStop*sin(STTheta')]';
%TTTheta 12 point array going around clockwise thick tic marks
TTTheta = ((d-4)*pi/d/2:-2*pi/d:-3/2*pi);
%Calculates X Y coordinates for all 12 thick tic marks
TTX = [TLenStart*cos(TTTheta') TLenStop*cos(TTTheta')]';
TTY = [TLenStart*sin(TTTheta') TLenStop*sin(TTTheta')]';
end %end ticmark function
end %main function

3. Also if someone could calculate how long it would take the hands to go from exactly aligned 12 o clock to next fulyl aligned 12 o clock would be great, i think it should be ~4 days
I think it should be 12 hours.

4. Originally Posted by malaygoel
I think it should be 12 hours.
no not as the maps aint totally square, and also due to how the hands move on each other i belive they will take longer.. but i'm not sure though as i havent been able to check.

...
Also if someone could calculate how long it would take the hands to go from exactly aligned 12 o clock to next fulyl aligned 12 o clock would be great, i think it should be ~4 days
I do not know what you are trying to do or how you are using the clock.
The maps make no real sense or direct connection with the use of the clock.

How do you get 4 days?
Of the three hands:

Each time the second hand rotates 1 full turn it aligns with the 12 (or 24 as shown);

Each time the minute hand rotates 1 full turn it should align with the 12 o'clock position;

Each time the hour hand rotates 1 full turn it should align with the 12 o'clock position;

At that point (12 hours) all three should simultaneously align with the 12 o'clock position.

6. Originally Posted by aidan
I do not know what you are trying to do or how you are using the clock.
The maps make no real sense or direct connection with the use of the clock.

How do you get 4 days?
Of the three hands:

Each time the second hand rotates 1 full turn it aligns with the 12 (or 24 as shown);

Each time the minute hand rotates 1 full turn it should align with the 12 o'clock position;

Each time the hour hand rotates 1 full turn it should align with the 12 o'clock position;

At that point (12 hours) all three should simultaneously align with the 12 o'clock position.
The clock is used in the game as a layer on top of the maps, every time a part of the clocks hands sides passes over an area the value of the loot goes up in that area and when the same hand passes again with the other side it gets lowered again. the maps was provided to give the size of the continents to get the size of the sides of the clock and length of them also.

And as i said i'm not very good at logical thinking but i thought that due to that the map is not totally square the hands would not be totally uniform or what one could call it and thus lag behind a bit on some places so they got slightly out of synch.