Ok, ich es herausgefunden. Ein Beispiel für einen Java-Code:
import static java.lang.Math.*;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class TestPolarPlot {
public static void main(String[] args) {
final int width = 512;
final int height = 512;
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics g = img.getGraphics();
g.setColor(Color.black);
g.fillRect(0, 0, width, height);
g.setColor(Color.white);
final double A = 8;
final double B = 0.5;
final double N = 4;
final double scale = 128;
final double zoom = 50;
final double step = 1/scale;
Point last = null;
final Point origin = new Point(width/2, height/2);
for (double t = 0; t <= 2*PI; t+= step) {
final double r = zoom * polarFunction(t, A, B, N);
final int x = (int)round(r * cos(t));
final int y = (int)round(r * sin(t));
Point next = new Point(x, y);
if (last != null) {
g.drawLine(origin.x + last.x, origin.y + last.y,
origin.x + next.x, origin.y + next.y);
}
last = next;
}
JFrame frame = new JFrame("testit");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JLabel(new ImageIcon(img)));
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static double polarFunction(double t, double A, double B, double N) {
return A/log(B * tan(t/(2 * N)));
}
}
Ich habe nicht erwartet, dass dies glatte Kurven erzeugt, aber es funktioniert ziemlich gut.
-1. Schaue ernsthaft auf http://en.wikipedia.org/wiki/Polar_coordinate_system nach und finde heraus, wie man (r, t) in (x, y) umwandelt. Wenn Sie eine Programmierfrage haben, dann posten Sie sie erneut bei SO. – ja72
@Raoul, Ihre Frage enthielt keinerlei Hinweis auf irgendeine Programmiersprache. Tatsache ist, dass Ihre Frage NPR ist, und nur Ihre Antwort und korrekte Markierung macht es (kaum) so. Auch jemanden als Idioten zu bezeichnen, um korrekt zu sein, ist hier kein akzeptables Verhalten. – Will
Die Programmiersprache ist irrelevant Pseudocode ist gut genug, aber was ich fragte, ist, wie man eine kontinuierliche Kurve wie das Bild, das ich postete, also im Wesentlichen wollte ich wissen, wie man einen Funktionsplotter implementiert, der das Bild produzierte, das ich gezeigt habe. Ich sehe nicht, wie das offtopic ist. Auch ich sehe nicht, wie Jalexiou überhaupt richtig ist, weil er offensichtlich völlig vermisst hat, worum es bei der Frage eigentlich ging. Vielleicht war die Frage nicht klar genug, aber jemanden zu verurteilen, weil das ein inakzeptables Verhalten von meinem POV ist, und ich nenne es, was es ist, wenn es Ihnen gefällt oder nicht. –