Thank you for replying - this does work and I’m going to go through it properly to make sure I understand (more so that I can replicate this for other lines - not just the line following a sine curve).
If you don’t mind (and have time) would you mind telling me if this is the right thinking - it doesn’t seem to work but I was trying to replicate what I thought your code was doing in my own way (i.e. using the shape of the line to calculate the radius and applying this radius to the curve calculation.
Thanks in advance and also for you help with the above.
Becky
void setup() {
size(400,500);
background(0);
float factor = 20;
float translationX = 130;
float translationY = 130;
stroke(255);
translate(0,200);
//create a series of points
for (int i = 0; i <360; i++) {
float angle = radians(i);
float y = sin(angle)*factor;
float x = i;
point(x,y); //the line I want to transform into a circle
point(x,50); //the 'baseline' I'm using to calculate my radius for the circle
//now wrap these points around a circle
//all points are evenly spaced so the only calculation we need is the radius.
//the radius is the distance between a point and the current y.
float radius = dist(x,y,x,50);
float xCircle = translationX+(cos(angle)*radius);
float yCircle = translationY+(sin(angle)*radius);
point(xCircle,yCircle);
println(xCircle,yCircle, radius);
}
}