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

rhino5
unhandled

(Samsonliu96) #1

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

image
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?

image
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.


(Akche001) #2

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.


(Matt Gaydon) #3

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.

Updated File, just incase someone downloads it on day.
Align End Planes.gh (10.5 KB)


(Akche001) #4

Planes.gh (8.7 KB)

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


(Akche001) #5

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


#6

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


(Akche001) #7

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


#8

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.


(Akche001) #9

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. :smile:


(Michael Pryor) #10

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)


ABB robotic quaternion euler calculation
(Lina) #11

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)


(Akche001) #12

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


(Akche001) #13

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


#14

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.


(Akche001) #15

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.


(Michael Pryor) #16

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)


(Akche001) #17

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.