Created
March 14, 2019 08:58
-
-
Save romainGuiet/fc684bc2e6a953b52b0012e48a631350 to your computer and use it in GitHub Desktop.
ImageJ macro language : Around a fixed point, get the x,y corrdinates of the points rotating around the center at a defined distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Use of the custom function rotateLine(...) | |
* Around a fixed point, get the x,y corrdinates | |
* of the points rotating around the Center at a defined distance | |
* | |
*/ | |
selectWindow("blobs.gif"); | |
// Center Point coordinates | |
x = 105 ; | |
y = 110 ; | |
// Line length | |
length = 20 ; //(in pixels) | |
// Angle step | |
step = 15 ; // (in degrees ) | |
for (i_angle = 0; i_angle < 360; i_angle+=step) { | |
rotateLine(x,y,length, i_angle); | |
wait(100); // to slow down the process so we can observe the line rotating clockwise | |
} | |
// | |
function rotateLine(x,y,length,angle){ | |
angleRad = angle* 2*PI/360; | |
x2 = x + length * cos (angleRad); | |
y2 = y + length * sin (angleRad); | |
makeLine(x, y, x2, y2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment