# Frames along curve but with the first and last frames set to a certain angle

Hello!
My name is Samson and I have some trouble with grasshopper. I would really appreciate if you could offer some help!

As demonstrated in the screenshot, the Perp Frame component build frames perpendicular to a curve. However, in this case, I wish the first and last frames could be at certain set angles, and all other frames will be arranged accordingly. Is there any way for me to achieve something like that?

The above image shows the ideal situation where the first frame is horizontal and last is vertical. I imagine the middle frames angle can be created with the Series component.

Rotate first and last frame or put vertical or horizontal frame where it is required. Use Cull index or list item component to select first and last frame.

1 Like

Try This.

EDIT: Well Spotted @akche001 yeah it should be -x.z though as @Joseph_Oster pointed out I solved the first part with the nice diagram and missed the additional request to also resolve the planes in-between. Doh.

Align End Planes.gh (10.5 KB)

2 Likes

Planes.gh (8.7 KB)

I worked it out like this. Edited first and last and put it back to the tree.

1 Like

Top frame/plane have flipped x axis in your definition.

1 Like

@mattgaydon, your model is only affecting the end frames, not the frames in between, right?

1 Like

I think you know the answer. Both definitions cull first and last frame, so yes.

1 Like

Yeah, I know the answer. I was trying to point out that the original question specified â€śall other frames will be arranged accordinglyâ€ť, which to me says that the frames in between will be rotated as well, evenly distributing the difference between the first and last frame angles.

1 Like

Yes, I get that point, thanks for pointing out. Yes, sometimes people are so eager just to reply that they donâ€™t actually pay enough attention to what is asked. That goes to me too.

1 Like

Yes, with Pufferfish. Use the Tween Two Curves On Curve component. Mainly because it has Quaternion Rotation which you will need for this interpolation of planes. It uses Quaternions from Rhinocommon.

TweenTwoPlanesOnCurve.gh (6.8 KB)

2 Likes

Hi @samsonliu96,

I am sure there is a more efficient way to deal with your plane rotation issue, but this (see attached gh definition) seems to work, so maybe itâ€™s gonna be helpful.

best,
Lina
rotate_planes_reLina.gh (13.7 KB)

1 Like

Take a look at first image. x vector of top and bottom plane will meet at a point and this will effect all planes.

1 Like

Another attempt. This is ok I think. Planes 1.gh (16.4 KB)

1 Like

Thatâ€™s a special case. I havenâ€™t looked at anyoneâ€™s code but @Linaâ€™s solution looks correct to me, itâ€™s what I would expect. And probably @Michael_Pryorâ€™s solution as well.

2 Likes

The special case is what is needed. This time I carefully watched the question. Otherwise it makes no sense to make first and last frame horizontal and vertical and then to arrange in between frames accordingly.

1 Like

If you want to understand why quats look here, pretty interesting video actually: https://www.youtube.com/watch?v=0VAc_G79POE

The major issue without quats is when two planes exactly oppose each other you can get some harsh plane flipping which is called Gimball lock.

You could use a calculation of rotation values like @Lina in this case itâ€™s a good solution. But if both x and y donâ€™t align (in this case x aligns) it will be tedious (rotating multiple axes) but Quaternions can do it.

QuatTerp.gh (6.9 KB)

3 Likes

Thanks Matt! I also missed the in between planes part. Also it is not clear if in between planes should be rotated along x axis or both x and y. No response from Simon yet. Good to see that everybody put up their ideas in a different way.

1 Like