Ich versuche, Spiralen von Ellipsen aus einem Wort in Processing wachsen zu lassen. Ich habe Schwierigkeiten zu verstehen, wie man durch jeden Punkt im Wort (extrahiert unter Verwendung der geometrischen Bibliothek) iteriert, um sicherzustellen, dass jeder Punkt der Anfang jeder Spirale ist. Im Moment bildet es entweder eine Spirale oder die translate()
Funktion (auskommentiert) setzt die Ellipsen überall hin.Erstellen einer Spirale aus einer Liste von Punkten
Hier ist mein Code:
import geomerative.*;
//Leaf myLeaf;
float pointCount;
int freq = 1;
float phi = 1;
RFont font;
RShape grp;
RPoint[] points;
String TextTyped = "wipe";
float r = 0;
float theta = 0;
float angle;
float y;
void setup(){
RG.init(this);
font = new RFont("/Users/sebastianzeki/rp_samples/samples/external_library/java_processing/geomerative/data/FreeSans.ttf",200,RFont.LEFT);
size(800,600);
smooth();
background(255);
}
void draw(){
stroke(0);
strokeWeight(2);
noFill();
RGroup textGrouped;
// When extracting the dots, the entered characters do not have to be processed individually.
// The entire text textTyped can be grouped. Then the getPoints() function provides a list
// of dots comprising the outline lines of the entire text
textGrouped = font.toGroup (TextTyped);
textGrouped = textGrouped.toPolygonGroup();
RPoint[] thePoints = textGrouped.getPoints();
stroke (0, 255, 255, 64);
strokeWeight (1);
//This draws the word outline in blue circles which is fine
for (int i = 0; i < thePoints.length; i++) {
ellipse(thePoints[i].x+100, thePoints[i].y+200, 3, 3);
}
//This is the part that I am trying to get to draw spirals from the word points
for (int i = 0; i < thePoints.length; i++) {
translate(thePoints[i].x,thePoints[i].y);
float x = r * cos(theta);
float y = r * sin(theta);
r +=0.1;
theta += 0.01;
ellipse(x, y, 5, 50);
}
}
in Zukunft versuchen Sie bitte eine [MCVE] statt der Entsendung Ihre ganze Skizze zur Verfügung zu stellen. Eine fest codierte Menge von Punkten hätte gut funktioniert, um Ihr Problem zu zeigen, so dass es nicht notwendig ist, all diesen zusätzlichen Code zu veröffentlichen. Das macht es nur schwieriger für uns, Ihnen zu helfen. –