PDA

View Full Version : Rotating a partial section of a circle around its center with constant velocity



psr1978
April 9th, 2009, 04:54 AM
Halo all,


I am trying to develop a program with the following aim.

A partial section of a circle which rotates around its center with constant angular velocity.


Description:


A circle with radius 150 mm (center located at 0,0) is equipped with known points along its circumference as shown in Figure below. A partial section (with constant length) should be identified and observed as it moves around the circle. With the below mentioned code (written in FORTRAN) i am able to locate two points (point A and B) as they move with time but not able to capture points lying between these two points (A and B). Please check the code below. Thank you in advance.


c calculate the new position
c measure the Difference to the Center
difx1 = PointAx - originx
dify1 = PointAy - originy

difx2 = PointBx - originx
dify2 = PointBy - originy

c calculate the angle in RADIANs
c Theta = w * time w is angular velocity in rad/sec
radns = angvel * time

newx = cos(radns)
newy = sin(radns)

dx1 = (difx1 * newx) - (dify1 * newy)
dx2 = (difx2 * newx) - (dify2 * newy)

dy1 = (difx1 * newy) + (dify1 * newx)
dy2 = (difx2 * newy) + (dify2 * newx)

PointAx = originx + dx1
PointAy = originy + dy1

PointBx = originx + dx2
PointBy = originy + dy2

c check weather this node LIES in the heating Zone / HERE IS PROBLEM, How to locate region between two points A and B
if((points(1) .lt. PointBx) .or. (points(1) .gt. PointAx)) then

c NOT in the region
c DO Not apply anything

else
xin = .true.
end if

c / HERE IS PROBLEM, How to locate region between two points A and B
if((points(2) .lt. PointAy) .or. (points(2) .gt. PointB)) then

C Not in the region
C DO Not apply anything

else
yin = .true.
end if

IF (xin .and. yin) then

c WE are in the Region

end if



Regards,


PSR

salvador marley
April 11th, 2009, 09:02 AM
This is the drawing and design forum. You might have more luck if you post it on one of the other programming forums.

psr1978
April 14th, 2009, 02:36 AM
[ Posted in other Forum, please ignore it.

Moderator: Please delete this post. Am unable to delete this.quote=psr1978;2456514]Halo all,

I am trying to develop a program with the following aim.

A partial section of a circle which rotates around its center with constant angular velocity.


Description:


A circle with radius 150 mm (center located at 0,0) is equipped with known points along its circumference as shown in Figure below. A partial section (with constant length) should be identified and observed as it moves around the circle. With the below mentioned code (written in FORTRAN) i am able to locate two points (point A and B) as they move with time but not able to capture points lying between these two points (A and B). Please check the code below. Thank you in advance.


c calculate the new position
c measure the Difference to the Center
difx1 = PointAx - originx
dify1 = PointAy - originy

difx2 = PointBx - originx
dify2 = PointBy - originy

c calculate the angle in RADIANs
c Theta = w * time w is angular velocity in rad/sec
radns = angvel * time

newx = cos(radns)
newy = sin(radns)

dx1 = (difx1 * newx) - (dify1 * newy)
dx2 = (difx2 * newx) - (dify2 * newy)

dy1 = (difx1 * newy) + (dify1 * newx)
dy2 = (difx2 * newy) + (dify2 * newx)

PointAx = originx + dx1
PointAy = originy + dy1

PointBx = originx + dx2
PointBy = originy + dy2

c check weather this node LIES in the heating Zone / HERE IS PROBLEM, How to locate region between two points A and B
if((points(1) .lt. PointBx) .or. (points(1) .gt. PointAx)) then

c NOT in the region
c DO Not apply anything

else
xin = .true.
end if

c / HERE IS PROBLEM, How to locate region between two points A and B
if((points(2) .lt. PointAy) .or. (points(2) .gt. PointB)) then

C Not in the region
C DO Not apply anything

else
yin = .true.
end if

IF (xin .and. yin) then

c WE are in the Region

end if



Regards,


PSR[/quote]