Alternatively, the following script can be used with greater flexibility:
#include <pjsr/PenCap.jsh>
#include <pjsr/PenStyle.jsh>
#define X 1000 // X pixel coordinate of the starting point
#define Y 1000 // Y pixel coordinate of the starting point
#define LENGTH 1000 // Line length in pixels
#define ANGLE 30 // Position angle in degrees
#define PEN_WIDTH 10 // Pen width in pixels
#define PEN_COLOR 0xffffffff // Pen color (AARRGGBB)
function drawLinePolar( image, x, y, angle, length, penWidth, penColor )
{
if ( penWidth == undefined )
penWidth = 1.0;
if ( penColor == undefined )
penColor = 0xffffffff; // solid white
angle = Math.rad( angle );
let b = new Bitmap( image.width, image.height );
b.fill( 0 ); // transparent
let g = new VectorGraphics( b );
g.pen = new Pen( penColor, penWidth, PenStyle_Solid, PenCap_Round );
g.antialiasing = true;
g.drawLine( x, y, x + length*Math.cos( angle ), y - length*Math.sin( angle ) );
g.end();
image.blend( b );
}
function main()
{
let view = ImageWindow.activeWindow.mainView;
if ( view.isNull )
throw new Error( "No active image." );
view.beginProcess();
drawLinePolar( view.image, X, Y, ANGLE, LENGTH, PEN_WIDTH, PEN_COLOR );
view.endProcess();
}
main();
The script will draw an antialiased line (i.e., without staircase artifacts) on the current image. Pen colors are encoded in AARRGGBB format, where AA=alpha (transparency), RR=red, GG=green and BB=blue. Each component is an hexadecimal pixel value in 8-bit range. For example:
Solid black:
0xff000000
Solid red:
0xffff0000
Solid green:
0xff00ff00
Solid blue:
0xff0000ff
Translucent (50%) orange:
0x80ff8000
I hope this is useful for what you want to do.