# Affecting plane's rotation by other planes (not aligning them)

@Joseph_Oster I can’t seem to make a single Sweep1 work consistently on those curves…

As for the original problem, after an overdose of math I think I came to a satisfactory solution, composed of three steps.
First, keeping the average vector approach as a “fixed” orientation for the straight parts, I simply aligned vectors based on their dot product. This is because if you have two arcs going in opposite directions, their normal vectors will be (almost) opposite, which will result in a ~90 degree rotation that can be avoided.

Second, due to this 180 degree flip possibility, I tested the correct orientation of the sections for the sweep1 along the arcs, keeping the solution where the length of lines connecting vertices of the two sections is the smallest.

And third, and this is where I’m gonna lose everyone, taking the average vector for the straight parts is the (exact) solution to a minimization problem that only involves the direction of a straight part, compared to the directions of the arcs before and after. This is not including a goal of minimization of the minimal torsion along the arcs as well. Deriving the equations, computing the matrix, solving the system… gives a solution which I feel is smoother but… it’s getting late so this could be completely wrong. You can “disable” this by setting k=0.

MinimalRotation.gh (36.5 KB)

Edit : the maths, if anybody cares

2 Likes

The image I posted above is what I see when opening the file posted by @maj in this thread. I made no changes.

We are sorry for the duplicate thread, feel free to delete the older one!

Thanks for taking the time to look at our file.
As written in the first post of this thread, I corrected the straight parts manually to give an example on how it should look. There is a stream filter that turns manual correction on/off. It’s turned on, that’s why it looks ok when you open the file.

Best wishes.
Ilija

@magicteddy , thank you very much. We, ve been trying to solve this for two days. It made me super angry. Haha.
I just tried your file with different curves and as far as I can see it works perfectly. I will work through it today to understand what you did.

Thanks again for taking the time to solve our problem!!

@Joseph_Oster Sweep1 doesn’t work on the closed curve with multiple sections. That’s why we explode it and sweep arcs and lines separately.

I’ve had the time to look at this now and believe it’s much ado about nothing. My reply in the other thread about using just one section curve was very close to the truth.

After much experimentation, I find this morning is that one section curve works fine except for a twist at the very end. I don’t know what you and @magicteddy did to fix this? In the end, I used a separate sweep on the last section (yellow) that minimizes the twist, but it’s still there and I don’t see how it can be avoided? All the straight sections have no twist except for that last one.

BA_rotation_2023Mar2a.gh (21.9 KB)

Here is a hasty gimmick that spreads out the twist angle in the yellow section (13.244 degrees by eye) over all the curves. It uses Range and MA (‘Pr’ output) to nudge the frames (rectangle sections) of all the straight sections. Looks good, eh?

BA_rotation_2023Mar2b.gh (25.1 KB)

The ‘Angle’ could be computed instead of adjusting a slider by eye but that’s more work.

1 Like

Figured out a way to replace the ‘Angle’ slider (eyeball) with Series ReMap (purple group) that seems to work for all ‘Seed’ values of Pop2D.

BA_rotation_2023Mar2d.gh (29.9 KB)

1 Like

Hello Jospeh,
I worked through you file this morning and I like it very much. Thank you!
I like the way you used perp frame on the closed prep, instead of using it only on the arcs that way you don’t need to determine the average vector. Also the distributing of the twist on all the other straight parts works very well.

Thank you for taking the time to help us out.

Haha, now you’re showing of =)

I didn’t understand your file completely (I still don’t) I must admit I watched some basic tutorials on vectors to understand how you used dot product to check and correct rotation. Very nice!

I feel it looks better with k enabled. Although some bents seem a bit stretched. We have to see how it will affect the actual wood-bend.

Laminating thin layers? You know, of course, that the Rectangle ‘X’ and ‘Y’ inputs can be swapped to effectively rotate the “flat bar” 90 degrees, if that helps. But the random curve is indiscriminate about which orientation is easier to make.

In fact, I suppose all the planes used to make the rectangles could be rotated by the same value to orient the final result any way you want. (orange group)

BA_rotation_2023Mar3a.gh (31.4 KB)

Yes, thanks!

Yes, we will use lamination method for bending, probably witch additional steaming. But only the bends will be cut (hopefully with our uni robot). Thats why the straight part can’t be twisted.

So the connection might look something like this.

I would expect the lamination layers to be visible on only two opposite sides, not all four? Building this will be difficult, especially if the straight sections are solid pieces with scarf joints at the curves.

That was our first idea, sweep the section as it comes and align only the lamination with the arc. In this thread’s file we align the section so that the lamination will be visible only on two sides.

I’m concerned about how this sculpture gets assembled.

This white group, above the canvas, is a rather elaborate effort to create blocks that encompass the curves - with the idea that a CNC machine can be used to carve away the blocks leaving the curves.

It worries me a little that three sliders are used to adjust parameters… but otherwise, it’s cool? All the blocks are the same thickness and chopped to have edge surfaces that are square to the straight sections connecting them.

BA_rotation_2023Mar3b.gh (44.2 KB)

3 Likes

I won’t count the hours spent on understanding why this intuitive solution was giving better results, but eventually I did. As a minimization problem, it turns out the first two goals are absolutely unnecessary. Keeping only the “minimum torsion along each arc” goal, and correcting a mistake in angle evaluation AT LAST outputs the same solution - or, I should say the same base solution, as one could add a constant angle to all sections and it would still work.

Moral of the day : think before diving into n*n matrices.

Second moral of the day : `Perp Frame` component does NOT output the same plane as RhinoCommon method Curve.PerpendicularFrameAt

@maj For future readers, the solution should therefore be Joseph’s post, not mine.

1 Like

I know almost nothing about “n*n matrices” so wasn’t distracted. Zen mind, beginner’s mind.

“If your mind is empty, it is always ready for anything, it is open to everything. In the beginner’s mind there are many possibilities, but in the expert’s mind there are few.”

@magicteddy anyway, thank you for taking the time to help out a stranger. Although going through your file makes me feel a bit stupid, I like seeing how you solved the problem.

@Joseph_Oster

Blockquote
I’m concerned about how this sculpture gets assembled.

Me too. But we will figuere it out.

Blockquote
but otherwise, it’s cool?

Super cool! Love it! Thanks!

@magicteddy

Blockquote
For future readers, the solution should therefore be Joseph’s post, not mine.

Ok. I changed it. Still, thanks for your help!

1 Like

Inserting “connecting dowels” between the straight and curved parts comes to mind (gray group).

BA_rotation_2023Mar6a.gh (44.4 KB)