LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a cercle with intensity graph

plz can any one tell me how to plot A circle with a black contour on a white background using an intensity graph

0 Kudos
Message 1 of 2
(2,348 Views)

The formula for a circle is dX^2 + dY^ 2 = R^2, where R is the radius you want. and dX, dY are distances from the center point you want.

that's the rectagular way to look at it.

 

the polar way is to remember that dX is R * cos(A) and dY = R * sin(A), where A is an angle in radians

 

assume cX is your center X coordinate and cY is your center Y coordinate.

You'll need to loop, using an appropriate value of N (16 is a good starting point, while you debug it).

 

set all DATA[x,y] to White  (background color)

Astep = 2 * pi / N   // your angular step

for i = 0 to N-1       // FOR  loop

    A = Astep * i     // the angle of this iteration

    S,C = SinCos (A) // the Sine and Cosine of this angle

    X = cX + R * C   // the X location of this point

    Y = cY + R * S   // the Y location of this point

    Data[X,Y]= Black  // Whatever color you want the circle to be.

 Pass DATA[ ] to the graph.

 

That's it.   If you use N = 16, you should see 16 points in a circle.  Once that looks right, set N to something higher, so that it's smooth enough for you.

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 2
(2,294 Views)