/* I'm trying to make a long neck-like thing. I must be able to set the point where the neck starts and ends. Also the normal of the neck in these two points. ("normal" is probably not the right word. "Vector" or "direction" is probably better, but I'll just use "normal" here) I also want to control the length of the neck and the number of "links" or segments it is made of. ( The length of each "link" would then be [length-of-neck] / [number-of-links] ) I can't just use a simple spline. To use it at all I would first have to calculate it's length, then change the length of the normals, that way also the length of the spline. That I would have to do over and over again until the length was right. Then I would have to divide the spline into a certain number of segments of equal length. And even then the bending of the neck wouldn't be very realistic. Instead of that I've tried to start with a spline, but then apply forces to each point so they will arrange correctly. See my message in povray.binaries.scene-files for the code I've done so far. I have succeeded in making the points having the right distance to each other: A force is applied to each point. If the point is closer to it's neighbor than the desired length then it is pushed away from it. If the point is further away the neighbor than the desired length then it is pulled closer to it. This calculation is done to each sphere with each of each sphere's two neighbors. The difference between the old and the new position is multiplied with a small value (*1), then stored in a temporary array. When the calculations are done to each sphere, the changes are applied. Then it starts all over and over again a certain number of times (*2). This makes the point have the right distance to each other, but nothing prevents the "neck" from bending so unfortunately the points arrange themselves in a zig-zag pattern. I need help with making some forces that makes the "neck" bend as little as possible, i.e. make the distribution of the bending even, that way making the curve smooth. (look in "ikn.inc" line 45.) */ camera { location -3*x look_at 0 translate y } light_source {-10000*x, color 1} plane {-x, 0 pigment {checker}} #declare ikn_v1 = -z; // normal at start of neck #declare ikn_p1 = <+0,+0,+0>; // startpoint of neck #declare ikn_p2 = <+0,+2,+0>; // endpoint of neck #declare ikn_v2 = +z; // normal at end of neck #declare ikn_links = 50; // number of "links" in the neck #declare ikn_length = 3.5; // length of the whole neck #declare ikn_pre = 0.1; // *1 #declare ikn_maxcalcs = 200; // *2 #include "ikn.inc"