Closed clsn closed 2 years ago
If you want to place objects precisely, their points and angles are required. For example:
$fn = 16;
a_step = 360 / $fn;
for(i = [0:$fn - 1]) {
rotate(i * a_step)
translate([15, 0])
cube([1, 4, 9], center = true);
}
When you have only points or you don't care their precise angles, just as the doc says, along_with
currently provides two methods for guessing how to rotate children.
If you want, you may add more methods for guessing how to rotate children. But remember! It's still just a guess. Because you don't provide precise angles, the guessed angles might not what you want.
OK, fair. That's what I wound up doing anyway (not using along_with and writing my own placement routine) since it was just a circle anyway. I guess the lesson here is that I expected more of along_with's guessing powers than I should have. It seems to me that there's an obvious "correct" choice of angles when the curve is a simple circle, but it probably doesn't generalize well into all the paths along_with has to handle.
If I think of a guessing heuristic I think works better I'll write it up.
@clsn you might like to try adding a path-is-closed
argument to along_with
so you can calculate the tangents at the ends as though they were in the middle
@clsn If you have a simple circle, I think it's better to assign the angles
parameter directly.
use <along_with.scad>;
use <shape_circle.scad>;
$fn = 16;
step = 360 / $fn;
along_with(shape_circle(15), angles = [each [0:step:360 - step]])
cube([1, 4, 9], center = true);
I'm doing along_with on a circular path (obtained from shape_circle) and it looks like some of the elements are out of place. It looks like some sort of off-by-one error, but I don't quite see it yet. Two views, one oblique and one from directly above:
![Screenshot from 2022-04-13 18-14-29](https://user-images.githubusercontent.com/44192/163279378-f15b22c1-ed5b-4e6d-829d-7fa9e526288d.png)
Note the two adjacent slabs that are exactly parallel and aligned with each other on the right. Surely that shouldn't happen with a symmetrical path.
Also, all the other slabs aren't facing toward the center symmetrically, as I would have expected (am I wrong to expect that?)
If I get a chance I'll see if I can write a patch for this, but I thought I'd get the ticket made in the meantime.