RhinoCommon Quaternions

So I’m very confused about Quaternions in RhinoCommon (or quite possibly in general). I figured that the following code would allow me to rotate one plane towards another by varying the parameter from 0.0 to 1.0, but I’m not getting the correct results at all. I don’t care about the translation aspect, we can assume that both planes have their origin at (0,0,0).

Clearly I cannot interpolate quaternions like I would regular numbers. What is the correct way?

Plane BlendPlane(Plane plane0, Plane plane1, double parameter)
  Quaternion q0 = Quaternion.Identity;
  Quaternion q1 = Quaternion.Rotation(plane0, plane1);
  Quaternion q2 = (q0 * (1 - parameter)) + (q1 * parameter);

  Transform transform = q2.MatrixForm();
  return plane0;

I’m struggling with the same rotation interpolation problem between two planes, is there any extra information on this?

Some like this algorithm:

Thanks Dale! I used slerp and it works well. For people who need some standard implementation, I advise to use System.Numerics.Vectors,


It has some nice features for Quaternion type

But single-precision only, so be careful with that.

thx for bringing that up, will check if there are further consequences from that to our case, I suppose as long as precision errors don’t build up in a chain of transforms it should be fine for our situation. Would be nice to get some standard implementation in Rhinocommon though :slight_smile: