Quantcast
Channel: Cadence PCB Skill Forum
Viewing all articles
Browse latest Browse all 2130

trigonometric functions - move point on circle circumference

$
0
0
Dear All,

 

I am trying to move a point in circular rotation with an incremental angle about the origin with a constant radius value as input..

 

procedure( circlerotation()

theta = evalstring(axlUIPrompt("Enter theta" "100"))

rad = evalstring(axlUIPrompt("Enter circle radius in mils" "100"))

N = evalstring(axlUIPrompt("Enter number of points # i.e. rotation increments" "10"))

oldx = rad

oldy = 0

i = 0

printf("%L coordinates X%L  Y%L : %L %L rotation %L\n" i i i oldx oldy  theta*i )

for( i 1 N-1

 

Newx = oldx * cos(theta) - oldy * sin(theta)

Newy = oldy * cos(theta) + oldx * sin(theta)

oldx = Newx

oldy = Newy

printf("%L coordinates X%L  Y%L : %L %L rotation %L\n" i i i Newx Newy  theta*i )

 

++i

)

)

 

With theta as 36 and radius as 100, N as 10 I get the below coordinates the output is as below.

 

theta value : 36:

0 coordinates X0  Y0 : 100 0 rotation 0

1 coordinates X1  Y1 : -12.79637 -99.17789 rotation 36

2 coordinates X2  Y2 : -96.72506 25.38234 rotation 72

3 coordinates X3  Y3 : 37.55096 92.68185 rotation 108

4 coordinates X4  Y4 : 87.11474 -49.10216 rotation 144

5 coordinates X5  Y5 : -59.84601 -80.11526 rotation 180

6 coordinates X6  Y6 : -71.79851 69.60585 rotation 216

7 coordinates X7  Y7 : 78.22121 62.30122 rotation 252

8 coordinates X8  Y8 : 51.77956 -85.55044 rotation 288

9 coordinates X9  Y9 : -91.47302 -40.40652 rotation 324

 

Questions: What units are used for angle radians/degree?

I observed the points are not plotted incrementally along the circle circumference in clockwise or in anticlockwise. How to move points incrementally in clockwise/anticlockwise.

 

Any help would be appreciated.

 

Thanks,

Nagaraj.

Viewing all articles
Browse latest Browse all 2130

Trending Articles