# Rotating a partial section of a circle around its center

**URL:** <https://forum.kirupa.com/t/rotating-a-partial-section-of-a-circle-around-its-center/286341>\
**Category:** programming\
**Created:** [April 14, 2009, 6:32am UTC](https://forum.kirupa.com/t/rotating-a-partial-section-of-a-circle-around-its-center/286341 "2009-04-14T06:32:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![psr1978](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@psr1978](https://forum.kirupa.com/u/psr1978)\
**Post date:** [April 14, 2009, 6:32am UTC](https://forum.kirupa.com/t/rotating-a-partial-section-of-a-circle-around-its-center/286341/1 "2009-04-14T06:32:29Z")

</div>

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 \*\* [COLOR=Red]/ HERE IS PROBLEM, How to locate region between two points A and B[/COLOR]\*\*  
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 **[COLOR=Red]/ HERE IS PROBLEM, How to locate region between two points A and B[/COLOR]**  
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 

```

I just wanted to get the region between the two nodes. Thank you.

Regards,

PSR
