Planes flip as they move around reparameterized curve


Can someone please explain the rationale behind the ‘plane flipping’ phenomenon show here? I’m sure there is a good reason for this behaviour, I’d just like to be able to predict it happening in the future.


Dan (5.0 KB)

A Curve Frame tries to align to the tangent vector (unambiguous) and the curvature vector (ambiguous for a line which has no curvature.) Therefore you will not get consistent results for straight lines. If you want a consistent frame, you should construct one yourself given the tangent vector and some other vector (for instance, if you want a plane that stays as close to XY-parallel as possible, use the tangent as the first vector, and the cross product of the Z axis and the tangent as the second vector.)




Also, just to complement a little here, it really just depends what kind of orientation you are looking for. Remember that planes are just data about orientation in Cartesian space.

You can construct them in different ways, and you also have to consider 2 important things:

  1. The direction of the curve matters
  2. The order in which you compute the Cross product matters, because it does not obey the commutative law.

Those two points complement each other because if you first compute the Cross product that has a tangent with one direction and then do it again but with a reversed tangent ( aka, your curve is flipped) you will get a plane with a different orientation.

Just to illustrate a little, and the drawing convention:

Green vectors where used to compute the third vector shown in red

Here the plane is created by calculating the Dot product between the vector with origin at 0,0,0 ending at the point with the curves tangent, given rise to the third vector shown in red. So here you have a plane with a totally different orientation.

This plane is how Andrew was suggesting you to calculate it. The Cross product between a unit Z vector and the tangent, which gives the third vector, in red, which its also the planes Y-Axis

This is the same as the above picture EXCEPT the tangent has a different direction. So the orientation of the plane changes completely.

And finally, this plane. Which in Grasshopper language its a plane perpendicular to a vector. Which basically is the Cross product between the tangent and the Unit Z vector and then the Cross product of that result with the tangent once again.

So, the conclusion is:

Be careful with how you calculate your Cross products, and hence be in control of the type of plane that you need/want .

1 Like


Thanks very much for the further explanation. I have wired up the desired script in GH for what I’m trying to achieve, but am not sure how I would recreate this with a C# script.

Is that something you could help with as well?


I just outputted more stuff than just planes so you can visualize what is happening. (6.7 KB)

PS: forgot to internalize geometry. Just import a closed polyline, no need to explode it before hand as I take care of all that.

Some home work for you can be to evaluate any plane given a surface in C# :sunglasses:

Hi @daniel.depoe,

Create a C# component that calls this:

– Dale

Dale but that’s the easy way! The whole point was to illustrate all the vector stuff to construct planes, so Daniel learns the logic behind it (:slight_smile:


Thanks very much! I promise that I’ll do my homework, but have to say I may peek in to see how I could work with Perp Frames too.

I see you’re using Linq and Lambda expressions… More to learn.


Learning never stops… its $%£# endless lol There is always things to learn and areas to improve in. I wouldn’t worry to much about LINQ, I think that training ones self in computational geometry, mathematics and algorithms is much much more important. There is where the real stuff takes place. Of course, learning proper programming fundamentals is then key to be able to deploy succesfull code. So those are the 2 weights on both sides of the scale.