Sine/Cosine Table

Author: Wayne Rasband (wsr at nih.gov)
History: 2006/07/14: First version
2011/09/08: Does not display row numbers
Requires: ImageJ 1.45o or later
Source: Sine_Cosine_Table.java
Installation: Download Sine_Cosine_Table.java to the plugins folder, or subfolder, then compile and run it using Plugins>Compile and Run.
Description: This plugin adds a sine/cosine table to the ImageJ Results Table and displays it in the Results window. It is equivalent to the macro:
    run("Clear Results");
    row = 0;
    for (n=0; n<=2*PI; n += 0.1) {
       setResult("n", row, n);
       setResult("Sine(n)", row, sin(n));
       setResult("Cos(n)", row, cos(n));
       row++;
    }
    setOption("ShowRowNumbers", false);
    updateResults()
Macros can retrieve values from the Results Table using the getResult macro function:
    for (i=0; i<nResults; i++)
       print(getResult("n",i), getResult("Sine(n)",i));
Plugins can also display tabular data in a TextWindow:
    String title = "Sine/Cosine Table";
    String headings = "n\tSine(n)\tCos(n)";
    TextWindow tw = new TextWindow(title, headings, "", 400, 500);
    for (double n=0; n<=2*Math.PI; n += 0.1)
       tw.append(IJ.d2s(n,2)+"\t"+IJ.d2s(Math.sin(n),4)+"\t"+IJ.d2s(Math.cos(n),4));

|Plugins | Home |